Jump to content
Macro Express Forums

Multiple Choice Menu Question


patgenn123
 Share

Recommended Posts

Hello all!

 

Hey, I was wondering if the multiple choice menu could save what was checked.

 

In other words, let's say I have a multiple choice menu that has Monday, Tuesday, Wednesday etc. and on Monday I click the "Monday checkbox" signifying the task was done.

 

Can it be opened the next time and still show that Monday was checked (and so on and so forth..)?

 

 

Pat

Link to comment
Share on other sites

Yeah, I do it all the time. Simply save the value to the registry or file then set the item next time before the prompt. EG Read registry string “Day-o-week” to T1, multi-choice for text to T1, write T1 to registry for next time.

Link to comment
Share on other sites

Cory on the Spot!

 

Hey Cory! How are you? I hope well.

 

Hey, pardon my ignorance, but I learn from example. Do youhave something simple to help me along the way? Please do not spend more than two minutes. I just need to see a tiny example whether it's your registry idea(which i am dying to learn how) and/or the text file.

 

Thanks!

 

Pat

Link to comment
Share on other sites

Open the macro file samples.mex found in the folder where Macro Express is installed. (By default for English this would be c:\Program Files\Macro Express3.)

 

The macro 'Multiple Choice Menu with Default' shows how to set a default value in a Multiple Choice Menu. The macro 'Counter from Run to Run' shows how to save a variable and load it the next time that macro runs.

Link to comment
Share on other sites

Hi Pat,

 

I personally have never written anything to the registry, so I don't know how it works (and I'm kind of scared to try), so if you're

comfortable with it, then by all means ignore my response.

 

If I use a multiple choice menu, and want to have my selection remembered for the next time it runs, I generally just save the variable

with the Save All Variables command, and Restore All Variables before we get to that prompt. For example:

 

Variable Restore All Variables
If Variable %T1% = ""
 Variable Set String %T1% "Mon"
End If
Multiple Choice Menu: This Test Is For Pat
Text Box Display: Your Selection:
Variable Save All Variables

 

<VARSR:05><IFVAR2:1:01:1:><TVAR2:01:01:Mon><ENDIF><MENU2:1:T:01:CenterCenter:This Test Is For PatPlease select an optionMon
Tue
Wed
Thu
Fri
Sat
Sun><TBOX4:T:1:CenterCenter000278000200:000:Your Selection:%T1%><VARSR:01>

 

If you are using a check-box menu, and want to set the default to multiple selections, say Monday and Tuesday, you just string the selections

together in the Set String command like this: Variable Set String %T1%"MonTue" You can string them in any order, and it will work fine.

 

Of course, when you restart ME, this will reset %T1% back to nothing, and you will have to be careful with any other macros that may use

the Variable you're saving. You can still use it, you just can't save the variable in question in a different macro or you'll lose this saved

information... and if you end up with something that isn't on the list, you'll end up with no selection at all in your multiple choice.

 

Now, if you want the macro to remember the selection from day to day or relaunch to relaunch of ME, it gets a tad more complicated

(though not too bad). This is where I would save my selections to a text file buried somewhere on my hard drive, and then use a process

file command to recall previous selections. I think this was one of Cory's suggestions.

 

Same macro, recalling from run-to-run:

 

Variable Set String %T2% "C:\Users\Steven\Documents\Macros\Macro Test Files\MultiChoicePathForPat.txt"
If File Exists "%T2%"
 Text File Begin Process: "%T2%"
 Text File End Process
End If
Multiple Choice Menu: This Test Is For Pat
Variable Modify String: Save %T1% to Text File
Text Box Display: Your Selection:

 

<TVAR2:02:01:C:\Users\Steven\Documents\Macros\Macro Test Files\MultiChoicePathForPat.txt><IFOTH:01:2:%T2%><BTFBEG:001:000001:000000:%T2%><BTFEND><ENDIF><MENU2:1:F:01:CenterCenter:This Test Is For PatPlease select an optionMon
Tue
Wed
Thu
Fri
Sat
Sun><TMVAR2:17:01:00:000:000:%T2%F><TBOX4:T:1:CenterCenter000278000200:000:Your Selection:%T1%>

 

