Jump to content
Macro Express Forums

undefined variables


Recommended Posts

I have been getting these errors for undefined variable or variable of the wrong type.

 

They are either boolean or control vars.

 

In one case, I had named a control variable "%control2%" and MEP would never let the macro go past that line without letting me know it was either undefined or the wrong type. I checked in the variable editor to make sure it was a control variable and it was. I changed the name to "%C[2]%" and it worked just fine after that.

 

Now I am starting to have the same issue with some named boolean variables.

 

Is anyone else having this issue?

 

Thanks!

Link to comment
Share on other sites

Looking at this more, it seems that my Boolean variable is not surviving a "Save all variables" in one macro and "restore all variables" in another.

 

Example: at the end of a Macro named start, I set a Boolean named %ZZZZ% to TRUE, then "Macro Run" to macro2, which happens to start with "restore all variables". In macro2 %ZZZZ% has actually FLIPPED from True to False with no variable modification logic present.

 

The two macros in separate boxes below demonstrate this

 

<VARIABLE SET BOOL Destination="%ZZZZ%" Command="263" Value="TRUE"/>
<TEXT BOX DISPLAY Title="Start Macro, after setting to True" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %ZZZZ%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<VARIABLE SAVE Option="\x00"/>
<TEXT BOX DISPLAY Title="Start Macro, after Save All variables" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %ZZZZ%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<MACRO RUN Use_ID="FALSE" Name="end" ID="-1" Wait="TRUE"/>

 

<TEXT BOX DISPLAY Title="Second macro, before variable restore" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %ZZZZ%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<VARIABLE RESTORE Option="\x00"/>
<TEXT BOX DISPLAY Title="Second Macro after Variable restore" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %ZZZZ%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>

Link to comment
Share on other sites

I couldn't reproduce your problem. Have you tried going back, deleting the variable ZZZZ completely and re-entering? I'm sure I've had similar glitches but they've also been related to If statement issues and variables within variables. This week I was having problems with variables and messed around endlessly. The problem finally disappeared. I had no idea why other than I entered the variable numerous different ways.

 

I've also found %controlname% more problematic than %C[1]%.

Link to comment
Share on other sites

Oddly enough, a restart fixed the boolean issue.

 

Yes, "the problem mysteriously disappeared" is an algorithm I am somewhat familiar with!

 

I had this issue in a much larger set of macros (read:huge) and there were so many things to troubleshoot I spent most of the day on it before deciding to do the two-small macros test approach from my second post. Without fail, the last dialog box would return FALSE, exactly what it was doing in the large macro.

 

So a restart apparently has this working now, resulting in TRUE.

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