Custom trigger

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Semper
Junior Coder
Posts: 30
Joined: Mon Feb 25, 2008 3:28 pm

Custom trigger

Post by Semper » Thu Apr 21, 2011 9:52 pm

Hi,

is there a way for a custom trigger script to first check if a certain script that is currently running finished?

Thank you.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Thu Apr 21, 2011 9:55 pm

Search the online help at mjtnet.com for this. It wasn't in my local help file, but I tried it and it works.
WaitProcessTerminated>myprocessname

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

Post by JRL » Fri Apr 22, 2011 3:50 am

...It wasn't in my local help file...
I have it in my local help. Using v12.1.3

As far as I know WaitProcessTerminated> would work well for compiled scripts but might not work so well with uncompiled scripts since all uncompiled scripts run under the msched.exe process.

Methods I've used require that script "A" provide script "B" with a detectable device. Script "A" might have an open dialog that is located well off the desktop, that can be detected by script "B" as an open window. When the window closes, script "A" has finished. Another method would be that script "A" creates a file just before closing and script "B" waits for the existance of that file. There are other methods that are more complicated such as placing info into the clipboard or using API functions but my favorite is the off screen dialog because it is easy and reliable. For example:
Script "A"

Code: Select all

Dialog>Dialog1
  Caption=Really odd and easily distinguished window name
EndDialog>Dialog1

MoveWindow>Really odd and easily distinguished window name,-32000,-32000
Show>Dialog1

///The rest of script "A"
Script "B"

Code: Select all

WaitWindowOpen>Really odd and easily distinguished window name

WaitWindowClosed>Really odd and easily distinguished window name

///The rest of script "B"

Semper
Junior Coder
Posts: 30
Joined: Mon Feb 25, 2008 3:28 pm

Post by Semper » Fri Apr 22, 2011 7:23 am

Thanks JRL,

that would work. I only came up with the ini file that initaly has something like ISRunning=TRUE and at the end of the script it edits the ini and puts FALSE, and the trigger reads the ini waiting for FALSE.

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