Jump to content
Macro Express Forums

Doing A Couple Things


Recommended Posts

When you promt for a set of N variables it wont let you save them. How can i save them so when people start the program they dont have to retype the variables.


And how do i have the macro automatically update. (I tried to use ftp but it wants you to save the file to a specific location. I want it to upgrade the macro file thats running)

Link to comment
Share on other sites

I'm not sure what you mean in Your first paragraph. I'll guess you mean that when the macro completes the variables do not persist.


In this case I save the variables to the registry and then read them back in at the beginning of the macro. Also if you read them in and set the variable before prompting the user the value will appear in the dialog box.


As for your second paragraph I’m not quite sure what you mean. If you want to update the macro file simply save the file in a network location and enabled the synchronize options in ME. You can find them under the preferences in the network section.

Link to comment
Share on other sites

Cory I am a noob at macros. Will you give simpiler instructions to having the macro automatically update?


Oh yeh heres an update. These macros are not going to all the people on my network. It will be available for dload by whoever just want to automatically update it. (Also make it not optional to have it not update

Link to comment
Share on other sites

When you have a variable you want to save for next time simply write that variable to a registry key. Then when the macro starts up again next time load the value from their. I recommend using the HKCU (HKey Current User) hive and use the miscellaneous folder under Macro Express. It’s HKEY_CURRENT_USER\Software\Insight Software Solutions\Macro Express\Miscellaneous normally. Just make a key in there called “My variable” or whatever you like.


Also I keep lots of values in here and instead of modifying them from the macro I create a separate macro for setting preferences. This way if the value doesn’t change that often, say their screen name, the macro won’t prompt them every time for it.

Link to comment
Share on other sites

You say 'network drive'... If you are sharing these variables with more than one machine then I suggest you save them in text files and not the registry so your users can all see the same variables. You should also check into the ini file capability in ME. This is a much more structured way of dealing with variables in text files.


As far as text files versus registry I would have to say that performance wise there's probably no appreciable difference. If you remember in the early Windows days variables were saved in text file called ini files. ini files were often a pain as they could get corrupted easily, have file locks, and in general were difficult to manage with file structure changes as so on. The Registry was the solution for that and it's just a big database and it was MS's intention that everyone use this to keep settings instead of ini files or other methods. I just like it because if it’s simplicity. Also the structure is the same from machine to machine. And there’ are nice features like HKCU (HKey Current User) which changes for each user logged in. The path is always the same but if I have a workstation with multiple users they can each have their own preferences. But in any case I knew that the registry was the solution so I reckoned I’d just use it instead of ‘discovering’ the shortcomings for myself. The registry has special protections and since it's spooled up in memory it's very quick. I just have an aversion to disk writes and reads. I will often process large amounts of data in a variable instead of using something like the ASCII File Process. Things are just way faster that when you don’t involve the disk but of course it's only appreciable when you're processing thousands of records.


To answer your question there are many benefits but I'm not really conversant. But you can read a really good writeup on the advantages on Wikipedia. This link will take you right to the section.

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