Using non-Modal dialog in subroutine

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
ibatey
Newbie
Posts: 10
Joined: Thu Dec 17, 2015 9:24 pm

Using non-Modal dialog in subroutine

Post by ibatey » Thu Dec 17, 2015 9:34 pm

Apologies if this is answered elsewhere, but I've trawled the boards and can't find the answer.

I have a small non-modal dialog that I would normally call from a subroutine (for MA read Macro>).

I can make this work well if it is in a main script
OR
by using an include file in the main script. (which would deliver my immediate need if I'm honest)

What I was originally trying to do though was call it as a sub-macro using the Macro> command, return control to the main script and then some time later close the dialog from the main script.

I've fiddled with various options, but as soon as it returns to the main script the dialog closes. OR by looping the non-modal dialog, I can't return to the main script.

Not even sure this is possible, but am intrigued enough to try and find out.

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

Re: Using non-Modal dialog in subroutine

Post by JRL » Fri Dec 18, 2015 3:42 am

Macro> calls another script. The calling script pauses until the Macro> called script completes. The key word there is "completes". If you have a dialog in the Macro> called script the dialog is done when the called script is done.

Include> is really what you need.

ibatey
Newbie
Posts: 10
Joined: Thu Dec 17, 2015 9:24 pm

Re: Using non-Modal dialog in subroutine

Post by ibatey » Fri Dec 18, 2015 4:28 pm

Thanks... that's pretty much the conclusion I had come to... Just wanted an opinion from someone who's been using Macro scheduler for more than a few days.

Thanks again.

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

Re: Using non-Modal dialog in subroutine

Post by JRL » Fri Dec 18, 2015 8:08 pm

If you want to call a script and run it asynchronously it can be done. Just use either RunProgram> or ExecuteFile>.

The system variable "Command_Line" for non-compiled scripts is the path and program that is Macro Scheduler, msched.exe. The system variable "Script_dir% is the folder in which the currently running script resides and is usually the place where most of your other scripts are also residing. But not always. So these are generalizations of likely paths to a secondary script you might want to open from your main script.

Code: Select all

RunProgram>%command_Line% %script_dir%\myscript.scp
ExecuteFile> will only work if the .scp extension is associated with the Macro Scheduler program. This will be so unless you explicitly stopped the association during the Macro Scheduler install.

Code: Select all

ExecuteFile>%script_dir%\myscript.scp

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