Jump to content
Macro Express Forums

Another percentage symbol bug?


Recommended Posts

This macro asks the user to enter a string, displays it with a Text Display, and then types it into Notepad.

 

Variable Set String TestString: Prompt

Text Box Display:

Activate or Launch: Window "Notepad", Program "NOTEPAD.EXE", Parameters ""

Wait for Window Title: Notepad

Text Type (Simulate Keystrokes): %TestString%

 

<VARIABLE SET STRING Option="\x01" Destination="TestString" Prompt="Enter the string for testing" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>
<TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 TestString\\f1  = \\f0 %TestString%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<ACTIVATE OR LAUNCH Title="Notepad" Exact_Match="FALSE" Wildcards="FALSE" Path="C:\\WINDOWS\\NOTEPAD.EXE" Mode="\x00" Default_Path="TRUE" Wait="1" Wait_For_Program="12"/>
<WAIT FOR WINDOW TITLE Title="Notepad" Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<TEXT TYPE Action="0" Text="%TestString%"/>

 

If the string contains anything that looks like a variable, such as %A% then the Text Display works fine but the Text Type is completely ignored. Nothing gets typed and the macro proceeds.

 

A bug? Probably the general issue about percentage sign handling we've discussed ages ago, but which I've never seen any conclusion? And perhaps even related to the one I described earlier today in the thread 'Removing % causes hard crash' that crashed MEP.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

This macro asks the user to enter a string, displays it with a Text Display, and then types it into Notepad.

 

Variable Set String TestString: Prompt

Text Box Display:

Activate or Launch: Window "Notepad", Program "NOTEPAD.EXE", Parameters ""

Wait for Window Title: Notepad

Text Type (Simulate Keystrokes): %TestString%

 

<VARIABLE SET STRING Option="\x01" Destination="TestString" Prompt="Enter the string for testing" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>
<TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 TestString\\f1  = \\f0 %TestString%\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<ACTIVATE OR LAUNCH Title="Notepad" Exact_Match="FALSE" Wildcards="FALSE" Path="C:\\WINDOWS\\NOTEPAD.EXE" Mode="\x00" Default_Path="TRUE" Wait="1" Wait_For_Program="12"/>
<WAIT FOR WINDOW TITLE Title="Notepad" Partial="TRUE" Wildcards="FALSE" Indefinite="TRUE" Hours="0" Minutes="0" Seconds="0"/>
<TEXT TYPE Action="0" Text="%TestString%"/>

 

If the string contains anything that looks like a variable, such as %A% then the Text Display works fine but the Text Type is completely ignored. Nothing gets typed and the macro proceeds.

 

A bug? Probably the general issue about percentage sign handling we've discussed ages ago, but which I've never seen any conclusion? And perhaps even related to the one I described earlier today in the thread 'Removing % causes hard crash' that crashed MEP.

 

--

Terry, East Grinstead, UK

Just 2 more cents: I occasionally use Modify String commands where I connect multiple variables together to create

a [booming voice]mega-variable[/booming voice]. Example:'

 

Imagine the following is part of a... mad-lib macro (or something):

%T[1]%= "This is my "

%T[2]%= "dog, "

%T[3]%= "Argos. He's "

%T[4]%= "an Australian Labradoodle."

 

To build a mega-variable, I do a Modify String:

 

%Modified% = %T[1]%%T[2]%%T[3]%%T[4]%

 

Sometimes this works. Sometimes MEP fails to notice the opening % and prompts me to create a variable named

something like: T[1]%%T[2]

 

I've only seen it a few times, and it goes away if I separate the %% with a comma or a space, but definitely something

strange going on with %s

Link to comment
Share on other sites

I copied your code and it works perfectly for me when I manually enter something that looks like a variable. Tried several combinations of two percent signs with no problem. Are you using version 4.1?

Link to comment
Share on other sites

I copied your code and it works perfectly for me when I manually enter something that looks like a variable. Tried several combinations of two percent signs with no problem. Are you using version 4.1?

 

Thanks Cory. That prompted me to repeat the test. Wouldn't you just know it - it was OK this time! I just hate intermittent problems like this... :blink: Some temporary conflict? So I'm left wondering when it will happen again, and of course if it does it's unlilkely to be in such a controlled situation.

 

I ran the macro a dozen times before posting originally and not once did the behaviour differ from what I described. But this time, Notepad got the right result every time.

 

That inconsistency sounds a characteristic of your problem too, Steve. Bizarre.

 

--

Terry, East Grinstead, UK

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

×
×
  • Create New...