Jump to content
Macro Express Forums

Create a button, when I click the button it does something.

Recommended Posts




I want that my macro display several buttons like this :



And if I clic "Action 1", variable %action% = "1". 

And if I clic "Action 2", variable %action% = "2".



But I see nothing in MexPro 4.9 to do this simple thing. 


MULTIPLE CHOICE MENU can do it but it need several clics, that's not simple. 


Thanks for help. 

Link to comment
Share on other sites

1 hour ago, ihuxihy said:

MULTIPLE CHOICE MENU can do it but it need several clics


This worked when I tested it: 

Use the Multiple Choice Menu, and make your selection by clicking with the mouse. 

BEFORE displaying the multiple choice menu, call a macro that waits for you to click the mouse. 

As soon as you click your choice, the second macro will press the ENTER key to close the multiple choice menu. 

So you have to do only one click.   


Macro where choice is made:

Macro Run: wait_for_choice
Multiple Choice Menu: How many?


Macro wait_for_choice:

Wait for Left Mouse Click
Delay: 250 milliseconds // delay so ENTER will not happen until multiple choice selection happens
Text Type (Simulate Keystrokes): <ENTER>
Macro Return


  • Thanks 1
Link to comment
Share on other sites

MEP has no means of designing forms like you're wanting. Floyd long ago wrote this instructional on how to use an HTA to do something similar. HTAs (HTML Application) are essentially active web pages that run scripts. 

I have made small simple programs to be a form for MEP. It takes only a few minutes in .NET. I had an idea once on creating a program that would take input from MEP that would make a custom arrangement of some simply controls like text boxes, buttons, and the like. There was no interest expressed so I never pursued it. 

  • Like 1
Link to comment
Share on other sites

4 hours ago, ihuxihy said:

That's a funny yet sad way, but I guess it will work, thank you.


I think of it as cute, not sad.😋  It is not an ideal solution, and you have to watch the timings, and consider what other applications might be running, and what other mouse clicking might be going on.  But if you have a relatively stand-alone application, and a user who won't get flustered if the "wait" times out, it should work OK.

  • Like 1
Link to comment
Share on other sites

I don't have time to try this but I might have an idea. But it is a kluge. Open a Notepad with a unique window title and have the macro paste whatever options. Macro terminates. Have a second macro that is scoped to that window and takes and activation of left mouse click. When the mouse is clicked, get the mouse position. Then you could evaluate the mouse Y position to see which item they selected. 

Or I could write you a little program 🙂

  • Like 1
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...