Jump to content
Macro Express Forums

Registry reference runs every time


Recommended Posts

Can someone either give me insight or verify this issue on their machine?

 

I use virtualization almost exclusively in my work. At any one time, I'm typically administering two dozen different virtual machines. Now if I name a VM "VM-Foxtrot", there is no way for that VM to self-reference its name [a configuration report, for example]--until I create a registry value within each VM. Okay, done. The macro only runs at startup of the VM [after MEP loads], and should display the prompt only one time:

 

<IF REGISTRY Key="TRUE" Exists="FALSE" Path="HKEY_LOCAL_MACHINE\\SOFTWARE\\Macros\\VM"/>
<VARIABLE SET STRING Option="\x01" Destination="VM" Prompt="Name this VM:" Mask="FALSE" OnTop="FALSE" Left="Center" Top="Center" Monitor="0"/>
<WRITE REGISTRY VALUE Key="HKEY_LOCAL_MACHINE\\SOFTWARE\\Macros\\VM" Destination="%VM%"/>
<ELSE/>
<MACRO STOP/>
<END IF/>

 

Except this macro still prompts at every startup of every VM, asking for a VM name when the registry key and string value already exists. I put a delay on MEP starting, it still prompts every time. I flopped the logic; still prompts. Sure, all I have to do is cancel the prompt forevermore after the initial run, but it still annoys me to no end why this simple macro doesn't work as expected.

 

So, either I'm missing something fundamental [i don't know what I don't know], or it's a virtualization issue, or possibly a defect in MEP 4.2.2.1. Thoughts?

Link to comment
Share on other sites

This issue has nothing to do with virtualization. How do I know that? I ran your macro in my normal Windows 7 environment, and was prompted for the value each time. At first I thought the problem must lie with Permissions, but soon discovered this was not the case.

 

Curiously, your own code contains the answer!

Line 1 checks for the existence of a registry key, while line 3 writes a registry value!

 

Simply change line 1 to check for the existence of the registry value VM.

Link to comment
Share on other sites

Well, stupid is as stupid does. Once I'd decided it was a bug in ME, I was blind to the bug in my code. Thanks, paul.

 

My face will eventually quit being this color...

Nothing to do with stupidity. I can stare at a few lines of code for hours and fail to see the obvious problem. If I walk away for a while, then come back to the problem, I can often see immediately what it previously took me hours to miss! Another technique is to explain, in excruciating detail, to another person (real or imaginary) exactly what the code does. It's amazing how often that does the job!

Link to comment
Share on other sites

Another technique is to explain, in excruciating detail, to another person (real or imaginary) exactly what the code does. It's amazing how often that does the job!

I do this frequently as well! Too funny. Pity the fool who has to listen to me only to have me mercifully trail off mid sentence as I realize my mistake and go flying back to the computer.

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