The only problem is this: If you are tracking what work has been done throughout the week, for example, and when you finish one task

you are running the macro to check that it has been done, and you need it to reset at the beginning of the week each week, you're going

to need to write a bit more code to make that happen.

 

Here is what I would do, based on my limited understanding of what you're trying to do and on what I have done with some of my macros:

 

// First, Set Variables With Paths to the Saved Text Files
Variable Set String %T2% "C:\Users\Steven\Documents\Macros\Macro Test Files\MultiChoicePathForPat.txt"
Variable Set String %T3% "C:\Users\Steven\Documents\Macros\Macro Test Files\NewWeek.txt"
// Set Today's Day of Week to a Variable
// If Today is Monday (or beginning of work-week) the Following Code Will
// Determine Whether or Not the Multiple Choice Member Resets
Date: Save Day of Week 1 (Mon) into %T5%
If Variable %T5% = "Mon"
 If File Exists "%T2%"
If File Exists "%T3%"
  Text File Begin Process: "%T3%"
  Text File End Process
  // The Following Prompt Gives the User the Option to Clear the Multiple Choice Menu or Not
  // This Prompt Will Only Come Up the First Time the Macro Runs on Monday
  If Variable %T4% <> "Yes"
	If Message: "Test Prompt to Reset Check Boxes"
	  Delete File or Files: "%T2%"
	End If
  End If
End If
Variable Set String %T4% "Yes"
Variable Modify String: Save %T4% to Text File
 End If
End If
// If Today Is NOT Monday, the Following Code Will Ensure That On 
// Monday (or beginning of week) the Multiple Choice Menu Will Get Reset
If Variable %T5% <> "Mon"
 Delete File or Files: "%T3%"
End If

// And Here Is the Functional Macro
If File Exists "%T2%"
 Text File Begin Process: "%T2%"
 Text File End Process
End If
Multiple Choice Menu: This Test Is For Pat
Variable Modify String: Save %T1% to Text File

 

<REM2:First, Set Variables With Paths to the Saved Text Files><TVAR2:02:01:C:\Users\Steven\Documents\Macros\Macro Test Files\MultiChoicePathForPat.txt><TVAR2:03:01:C:\Users\Steven\Documents\Macros\Macro Test Files\NewWeek.txt><REM2:Set Today's Day of Week to a Variable><REM2:If Today is Monday (or beginning of work-week) the Following Code Will><REM2:Determine Whether or Not the Multiple Choice Member Resets><Day of Week 1{NP000}{P000}05><IFVAR2:1:05:1:Mon><IFOTH:01:2:%T2%><IFOTH:01:2:%T3%><BTFBEG:004:000001:000000:%T3%><BTFEND><REM2:The Following Prompt Gives the User the Option to Clear the Multiple Choice Menu or Not><REM2:This Prompt Will Only Come Up the First Time the Macro Runs on Monday><IFVAR2:1:04:2:Yes><IFMESS3:00000:1:1:Test Prompt to Reset Check BoxesIs it a new week? Should I reset the check boxes to empty?Center:Center><DOFILE:08:NN:%T2%>><ENDIF><ENDIF><ENDIF><TVAR2:04:01:Yes><TMVAR2:17:04:00:000:000:%T3%F><ENDIF><ENDIF><REM2:If Today Is NOT Monday, the Following Code Will Ensure That On ><REM2:Monday (or beginning of week) the Multiple Choice Menu Will Get Reset><IFVAR2:1:05:2:Mon><DOFILE:08:NN:%T3%>><ENDIF><REM2:><REM2:And Here Is the Functional Macro><IFOTH:01:2:%T2%><BTFBEG:001:000001:000000:%T2%><BTFEND><ENDIF><MENU2:1:F:01:CenterCenter:This Test Is For PatPlease select an optionMon
Tue
Wed
Thu
Fri><TMVAR2:17:01:00:000:000:%T2%F>

Link to comment
Share on other sites

