Jump to content
Macro Express Forums

Prevent Variable Substitution ?


07y05m29d

Recommended Posts

Created a script that intends to for example, replace instances of "D:\Win510 Users.A" with "%UserProfile%" under the TypedURLs registry key.

 

The problem is that "%UserProfile%" keeps being substituted.

 

Is there a way to prevent Macro Express from substituting a variable in a command ?

 

.

.

.

If not, perhaps an checkbox labeled, "Prevent Variable Substitution" could be added to the appropriate commands in the next release.

 

Regardless of whether or not it is currently possible, an answer would be appreciated. (so that I may move on)

 

Thanks.

Link to comment
Share on other sites

There is not a way to prevent variable substitution. You may be able to use two separate macro commands to accomplish what you need.

 

Try doing this Replace Substring:

 

"D:\Win510 Users.A" with "%UserProfil###"

 

and then do this Replace Substring:

 

"###" with "e%"

Link to comment
Share on other sites

The consideration and reply is much appreciated Kevin.

 

This is another issue had been racking my brain over and had already attempted a similar work-around using "Variable Set to ASCII Char" to no avail.

 

I also attempted your suggested variation on a work-around as well and unfortunately no dice. (v3.5e)

 

The substitutions are probably performed in a latently executed common routine called with every command.

Link to comment
Share on other sites

On a side note, it doesn't appear to work with variables but in DOS/Console, the character "^" can be placed before executable characters such as ampersand "&" and pipe "|" to prevent execution. In the process, the "^" character is automatically stripped, just leaving the executable character. (if this string is then parsed again, that character will then be executed)

 

Example:

 

ECHO Repeat this sentence ^& do not give an error.

 

ECHO Repeat this sentence & give an error.

Link to comment
Share on other sites

My error... in a console window it actually does work with variables. Maybe it didn't work before because it may be necessary to double-up (or triple?) on the "^" when executed from within a script file.

 

 8:56:40.24
Wed 05/30/2007
Windows Environment
E:\Temp>echo %^userprofile%
%userprofile%


9:00:27.15
Wed 05/30/2007
Windows Environment
E:\Temp>

 

Unfortunately what works for the WinNT/XP Console, does not work for MacEx. :(

(at least not yet ;) )

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...