Jimco Posted July 25, 2011 Report Share Posted July 25, 2011 I am writing a macro that will output technical instructions to an email to be sent to a customer. One of my steps has the user change to the Windows directory at a command prompt. Because I don't know in advance what the Windows directory will be, I want my step to appear as follows. 3. Enter the following to change into the Windows directory. cd %windir% No matter how I try to avoid it, Macro Express is always evaluating this and outputting "cd c:\Windows" instead of just outputting the literal text. I have tried checking the "Don't process embedded variables" checkbox, but it has no effect. I tried changing my literal value to "%%windir%%", but that just causes ME to output "%c:\Windows%" which is still not what I want. Does anyone have any ideas? Thanks! Jim Quote Link to comment Share on other sites More sharing options...
Cory Posted July 25, 2011 Report Share Posted July 25, 2011 Is this in the eMail send command message body? Quote Link to comment Share on other sites More sharing options...
Jimco Posted July 25, 2011 Author Report Share Posted July 25, 2011 Is this in the eMail send command message body? Hi, Cory. No, it's not. I am setting a string variable that includes the literal value "%windir%" and then I am using the Text Type command to output the variable to an open email message. Thanks. Jim Quote Link to comment Share on other sites More sharing options...
Cory Posted July 25, 2011 Report Share Posted July 25, 2011 That was a challenge but I found a solution. Problem is we have an option not ot process embedded variables in other places like Set Variable but not here. And even if you make the message body a variable first it’s still evaluated. So what I did was to temporarily change my environmental variable’s name to "Windirr" (two Rs), send the email, then set it back. I’m guessing there’s a way you could automate that with a VBScript or command line. Quote Link to comment Share on other sites More sharing options...
Jimco Posted July 25, 2011 Author Report Share Posted July 25, 2011 That was a challenge but I found a solution. Problem is we have an option not ot process embedded variables in other places like Set Variable but not here. And even if you make the message body a variable first it’s still evaluated. So what I did was to temporarily change my environmental variable’s name to "Windirr" (two Rs), send the email, then set it back. I’m guessing there’s a way you could automate that with a VBScript or command line. Very clever, Cory. Thank you. I can take care of it using that technique. Jim Quote Link to comment Share on other sites More sharing options...
Jimco Posted July 25, 2011 Author Report Share Posted July 25, 2011 Well, easier said that done. As it turns out, the Macro Express process has its own environment block, so even if I modify the environment variable via script, the environment block that ME has still contains the original variable. The only around that (that I know of) is to restart the ME process after modifying the variable with my script. I'm still working on a solution to this, but it may not be possible. Jim Quote Link to comment Share on other sites More sharing options...
Cory Posted July 25, 2011 Report Share Posted July 25, 2011 I just tested it and it works fine. Sent myself an email and got c:\windows. Changed the environmental var and ran again and this time it came out %Windir%. If you are using the SET command in a command prompt don't forget that changes there only persist for that session and might even be limited to that session. Try this just as an experiment. Control Panel > System > Advanced System Settings > Then in the Advanced tab of the System Properties click the Environmental Variables... > and go down into the System Variables section and edit and rename Windir. I bet your macro will work that way. Quote Link to comment Share on other sites More sharing options...
Jimco Posted July 25, 2011 Author Report Share Posted July 25, 2011 I just tested it and it works fine. Sent myself an email and got c:\windows. Changed the environmental var and ran again and this time it came out %Windir%. If you are using the SET command in a command prompt don't forget that changes there only persist for that session and might even be limited to that session. Try this just as an experiment. Control Panel > System > Advanced System Settings > Then in the Advanced tab of the System Properties click the Environmental Variables... > and go down into the System Variables section and edit and rename Windir. I bet your macro will work that way. Hi, Cory. Yeah, I tested that exact scenario. In my macro, I have this in a Text Type command. "Enter %windir%\System32" When that runs, it outputs "Enter C:\Windows\System32" to the focused window. Even if I rename my windir system environment variable, I get the same thing. I'm not sure if this might not be a subtle OS difference. I'm testing this on Windows Server 2008 R2 x64. I attached a debugger to the macexp.exe process and dumped the process environment block. In that, I can see that there's still a windir variable set to C:\Windows. I suspect that's why it's still not working. If I close Macro Express and relaunch it, the new PEB contains the renamed variable. So much trouble that really may not even be worth it, but I do appreciate your help. Jim Quote Link to comment Share on other sites More sharing options...
Jimco Posted July 25, 2011 Author Report Share Posted July 25, 2011 The macros I'm working on are for a Macro Express Pro pilot for a very large computer software company. The reliability of the macros is extremely important, and instead of convoluting the macro to get this done and risking failure in some environments, I've decided to simply add wording that says, "The location of your Windows directory may differ from these instructions." That ought to cover it. Thanks for the help, Corey. Jim Quote Link to comment Share on other sites More sharing options...
paul Posted July 26, 2011 Report Share Posted July 26, 2011 Try outputting in 2 parts. This works for me: Text Type (Simulate Keystrokes): cd % Text Type (Simulate Keystrokes): windir% Quote Link to comment Share on other sites More sharing options...
Cory Posted July 26, 2011 Report Share Posted July 26, 2011 I don't think that will work Paul because he's using the message box in the Email Send command. You might use a substitute character like ampersand and instruct them to replace the ampersand with a percent sign. Quote Link to comment Share on other sites More sharing options...
paul Posted July 26, 2011 Report Share Posted July 26, 2011 I don't think that will work Paul because he's using the message box in the Email Send command. You might use a substitute character like ampersand and instruct them to replace the ampersand with a percent sign. I must have missed something! He said earlier he was using the text type command ... and then I am using the Text Type command to output the variable to an open email message. and since my code is also using the Text Type command, it looked straight-forward to me. Quote Link to comment Share on other sites More sharing options...
Jimco Posted July 27, 2011 Author Report Share Posted July 27, 2011 I must have missed something! He said earlier he was using the text type command and since my code is also using the Text Type command, it looked straight-forward to me. Paul, You are correct. I am using Text Type, and the steps that you gave me solved the problem. Thank you! It took a bit of retooling since my steps were defined in a variable and the "%windir%" instance was about half way through them, but it's all working fine now. Thanks to both of you for the assistance. Jim Quote Link to comment Share on other sites More sharing options...
Cory Posted July 27, 2011 Report Share Posted July 27, 2011 I must have missed something! He said earlier he was using the text type command He never said he was using text type command in the first message but rather that he was sending an email. I mistakenly assumed that meant he was using the Email Send command. He used the word "Output" which could be taken either way. Later he mentioned using text type and I must have missed that. Quote Link to comment Share on other sites More sharing options...
patrickbarrett Posted September 27, 2011 Report Share Posted September 27, 2011 Something like this should work as well: <VARIABLE SET TO ASCII CHAR Value="37" Destination="%PercentSign%"/> <VARIABLE SET STRING Option="\x00" Destination="%TextToEnter%" Value="cd %PercentSign%WINNT%PercentSign%"/> Quote Link to comment Share on other sites More sharing options...
terrypin Posted September 27, 2011 Report Share Posted September 27, 2011 As Patrick said, it's easily done by a simple substitution and a command I rarely use. This solution goes back a few years to Joe. Variable Set to ASCII Char 37 to %Percent% Text Box Display: Message <VARIABLE SET TO ASCII CHAR Value="37" Destination="%Percent%"/> <TEXT BOX DISPLAY Title="Message" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\qc\\b\\f0\\fs24 Enter the following to change into the Windows directory\r\n\\par \r\n\\par cd \\f1 %Percent%\\f0 windir\\f1 %Percent%\\b0\\fs16 \r\n\\par }\r\n" Left="696" Top="238" Width="548" Height="200" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/> TBD details: Result: -- Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.