Timing?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
macrunning
Pro Scripter
Posts: 68
Joined: Wed May 04, 2005 10:24 pm

Timing?

Post by macrunning » Mon Jan 16, 2006 5:06 pm

Hello,
I was wondering if anyone new how I could determine when photoshop was done running a batch process.
Heres what I've got.
The automation script downloads a zip file. Extracts the file to a folder on my desktop. Then the automation script opens Photoshop up and runs a Photoshop Automation Script. The photoshop resizes the images that were extracted to the folder on my desktop.
What I can't figure out is how or can Macro Scheduler determine when the Photoshop script is done processing so that I can continue on with the remainder of the automation script. The number of images being processed by Photoshop will vary in quantity so I have no way to specifiy a certain time frame for Macro Scheduler to wait.
Any help would be greatly appreciated.
THanks.

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Mon Jan 16, 2006 7:26 pm

You have to ask yourself, "How would I visually know when Photoshop is finished?"

Take that answer and make MacroSched do the same thing. For example, if you would read the words PROCESS DONE in some screen region, then you write your script to look (look, loop, look, loop....) for those words in that location. If it is text that can't be read as a windows Control Text (so you would use GetControlText), you could use the new Image Recognition DLL to check for the pixels in that area to match your required text.

Of course, there is always a chance PhotoShop leaves some log file or other "trace" out there on the disk. So maybe you could check for the existence of a log file with a specific date/time.....but option A is a sure thing.

SkunkWorks

User avatar
JRL
Automation Wizard
Posts: 3517
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jan 16, 2006 7:31 pm

Just a thought, I have done this in the past, just not with PhotoShop.

Create a small jpg file, call it ~DoNotDelete~.jpg. Put it in some obscure corner of your harddrive. C:\Program Files\Common Files\~DoNotDelete~.jpg for example. (The next part is the weak link in this plan, I have no idea whether PhotoShop can do this or not.) Modify your PhotoShop script so that the last thing it does is open C:\Program Files\Common Files\~DoNotDelete~.jpg and perform a "SaveAs" to the root of your C: drive creating file C:\~DoNotDelete~.jpg. Have a loop in Macro Scheduler that looks for the existance of C:\~DoNotDelete~.jpg. When the file is created, your PhotoShop script has finished.

Something like this:


//Run your PhotoShop Script
Label>CheckForFile
Wait>5
IfFileExists>C:\~DoNotDelete~.jpg,Continue,CheckForFile
Label>Continue
DeleteFile>C:\~DoNotDelete~.jpg
//move on

Hope this is helpful,
Dick

macrunning
Pro Scripter
Posts: 68
Joined: Wed May 04, 2005 10:24 pm

RE: Timing?

Post by macrunning » Mon Jan 16, 2006 7:32 pm

Unfortunately Photoshop doesn't spit out any text such as "Process Done". If it did I would have used the loop feature you discussed. My only thought on it was could I have Macro Scheduler somehow recognize that Photoshop is processing something and when it was finished Macro Scheduler could pick it up from there. I though about it checking for the window names but each image opens up a window by it's file name (so Window Name = File Name). Not sure how I would run through all the file names and then be able to tell Macro Scheduler Photoshop has completed processing all of the images (based on file name). Also I'm not much of an expert at Macro Scheduler.

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Mon Jan 16, 2006 7:47 pm

If the WindowName = FileName, could you force the last file name in the process every time? For instance if you created a file (something like JRL suggested) named ZZZZZZZ.jpg (or whatever photoshop works with), then MacroSched could kickoff PhotoShop and wait for the WindowName ZZZZZZZ.jpg to close. Then you know you are done.

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Jan 16, 2006 7:59 pm

Is there not a status bar or something? Surely some part of the screen changes when the process is complete. Some menu option disabled or only enabled when complete, or a button caption changes, or the status bar changes ... something. Whatever it is there will be a way to wait for it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

macrunning
Pro Scripter
Posts: 68
Joined: Wed May 04, 2005 10:24 pm

Post by macrunning » Mon Jan 16, 2006 8:25 pm

I will give the zzzzz.jpg filename thing a try. Thanks.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts