Posts: 22
Threads: 9
Joined: Oct 2015
I wanted to share the macro I created with a friend who doesn't have QM so I have to save it as an .exe but apparently when he runs it he cannot get any control or indication of what is really happening. How can I create a pop up window for him to choose how many repeats and which function to include in that particular run?
P.S. I saw the make dialog option. I made a dialog I like but it is created in another file which I can't seem to make the buttons do what I want them to do.
Posts: 12,072
Threads: 140
Joined: Dec 2002
The simplest way to choose how many repeats - inp.
The simplest way to choose which function to call - ListDialog.
The simplest way to show results or other info - mes or OnScreenDisplay.
To combine all into single dialog - create custom dialog.
Macro
Macro2716
;/exe
;How can I create a pop up window for him to choose how many repeats
int nRepeat
if(!inp(nRepeat "n repeat")) ret
rep nRepeat
,out 1
;and which function to include in that particular run
sel ListDialog("Func1[]Func2[]Func3" "which function")
,case 1 sub.Func1
,case 2 sub.Func2
,case 3 sub.Func3
#sub Func1
mes "Func1"
#sub Func2
mes "Func2"
#sub Func3
mes "Func3"
;BEGIN PROJECT
;main_function Macro2716
;exe_file $my qm$\Macro2716.exe
;icon <default>
;manifest $qm$\default.exe.manifest
;flags 4
;guid {CDE00EF3-B8D4-43D1-9736-4383DA19D1AD}
;END PROJECT
Alternatively, create console exe and use ExeConsoleX functions for input and output.
Macro
Macro2757
;/exe
str s
ExeConsoleRedirectQmOutput
;How can I create a pop up window for him to choose how many repeats
out "n repeats (1, 2, etc; then press Enter)"
ExeConsoleRead s
int nRepeat=val(s)
rep nRepeat
,out 1
;and which function to include in that particular run
out "which function (1, 2 or 3; then press Enter)"
ExeConsoleRead s
sel val(s)
,case 1 sub.Func1
,case 2 sub.Func2
,case 3 sub.Func3
out "press Enter to exit"
ExeConsoleRead s
#sub Func1
out "Func1"
#sub Func2
out "Func2"
#sub Func3
out "Func3"
;BEGIN PROJECT
;main_function Macro2757
;exe_file $my qm$\Macro2757.exe
;icon <default>
;manifest $qm$\default.exe.manifest
;flags 68
;guid {C6F2731B-A98A-4D1D-B54A-98AADB60D2BE}
;END PROJECT