Hello!
Does Macro Scheduler offer support for functions?
I would like to create a function that accepts parameters.
So, instead of calling subroutines like
GoSub>srt_command_defterm
GoSub>srt_command_help
GoSub>srt_command_ping
GoSub>srt_command_define
GoSub>srt_command_calc
which are almost similar, I'd like to use a function like srt_command(parameter) so the function returns a value or does something according to the provided parameter.
Is that possible?
Does MS support functions?
Moderators: JRL, Dorian (MJT support)
Yes, you can pass parameters to subroutines in Macro Scheduler. Parameters are separated from the name of the subroutine and from each other by commas. Here's a simple example. A subroutine that adds any two numbers that are passed to it as parameters. This is very basic. No error checking, it only performs one simple task. The parameters passed are recognized in the subroutine as variables in the form "SubroutineName_var_number" where number is the position of the parameter from the subroutine name starting with one.
See Help for GoSub>
See Help for GoSub>
Code: Select all
GoSub>Add,2,3
GoSub>Add,10021.909,862.1
GoSub>Add,-23,-12
SRT>Add
Let>Sum=%Add_var_1%+%Add_var_2%
MDL>The Sum of %Add_var_1%+%Add_var_2%=%Sum%
END>Add