Jump to content
Macro Express Forums

Invisible registry item

Recommended Posts

Hi I'm writing both numeric and text string values to the registry.

ALL these values are there because I can see them using Regedit. (Ignore READ as this is copied from another section of the code)

The last two values which are in fact text strings are not shown if i try to use a text box to list them. They are not "0" they are simply absent.

If I duplicate the same section of code later in the program everything is fine and all the values get displayed.

I put this line at the very start to test if the registry entry was visible: 

<IF REGISTRY Key="FALSE" Exists="TRUE" Path="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\drawingmacro1"/> 

Result: It's invisible.(It's a text string)

I then used <IF REGISTRY Key="FALSE" Exists="TRUE" Path="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\pixcor1"/> 

This time it displays (Within a text box) This is a numeric value.

I'm running the macro from a portable version with admin privileges. Does anyone have an idea what could be happening?



<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\p" Destination="%P%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\pixcor1" Destination="%PIXCOR[1]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\pixcor2" Destination="%PIXCOR[2]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\pixcor3" Destination="%PIXCOR[3]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\pixcor4" Destination="%PIXCOR[4]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\pixcor5" Destination="%PIXCOR[5]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\pixcor6" Destination="%PIXCOR[6]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\pixcor7" Destination="%PIXCOR[7]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\pixcor8" Destination="%PIXCOR[8]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\avoid1" Destination="%AVOID[1]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\avoid2" Destination="%AVOID[2]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\avoid3" Destination="%AVOID[3]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\avoid4" Destination="%AVOID[4]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\drawingmacro1" Destination="%DRAWINGMACRO[1]%"/>
<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\drawingmacro2" Destination="%DRAWINGMACRO[2]%"/>

<TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %PIXCOR[1]%\r\n\\par %PIXCOR[2]%\r\n\\par %PIXCOR[3]%\r\n\\par %PIXCOR[4]%\r\n\\par %PIXCOR[5]%\r\n\\par %PIXCOR[6]%\r\n\\par %PIXCOR[7]%\r\n\\par %PIXCOR[8]%\r\n\\par %AVOID[1]%\r\n\\par %AVOID[2]%\r\n\\par %AVOID[3]%\r\n\\par %AVOID[4]%\r\n\\par %DRAWINGMACRO[1]%\r\n\\par %DRAWINGMACRO[2]%\r\n\\par \r\n\\par \\f1 \r\n\\par }\r\n" Left="821" Top="420" Width="280" Height="354" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>


Link to comment
Share on other sites

I'm having trouble following your explanation and example. I recommend you create a simple test macro to illustrate your problem for us so we can see it on our machines. BTW often when I try to create such a macro I find my mistake. Or that when taken out of the context of the more complex macro the problem disappears meaning it's something in my main macro and not what seemed to be the cause. 

Having said that let me guess at what your'e saying. You say you write a value to the registry and when you read it back immediately your change isn't apparent? And that later it will be apparent? I can't imagine Windows being this way but is it possible the macro needs a few milliseconds to make your change? Often things in programming languages have forms of write caching. I know in .NET streamwriters by default accumulate many small changes and write them in chunks. Also most programs can run things as asynchronous tasks. That is the code does not wait for a task that could take some small amount of time before going ahead. Imagine a pizza delivery place. They cant stop and wait for a driver to return before making the next pizza to be made. Instead they make pizzas as the orders come in and trust their drivers will return in time which grossly increases efficiency. In programming languages most these things are trivial and cache and async aren't important. If it was and you were the programmer you could force it to wait or force it to flush a cache. But you don't have access to that in MEP. If I were you I'd make a few test with delays and what not to see if something like this is happening. And of course make a test macro and share it with ISS support and forum members. 

Link to comment
Share on other sites

Hi Cory 

Thanks your reply. I like the pizza delivery guy analogy..

I have attached a sample macro, and a jpeg of my registry keys and the textbox display output (the last one).

At runtime lines 5-7 do not cause the textbox to display as if drawingmacro variable does not exist. Clearly from my image of regedit it does.

This macro that I have included here refuses to read the last two variables as if they don't exist. The values are text strings stored in the registry at an earlier run-time. The odd thing is, if i copy and paste that same code to a later part of my main macro, then it works ?!? It's as if those two variables are not accessible UNLESS they are stored and retrieved within the same macro activation. Is this normal windows behaviour?








Link to comment
Share on other sites

I created a registry values for every variable used in your macro of corresponding type. "p" and "drawingmacro#" SZ (string) types and "pixcor#" and "avoid#" all DWord (32 bit integer). The macro works flawlessly. Both text boxes "exists" work. Multiple choice. I choose the second one to generate a "B" result. And a full list at the end with all the values I entered into my registry. Now I did notice that if the registry value name is not correct it doesn't generate an exception in the debugger. If you get the data types wrong it does. So given that line 5 tests false and nothing appears for the drawingmacro items I'm willing to bet you a six pack that drawingmacro1 and drawingmacro2 do not exist in your registry. Perhaps you spelled the intended values incorrectly. Please export the entire macroexpress key form the registry editor and post it here. Or take mine which I attached and import it into yours. 


Link to comment
Share on other sites

No it doesn't :-) The instance of drawingmacro1 in your screen is a key, not a value. Look at the reg file export you just sent me in a text editor. There are no values in there named drawingmacro1.

Key contain an object called "values". "Values" are what actually contain data. TO use the fie system as an analogy keys are directories and values are files. Click here to get a more detailed description. 

Link to comment
Share on other sites

I've got it now..

Line 5: should read If registry: key etc.

and lines 23 & 24 were missing a backslash after drawingmacro1 and drawingmacro2. Works flawlessly now.

<READ REGISTRY VALUE Key="HKEY_CURRENT_USER\\SOFTWARE\\macroexpress\\drawingmacro1\\" Destination="%DRAWINGMACRO[1]%"/>

Thanks for your invaluable help. Simple things do throw me!!

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.

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.

  • Create New...