Jump to content
Macro Express Forums

Recommended Posts

Hi Everyone,

 

Is there any way we can use the Repeat Until command to accept a value from user in a Multiple Choice Menu. Till the time user doesn't select any value( Single Choice or Multiple Choice) the MCM doesn't gets disappear.

 

I tried Equal to / Doesn't Equal > 0 to option but it doesn't works.

 

Thanks in advance !

 

Gagan

Link to comment
Share on other sites

Give us a simple example. What you describe should work so there must be something about the way you're implementing it.

 

In the larger programming world repeat logic is a bit of a brain bender for me. There are "whiles" and "untils" and the evaluation can come at the beginning or end and I can't remember which it was with MEP. But looking at the help file there's a clue. Lots of times I tend to use "while" with things like this. EG while blnError = False. But MEP is an "until" so it needs a change of state. Check out the highlighted note that the repeat will always execute at least once. This might be your problem but I will not be able to tell until you provide a simple sample macro.

Link to comment
Share on other sites

What does your code look like? This sample macro works until the user leaves the choice blank or clicks the Cancel button.

Repeat Until %Choice% Equals ""
  Variable Set String %Choice% to ""
  Multiple Choice Menu: Make Your Choice
  Text Box Display: Choice
  If Variable %Choice% Equals ""
    Continue
  End If
End Repeat
The "On Error" "The dialog was cancelled" setting for the Multiple Choice Menu is at the default value of Halt Macro.
Link to comment
Share on other sites

Thanks for Replying Cory & Samrae.

Repeat Until %Choice% Equals ""
  Multiple Choice Menu: Make Your Choice

End Repeat

@Cory, I'm using the above simple code in for my macro.

 

@ Samrae, I used your code but even after giving the input the macro doesn't stops. Seems like it gets into infinate loop til the user will press escape to get rid of it.

 

The same code i used for the prompt command and it was working perfectly fine. I believe there must be a way by which we can use it for MCM as well.

 

Another question which comes to my mind related to this. Can we execute another setup of code if the user clicks on the cancel button by over coming the default functionality of the button to Halt the macro ?

Link to comment
Share on other sites

That's to command text, can you provide the actual code? I made one like this and it works fine.

 

Are you using the option to save command value or command text? I bet that's it.

Link to comment
Share on other sites

Put Text Box Display commands before and after you Multiple Choice commands to display the value in your Choice variable. Put one outside the repeat loop to see when it gets out. This will help you figure out what is going wrong. If you expect to see "choice 1" and you are seeing "A" then you need to change to the Multiple Choice Menu's "Result Options" from "Save Item Value" to "Save Item Text".

 

To have the macro perform different stuff when the user clicks Cancel, experiment with the options in the "On Error" tab of the Multiple Choice command. In my testing I found the "Variable Set String %Choice% to "" command before the Multiple Choice Menu necessary. YMMV

Link to comment
Share on other sites

  • 4 weeks later...

i solved my problem. Mybe someone who need this code. i have values in text file (like: 15;25;45). and i split text .

my repeat until condition works end of the values. and text box display my values. if someone who need this code, i can help.

 

<VARIABLE SET STRING Option="\x03" Destination="%StringText%" Filename="C:\Kopya.txt" Strip="FALSE"/>
<VARIABLE MODIFY STRING Option="\x03" Destination="%StringText%"/>
<SPLIT STRING Source="%StringText%" SplitChar=";" Dest="%veri%" Index="1"/>
<VARIABLE SET INTEGER Option="\x00" Destination="%sayac%" Value="1"/>
<REPEAT UNTIL Variable="%veri[%sayac%]%" Condition="\x00"/>
<TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1254\\deff0\\deflang1055{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset162 Tahoma;}{\\f2\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 %\\f1 veri\\f2 [\\f1 %sayac%]\\f0 %\r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<VARIABLE MODIFY INTEGER Option="\x07" Destination="%sayac%"/>
<END REPEAT/>
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...