I've got Macro Scheduler Pro to do everything I need so far, but I can't seem to find anything about Return Codes. Is it possible to send return codes from the compiled scripts? If not, I've got a work around - but RC's would be ideal for my project.
Thanks!
Return Codes from Script .exe's?
Moderators: JRL, Dorian (MJT support)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Actually, I just mean sending a return code back from the script executable to indicate a condition within the script (success or failure, for example), sometimes called an exit code.
Example:
If (a=b)
return 0 (returns a zero to the calling program)
else
return 1 (returns a one to the calling program)
Example:
If (a=b)
return 0 (returns a zero to the calling program)
else
return 1 (returns a one to the calling program)
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Run Program returns a variable RP_RESULT. You can check that value in your IF decision. From HELP on Run Program>:
By default a message is displayed if this command encounters an error when running the specified program. Error messages from this command can be suppressed by setting RP_DISPLAYERROR to 0.
The result of the Run Program command is stored in the variable RP_RESULT. A value greater than 31 indicates success. The following values represent errors :
0 - The system was out of memory, or the executable file was corrupt, or relocations were invalid.
2 - The file was not found.
3 - The path was not found.
5 - An attempt was made to dynamically link to a task, or there was a sharing or network protection error.
6 - The library required separate data segments for each task.
10 - The Windows version was incorrect.
11 - The executable file was invalid. It was either not a Windows-based application or there was an error in the .EXE image.
12 - The application was designed for OS/2.
13 - The application was designed for MS-DOS 4.0.
14 - The type of executable file was unknown.
15 - An attempt was made to load a real-mode application (developed for an earlier version of Windows).
16 - An attempt was made to load a second instance of an executable file containing multiple data segments that were not marked "read-only."
17 - Attempt in large-frame EMS mode to load a second instance of an application that links to certain non-shareable DLLs already in use.
18 - Attempt in real mode to load an application marked for protected mode only.
By default a message is displayed if this command encounters an error when running the specified program. Error messages from this command can be suppressed by setting RP_DISPLAYERROR to 0.
The result of the Run Program command is stored in the variable RP_RESULT. A value greater than 31 indicates success. The following values represent errors :
0 - The system was out of memory, or the executable file was corrupt, or relocations were invalid.
2 - The file was not found.
3 - The path was not found.
5 - An attempt was made to dynamically link to a task, or there was a sharing or network protection error.
6 - The library required separate data segments for each task.
10 - The Windows version was incorrect.
11 - The executable file was invalid. It was either not a Windows-based application or there was an error in the .EXE image.
12 - The application was designed for OS/2.
13 - The application was designed for MS-DOS 4.0.
14 - The type of executable file was unknown.
15 - An attempt was made to load a real-mode application (developed for an earlier version of Windows).
16 - An attempt was made to load a second instance of an executable file containing multiple data segments that were not marked "read-only."
17 - Attempt in large-frame EMS mode to load a second instance of an application that links to certain non-shareable DLLs already in use.
18 - Attempt in real mode to load an application marked for protected mode only.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
If you want to pass back your own data one way is to use environment variables. See the following commands:
SetEnvVar
GetEnvVar
The compiled macro could set an environment variable with SetEnvVar which will then be available to the calling process.
Macros can also set the MACRO_RESULT variable but this is only relevent for macros called by other macros. I suggest environment variables where you are calling scripts from other applications.
Other methods include INI files, setting registry keys and writing to text files.
SetEnvVar
GetEnvVar
The compiled macro could set an environment variable with SetEnvVar which will then be available to the calling process.
Macros can also set the MACRO_RESULT variable but this is only relevent for macros called by other macros. I suggest environment variables where you are calling scripts from other applications.
Other methods include INI files, setting registry keys and writing to text files.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?