Thanks Scaspar, Kevin, Cory and all,

 

Terrific examples! Terrific ideas. I think the text file(the last one) might be the best way to go especially if you use a Window cleaner that cleans out the %TEMP% files as Kevin mentioned and the SAMPLES have as an example.

 

The only thing I am curious to know is the registry idea that Cory mentioned.

 

Would anyone(including Cory) like to chime in on how to write it to the registry?

 

Thanks!

 

Pat

Link to comment
Share on other sites

Thanks Scaspar, Kevin, Cory and all,

 

Terrific examples! Terrific ideas. I think the text file(the last one) might be the best way to go especially if you use a Window cleaner that cleans out the %TEMP% files as Kevin mentioned and the SAMPLES have as an example.

 

The only thing I am curious to know is the registry idea that Cory mentioned.

 

Would anyone(including Cory) like to chime in on how to write it to the registry?

 

Thanks!

 

Pat

 

I, too, would like to know more about writing to the registry without messing up my system.

Link to comment
Share on other sites

HKEY_CURRENT_USER\DEMO\MacroExpress\image_number

 

Read Registry Integer: "image_number"

Text Box Display: show current value

Variable Modify Integer: Inc (%N5%)

Write Registry Integer: "image_number"

Text Box Display: show new value

 

<REGRINT:5:HKEY_CURRENT_USER\DEMO\MacroExpress\image_number><TBOX4:T:1:CenterCenter000278000200:000:show current value%N5%><NMVAR:08:05:0:0000001:0:0000000><REGWINT:5:HKEY_CURRENT_USER\DEMO\MacroExpress\image_number><TBOX4:T:1:CenterCenter000278000200:000:show new value%N5%>

<REGRINT:5:HKEY_CURRENT_USER\DEMO\MacroExpress\image_number><TBOX4:T:1:CenterCenter000278000200:000:show current value%N5%><NMVAR:08:05:0:0000001:0:0000000><REGWINT:5:HKEY_CURRENT_USER\DEMO\MacroExpress\image_number><TBOX4:T:1:CenterCenter000278000200:000:show new value%N5%>

 

 

double click the Read or Write Registry and the you can change it to read/write a text string etc.

 

(forum ops ... why is this post so wide?)

Link to comment
Share on other sites

Thanks McZenner!

 

This may be a stupid question since I don't know anything about reading/writing to the registry, but is there an overall "safe place" to read/write to the registry that would run macros other than just this one place?

 

In other words, I am looking at HKEY_CURRENT_USER\DEMO\MacroExpress\image_number

and I don't see "DEMO" anywhere. Are you creating this folder?

 

What are actually doing with DEMO since I don't see it in my registry tree? Is this a general safe haven to write to with anything else?

 

Thanks!

 

Pat

Link to comment
Share on other sites

>>>HKEY_CURRENT_USER\DEMO\MacroExpress\image_number and I don't see "DEMO" anywhere. Are you creating this folder?

yes, i chose current user and added the DEMO Key for the example (i checked first , nothing was there, and i can delete it after the demo)

 

could make it HKEY_CURRENT_USER\xxxxtest\ or whatever...

 

 

just don't collide with any other keys (controlled mostly by company/product name)

 

most settings to a new software installation are normally stored under HKEY_LOCAL_MACHINE\Software

 

ie.

 

HKEY_LOCAL_MACHINE\Software\America Online

HKEY_LOCAL_MACHINE\Software\Business Objects

HKEY_LOCAL_MACHINE\Software\Dell Computer Corporation

 

so you could create a unique name and the subkeys would be safe

 

 

 

Settings that are user-definable, and which could have different values for different users of the computer, are stored under

HKEY_CURRENT_USER\Software\

 

HKEY_LOCAL_MACHINE\Software\DAVIDCUSTOM

 

link to notes about the Registry and also Microsoft's recommendations

about the Window's Registry

 

before inserting a new key..

always a good idea to READ the branch first (where you intend to insert a new key) and verifty it DOES exists

then read to make sure the intended new key DOES NOT exist (so you don't override one unintentionally)

then insert

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