Jump to content
Macro Express Forums

Passing text variable with forward slash via Command Line Parameters


iceman

Recommended Posts

The code command used was /VT1:500000/5000.

I am planning to do a manually workaround by replacing the forward slash (e.g. /VT1:500000[Chr47]5000) with a custom string of text (e.g. [Chr47]) and then replace the custom string with a forward slash (i.e. /) after Restoring Values.

<VARSR:05><TMVAR2:21:01:01:000:000:[Chr47]/>

To replace most of the forward slashes, here's a macro that loops through the first 97 text variables and replaces them.

Note: I used ASCII47 in this sample code instead of [Chr47].

The following code is also attached as a playable macro that you may import.

<REM2:RestoreTextVariablesReplaceForwardSlash><REM2:Converts custom text to forward slash in all variables except T98 and T99.><REM2:Uses T98, T99, and N99.><VARSR:06><REM2:T99 - Master String><TVAR2:99:01:><REM2:N99 - Variable counter><REP3:01:000001:000001:00097:1:99:><TMVAR2:07:99:00:000:000:<TMVAR2:21:><IFVAR2:2:99:3:10><REM2:Add leading zero.><TMVAR2:07:99:00:000:000:0><ENDIF><REM2:Replace ASCII47 with forward slash for text variable N99.><TMVAR2:07:99:00:000:000:%N99%:01:000:000:ASCII47ASCII01/ASCII01>><ENDREP><REM2:Replace ASCII Characters.><ASCIIC:98:1:01><TMVAR2:21:99:01:000:000:ASCII01%T98%><REM2:Run scripted macro to replace forward slashes.><RUNMACVAR:99>

RestoreTextVariablesReplaceForwardSlash.zip

Link to comment
Share on other sites

The forward slash is used as a command line delimiter. When you enter /VT1:500000/5000 Macro Express sees it as /VT1:50000 followed by /5000. Since /5000 is not a valid command line switch, it is ignored.

 

You could use a different character to separate the two values like this: /VT1:500000#5000 and then have your macro split them up. Another approach would be to put each value in a separate variable like this: /VT1:500000 /VT2:5000.

 

Other characters that have meaning for a Windows command line such as '\', '<', '>' and '|' cannot be passed via the command line.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...