app.executeCommand() and GUI prompts

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
User avatar
lloydalvarez
Enhancement master
Posts: 460
Joined: June 17th, 2004, 9:27 am
Location: New York City, NY
Contact:

Has anyone figured out how to handle a GUI Prompt when using app.executeCommand();? I am trying to write a script that saves all the frames in a comp to individual PSD Layer documents and have all of it done except for when the Save Dialog comes up for the PSD doc..

Thanks,

-Lloyd
bradshaw1965
Posts: 98
Joined: March 14th, 2006, 2:16 pm
Location: Atlanta, GA
Contact:

Hey Lloyd,

It'd be a bit of a hack but you could call a GUI script with callSystem() after a delay on the Mac.

http://www.apple.com/applescript/uiscripting/

Not sure about Windows...
Dale Bradshaw
Technology Director | Primal Screen
creative-workflow-hacks.com
Atlanta, GA
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

It's possible on Windows but it's kind of John Rambo script :)
I describe the way I achieved it for those who'd like to try..
There are actually three components: .exe, .bat and .jsx
  1. - The .exe is a little program (10 lines or so) that retrieves a handle to the "Save Layered File As..." dialog, set it to foreground window and then simulates a Return key press.
  1. - The .bat is a batch file that consists in a loop calling the .exe.
  1. - The .jsx script writes the .bat file and starts a loop over the work area duration (playing with the comp name to avoid identical output file names). Then the save dialog pops up for the first frame and the process stops (temporarily).
I double-click the .bat and that's it. I obtain a serie of Return key press simulation (with some delay adjustable through the script) which allows AE to save frames one by one as layered psd.

A bit tricky but that works.

Good luck Lloyd for the Mac version.
Nachovilla
Posts: 4
Joined: May 4th, 2007, 2:28 pm
Location: Los Angeles, CA
Contact:

I am really interested in this script. Are you saying that you are tryin to save each frame with all layers intact cause I really need a script that can do this. Can you specify how to make it?

atorres_at_In-Three_dot_com
One frame at a time
atorres_at_In-Three_dot_com
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

Yes. The procedure is explained above (in humble frenglish :)).
If you don't know how to code it, download this folder exportFramesAsLayeredPSD.zip. It contains the "exportFramesAsLayeredPSD.jsx" script and the "KeyPress" executable (open this folder in your explorer to access it faster later).

First, make sure that "Allow scripts to write files..." is checked (in general prefs).
Then,
  • - activate a comp and execute the script
  • - a prompt asks you if you want to create the bat file (click yes)
  • - a prompt asks you to enter a delay in seconds (estimation of the time needed to render a frame)
  • - AE's save dialog pops up, choose the destination folder BUT do not click the save button
  • - in your explorer double-click KeyPress.bat that has normally been created
  • - have a drink until the render is complete...
  • - when finished you may have to close the console window
Let me know if that doesn't work as expected.
Nachovilla
Posts: 4
Joined: May 4th, 2007, 2:28 pm
Location: Los Angeles, CA
Contact:

Script worked like a charm. :P Thank you, I ll admit I have a hard time with scripting cause of how unfamiliar I am with writing the language. You do a great service for all of us who stuggle with this. Cheers.
One frame at a time
atorres_at_In-Three_dot_com
Post Reply