jridings Posted June 10, 2010 Share Posted June 10, 2010 Is there a way to create a button and use a quick sequence to print a text file from my hard drive? Link to comment Share on other sites More sharing options...
AzeoTech Posted June 10, 2010 Share Posted June 10, 2010 Yes. You can use system.shellexecute() and run, say, notepad with the -print option. Most text editors support the -print option, which is standard for windows. Link to comment Share on other sites More sharing options...
jridings Posted June 18, 2010 Author Share Posted June 18, 2010 Ok here is my code; System.ShellExecute("Notepad.exe", ["print"], [""], ["C:\Hello.txt"], [show]): My file is located at c:\Hello.txt, but I get an error C1069 Nothing to subset. What did I do wrong? Thanks for your help. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 18, 2010 Share Posted June 18, 2010 You don't want any of the [], and drop the Show at the end: System.ShellExecute("Notepad.exe", "print", "", "C:\Hello.txt") The [] in the function descriptions in the help mean the parameter is optional. This is quite standard among function descriptions in all languages. Link to comment Share on other sites More sharing options...
polilies Posted May 9, 2011 Share Posted May 9, 2011 is there something wrong about this script System.ShellExecute("Notepad.exe", "print", "", "C:\Hello.txt") cause when i try this with "open" parameter it fails actualy there no effect happen. here is my code: System.ShellExecute("tutar.txt","open","","C:\Users\Alican\Desktop\tutar.txt") but when i change it like this format System.ShellExecute("tutar.txt","open","","C:\Users\Alican\Desktop") it works well enough. and do you have any information about adding a file to .rar or zip folder(compressing). thank you so much Link to comment Share on other sites More sharing options...
AzeoTech Posted May 9, 2011 Share Posted May 9, 2011 It doesn't work because you are specifying the file as the executable "tutar.txt". This is relying on Windows file associations to run the correct program. You should instead run notepad directly, passing the path of the file, something like what you asked first: System.ShellExecute("Notepad.exe","open","","C:\Users\Alican\Desktop\tutar.txt") As for zip archives, WinZip offers a command line utility that you can trigger from ShellExecute to add files to compressed folders. I believe it comes free when you purchase a WinZip license (which used to be only $50). I've used it personally to perform exactly this sort of thing with DAQFactory. In my case, it was to archive a bunch of reports before emailing, all done within DAQFactory. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.