var idquit = charIDToTypeID( "quit" );
executeAction( idquit, undefined, DialogModes.ALL );
Thanks - that's getting me closer to where I need to be :-)
On a related question, is there a way to supress the "You should only run scripts from a trusted source" message box that pops up when you externally launch a .jsx file?
Never mind - just discovered I can run the PS exe directly with my script as an arg and it appears to work fine :-)
Care to share RichardMunn?
if you want to keep things simple...
Is there possible to Start the application or open the application through scripting?
Could you please let me know.
Check this code.
It' working greatly.
cde = '"C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)" d:\someScript.jsx' tmp = File('~/Desktop/Tmp.txt'), tmp.open('w'), tmp.write(cde), tmp.close();
then you rename it by Ps script to someScript.bat, and finally you execute it. This way you omit that warning:
Of course if you don't want to put your scripts to "C:\Documents and Settings\Administrator\My Documents\Adobe Scripts" folder or run it directly from Photoshop (when your scripts are in Photoshop/presets folder you can't just double click your script. You must either do it by command line (the same as clicking right mouse button on the script file to choose 'open with' and then select Photoshop), or if you call some script by external executer (when your script is not in secure source) you can do it the way I described at beggining.
That code at top what's put to notepad in order to change it then to batch file, means that you want to open someFile.jsx which you see in second part of that code (so it's a like an argument), in the application (Photoshop) you see in first part of that code.
There should be possible to do that by app.system('"C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)" d:\someScript.jsx') but unfortunatelly that doesn't work, though when I tried something simpler like system(notepad d:\someText.pdf') there wasn't a problem. (yes, I wrote .pdf to open as .txt as this example came to me as similar to open .jsx not by extendscript but a photoshop).
I was smart and did something like it:
system('"' + app.path.fsName + '\\photoshop.exe" ' + File($.fileName).fsName)
well it worked but some strange way. It opened Command Line window, not for max a second though like it happens most often, but for longer to get stuck untill you closed it manually. Then the script started working (you can try with some simple alert('Hello')). When I tried to run it again Photoshop stopped working and some error popped up that I had to quit photoshop and open again. I repetead it few times and always that was like before. The same error forcing me to reopen Photoshop. Too bad. Fortunatelly I always can do that I put by a script everything to a text, to save as text and change to .bat, to run it when I want (see beggining of this post).
This is very good method if you want to run all scripts you'd like to supress harrasing security window, and you don't want to change all your scripts to be always opened directly by Phoptoshop (possible by changing default appliccation in properties of file), as they appear then with Photoshop.exe icon and the first application to run any script (even if there is #target extendscript) will be Photoshop.
There is other method with shortcut, but I hope the one in this long post will be sufficient for anyone having same problem.
I believe he is referring to running a command line command along the lines of:
start "" photoshop.exe PathToScript\ScriptName.jsx
which will launch the file without a prompt.