Does MS support functions?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
ineedh3lp
Junior Coder
Posts: 26
Joined: Thu Nov 04, 2010 1:11 am

Does MS support functions?

Post by ineedh3lp » Thu Nov 04, 2010 1:20 am

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?

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

Post by JRL » Thu Nov 04, 2010 3:20 am

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>

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

ineedh3lp
Junior Coder
Posts: 26
Joined: Thu Nov 04, 2010 1:11 am

Post by ineedh3lp » Thu Nov 04, 2010 4:36 am

Thank you for the information!

I also learned that I was ignorant regarding the documentation for subroutines.

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