Printing


jridings

Recommended Posts

  • 2 weeks later...

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

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

  • 10 months later...

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

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

Archived

This topic is now archived and is closed to further replies.