Jump to content
Macro Express Forums

Multi-choice Macro Menus


Lon

Recommended Posts

Wondering if someone might have a good example for me to look at.

 

I am contemplating a macro to create a text document. In the creation of this document a certain amount of text would be written and I would like a pop up menu to ask the user for a choice of perhaps "A", "B", or "C". The macro would type the text based on the choice ("A" in this case) or prompt for user input then would arrive at a NEW pop up menu with choices "1", "2", "3", "4", "5", etc. If "B" had been chosen the next menu might pop up with choices "C1", "C2", "C3", etc. In essence the document is dynamically created based upon the menu choices and pauses for input.

 

Thanks

Link to comment
Share on other sites

Hi,

Not quite what you wanted yet, as each subsequent menu is fixed; an extra column to say what the next %N1% value is for next menu level would fix it....; some more thought?....

Here's an example which relies on

1. Answers in a tab-delimited text file (can be made from excel, for instance, ) with the first column the description and promps for choices, the second column the text to be inserted. [put in macro express install directory]

2. It calls itself, so call it "MultiChoice" or change the name of the called macro near the end.

3. At present, it starts at line 10 for first description line, line 11 for prompt 1, line 12 for prompt2 etc;

4. Then 2nd menu line 20 for first description line, line 21 for prompt 1, line 22 for prompt2 etc; change the prompts and text answers in the AnswerText.txt file, or use Excel; what do you think?

<REM2:answers in text file in installationPath "textanswers.txt"><VSETMISC:T4:Installation Path><REM2:set level><IFVAR2:2:01:1:0><TVAR2:03:01:><TMVAR2:17:03:00:000:000:%T4%\DocumentAnswers.txtT><NMVAR:08:01:0:0000001:0:0000000><ENDIF><REM2:text file process for this eval level><NMVAR:03:02:1:0000001:2:0000010><IVAR2:04:01:0><ADFBEG:F11:010:N00002:000010:%T4%\textanswers.txt><TMVAR2:19:10:00:000:000:Prompt%N4%><NMVAR:08:04:0:0000001:0:0000000><ADFEND><REM2:choice><MENU2:2:T:02:CenterCenter:Next text, line %N1%%Prompt0%%Prompt1%

%Prompt2%

%Prompt3%

%Prompt4%

%Prompt5%

%Prompt6%

%Prompt7%

%Prompt8%

%Prompt9%

Go BackT><ASCIIV:3:0:2><NMVAR:02:03:1:0000003:2:0000064><IFVAR2:1:02:2:CANCEL><IFVAR2:2:03:3:10><NMVAR:01:03:1:0000002:1:0000003><REM2:add choice to document><ADFBEG:F11:010:N00003:000001:%T4%\textanswers.txt><ADFEND><TMVAR2:20:11:00:000:000:%T4%\DocumentAnswers.txtT><REM2:at end of this level><NMVAR:08:01:0:0000001:0:0000000><REM2:run macro again if more choices, else end><ELSE><NMVAR:09:01:0:0000001:0:0000000><ENDIF><MACRUN2:MultiChoice><ELSE><LAUNCHDEL2:0:01%T4%\DocumentAnswers.txt><MSTOP><ENDIF>

// answers in text file in installationPath "textanswers.txt"

Set Variable %T4% to "Installation Path"

// set level

If Variable %N1% = 0

  Variable Set String %T3% ""

  Variable Modify String: Save %T3% to Text File

  Variable Modify Integer: Inc (%N1%)

End If

// text file process for this eval level

Variable Modify Integer: %N2% = %N1% * 10

Variable Set Integer %N4% to 0

ASCII File Begin Process: "textanswers.txt" (Tab Delimited Text )

  Variable Modify String: Save %T10% to Environment Variable

  Variable Modify Integer: Inc (%N4%)

ASCII File End Process

// choice

Multiple Choice Menu: Next text, line %N1%

Variable Set %N3% to ASCII Value of %T2%

Variable Modify Integer: %N3% = %N3% - 64

If Variable %T2% <> "CANCEL"

  If Variable %N3% < 10

    Variable Modify Integer: %N3% = %N2% + %N3%

    // add choice to document

    ASCII File Begin Process: "textanswers.txt" (Tab Delimited Text )

    ASCII File End Process

    Variable Modify String: Append %T11% to Text File

    // at end of this level

    Variable Modify Integer: Inc (%N1%)

    // run macro again if more choices, else end

  Else

    Variable Modify Integer: Dec (%N1%)

  End If

  Macro Run: MultiChoice

Else

  Program Launch: "DocumentAnswers.txt"

  Macro Stop

End If

Best, Randall.

textanswers.txt

Link to comment
Share on other sites

Hi again,

Here it is with extra column for menu number (%N1%).

Best, Randall

textanswers.txt

EDIT -PS Extra refinements could include?...

1. Use the 2nd column, row 10,20,30, "0th" row of each menu, to say how many items there will be on the list for that menu; then each menu can be derived cleaner.[EDIT; Try MultiChoice3.mxe]

2. Use the text column for a filename instead if the text is large, and set variable from name of text file ["if T12 contains ".txt", Set variable T12 from T4/T12" etc]"

MultiChoice2.mxe

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...
×
×
  • Create New...