Page 1 of 1

How to pass command-line arguments to PMC script?

Posted: 13 Apr 2021, 15:02
by alanchung
I run my Macro Creator PMC scripts from Windows Scheduler or command prompt like below:
"C:\Program Files\MacroCreator\MacroCreator.exe" "my.pmc" -s1

I like to pass some arguments like
"C:\Program Files\MacroCreator\MacroCreator.exe" "my.pmc" -s1 arg1 arg2

and then access the arguments in the script. I know it is possible to do so from AHK script (see https://superuser.com/questions/1401680/how-to-pass-command-line-arguments-to-ahk-script). I would like to know how to do the same from a PMC script.

Re: How to pass command-line arguments to PMC script?

Posted: 14 Apr 2021, 05:36
by Pulover
You can find all arguments on the A_Args array :arrow: https://www.autohotkey.com/docs/Variables.htm#Args

Code: Select all

[PMC Globals]|None||
[PMC Code v5.4.1]|F12||1|Window,RegEx,Fast,1,1,Input,-1,-1,1|1|Macro1
Context=None|
Groups=Start:1
1|[MsgBox]|% A_Args[1] "`n" A_Args[2] "`n" A_Args[3]|1|0|MsgBox|0||||1|

c:\Program Files\MacroCreator\MacroCreator.exe "file.pmc" -a customArgument