Setting command line parameters while debugging?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Setting command line parameters while debugging?

Post by NancyM » Thu Dec 01, 2016 9:19 pm

I'm developing a script that will require a few parameters, but I need to run with the debugger. Is there a way to set those parameters so they'll be available for the debug session?

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

Re: Setting command line parameters while debugging?

Post by JRL » Thu Dec 01, 2016 10:31 pm

When you pass a parameter all you are doing is creating a variable within the executing script. Therefore make a variable with the parameter name to use during debug.

Let>ParameterOne=A Fake Passed Value
//The rest of the script.

Just be sure you delete before actually using the script.

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Re: Setting command line parameters while debugging?

Post by CyberCitizen » Sat Dec 03, 2016 2:15 am

You could create a file and use iffileexists>
Include>
And using that include script that could contain your preset variables so when the file doesn't exist it won't use them.

Or just set them at the start of the script and comment them out when Finished.
FIREFIGHTER

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Setting command line parameters while debugging?

Post by Marcus Tettmar » Mon Dec 05, 2016 8:59 am

Either just temporariliy hard code the variables into the script for debug purposes or do something like this:

Code: Select all

Assigned>PassedParameter,haveParameter
If>haveParameter=FALSE
  Let>PassedParameter=debug value
Endif
The benefit of this is that if you don't need to remember to remove anything when you "go live". The above will initialise the parameter if none was passed and will do nothing if one was provided.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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