This sample code illustrates the problem with passing
a variable as a parameter to a macro.
The main macro contains these lines ----------------------
ReadIniFile>c:\myini.ini,settings,window,WinTitle
Macro>%SCRIPT_DIR%\Test1.scp /mywin=%WinTitle%
------------------------------------------------------------------
The macro "Test1.scp" contains ---------
MessageModal>%mywin%
----------------------------------------------
The contents of c:\myini.ini -----
[Settings]
window=hello / there
-------------------------------------
Running this code will produce the error message:
"Error with Let>there, = missing"
I don't have control over the data which is being read in, so
having the "/" characters is always a possibility. The only alternative
I can think of is to try to replace "/" with something else prior to
passing it as a parameter, however there is no "safe" character to
replace it with that might not already exist in the input data.
Any ideas? Or is there a way to make this limitation go away?
Thanks.
Problems with macro parameters containing the "/"
Moderators: JRL, Dorian (MJT support)
Well I think I may have found a solution which I will share to see if anybody can think of a better one....
The main macro is modified as follows: -----------------
ReadIniFile>c:\myini.ini,settings,window,WinTitle
VBStart
VBEnd
VBEval>escape("%WinTitle%"),WinTitle
Macro>%SCRIPT_DIR%\Test1.scp /mywin=%WinTitle%
------------------------------------------------------------------
The test1 macro is modified as follows: --------
VBStart
VBEnd
VBEval>unescape("%mywin%"),mywin
MessageModal>%mywin%
-------------------------------------------------------
Can macro scheduler be modified to do this type of escape/unescape
process behind the scenes when passing parameters so that I am
freed from the extra coding?
Thanks.
The main macro is modified as follows: -----------------
ReadIniFile>c:\myini.ini,settings,window,WinTitle
VBStart
VBEnd
VBEval>escape("%WinTitle%"),WinTitle
Macro>%SCRIPT_DIR%\Test1.scp /mywin=%WinTitle%
------------------------------------------------------------------
The test1 macro is modified as follows: --------
VBStart
VBEnd
VBEval>unescape("%mywin%"),mywin
MessageModal>%mywin%
-------------------------------------------------------
Can macro scheduler be modified to do this type of escape/unescape
process behind the scenes when passing parameters so that I am
freed from the extra coding?
Thanks.