Jump to content
Macro Express Forums
acantor

Write and read values to the Registry

Recommended Posts

I've never used Macro Express to interface with the Windows Registry. But now I have an idea for a script that would "remember" a setting from the previous run time. 

 

Are there certain areas of the Registry I should avoid reading and writing values to? Are some areas "safer" than others?

 

For example, could I add a key called "My Values" here without causing problems?

 

HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express 6\My Values

Share this post


Link to post
Share on other sites

Yes, me too. I chose a similar location, with separate keys for Integer and Text, and made it a 'Favorite' for fast access.

 

 

WorkArea.jpg

  • Like 1

Share this post


Link to post
Share on other sites

So you suggest adding a key (with several sub-keys) in HKEY_CURRENT_USER\... Any advantages or drawbacks of burying my custom settings deeper in the hierarchy?

Share this post


Link to post
Share on other sites

Hi Alan,

 

I just found it easier to keep track by splitting into those two sub-keys.

 

I've never tried other locations which instinctively seems risky!

 

Share this post


Link to post
Share on other sites

Hi Terry,

 

I created a new key in the registry and the macro has been saving the retrieving the data as I hoped it would.

 

But now I realize I could also save the data in a file, which would be less risky.

 

Variable Modify String: Save %SavedValue% to "C:\Users\Me\Documents\Test.txt"
 
Variable Set String set %SavedValue% to the contents of C:\Users\Me\Documents\Test.txt	

 

Share this post


Link to post
Share on other sites

There is nothing inherently risky about saving data in the registry as long as you know and remember which registry area (key) you use. Using the registry may be somewhat faster than reading from a file. However, depending on what your macro is doing, you may not notice the difference.

 

There is a potential side effect of using values in the area of the registry (registry key) that Macro Express uses such as this:

    HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express 6\My Values

 

When you export the Macro Express settings (Tools, Export Program Configuration) and then import them either later (Tools, Import Program Configuration) Macro Express will display a warning about the registry keys and values that it does not recognize.

 

It is pretty safe to use other areas of the registry such as 

  HKEY_CURRENT_USER\Terry Work Area

 

You could also use something like this:

  HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express Data

  • Like 1

Share this post


Link to post
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...

×
×
  • Create New...