Posts: 576
Threads: 97
Joined: Aug 2007
hello, i need help with a dialog...
i cannot understand how the check pushlike button starts a macro, then wen it is pressed again, it comes up and stops the macro...i know its possible cannot get it to work tho
plz help
thnxx
Posts: 473
Threads: 33
Joined: Aug 2007
If you supply your Dialog then I can show you more easily.
Taking on Quick Macros one day at a time
Posts: 473
Threads: 33
Joined: Aug 2007
Something like this?
Attached Files
QM Expert.qml (Size: 1.03 KB / Downloads: 676)
Taking on Quick Macros one day at a time
Posts: 12,097
Threads: 142
Joined: Dec 2002
Example
Function dialog_check_start_stop_macro
\Dialog_Editor
function # hDlg message wParam lParam
if (hDlg) goto messages
str controls = "3"
str c3Sta
if (!ShowDialog ("dialog_check_start_stop_macro" &dialog_check_start_stop_macro &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80AC4 0x108 0 0 59 24 "Dialog"
;3 Button 0x54013003 0x0 6 6 48 14 "Start"
;END DIALOG
;DIALOG EDITOR: "" 0x2020100 "" ""
ret
;messages
sel message
, case WM_INITDIALOG
, case WM_DESTROY
, case WM_COMMAND goto messages2
ret
;messages2
sel wParam
, case 3
, if (but (lParam)) ;;checked
,, mac "Macro508"
,, _s="Stop"
, else ;;unchecked
,, shutdown -6 0 "Macro508"
,, _s="Start"
, _s.setwintext(lParam)
, case IDOK
, case IDCANCEL
ret 1
Posts: 576
Threads: 97
Joined: Aug 2007
thanks gint that was perfect
Posts: 129
Threads: 38
Joined: May 2006
I've tried the code above and the macro only ran once. I tried a function and did the same thing. There is no ret or end code in either of them.
Isn't pushing the button stops and/or start running macro or function?
I have tried radio boxes and check boxes and the same result.
Any ideas why?
Posts: 12,097
Threads: 142
Joined: Dec 2002
This code can be used only to start/stop single macro or function. For multiple functions, you need two simple buttons - Start and Stop.
Posts: 129
Threads: 38
Joined: May 2006
Hi Gintaras:
I tried with:
1. example above
2. checkbox and Cancel button
3. 2 push buttons with Start and Stop
4. radiobox and Cancel button
They all ran the function once. The dialog box remained open, which is what I need. I just can't get the function to run more than once.
Thanks
Posts: 576
Threads: 97
Joined: Aug 2007
What do you mean by run more then once?
Posts: 129
Threads: 38
Joined: May 2006
The file you provided didn't even do what you said it would.
And the one Gintaras showed only ran the function once.
I need the function to continue running until the STOP button is clicked and leave the dialog box open so that the user can click on START button again.
Is this not possible?
Posts: 12,097
Threads: 142
Joined: Dec 2002
this is with 2 simple buttons
Function
dialog_start_stop_macro
\Dialog_Editor
function # hDlg message wParam lParam
if ( hDlg) goto messages
if ( ! ShowDialog ( "dialog_start_stop_macro" & dialog_start_stop_macro 0 )) ret
;BEGIN DIALOG
;0 "" 0x90C80AC4 0x108 0 0 111 24 "Dialog"
;3 Button 0x54032000 0x0 6 6 48 14 "Start"
;4 Button 0x54032000 0x0 58 6 48 14 "Stop"
;END DIALOG
;DIALOG EDITOR: "" 0x2030006 "" "" ""
ret
;messages
sel message
, case WM_INITDIALOG
, case WM_DESTROY
, case WM_COMMAND goto messages2
ret
;messages2
sel wParam
, case 3
, mac "Function75"
,
, case 4
, shutdown - 6 0 "Function75"
,
, case IDOK
, case IDCANCEL
ret 1
Posts: 576
Threads: 97
Joined: Aug 2007
Press Start, it will start a macro, press stop it will stop it.
you can do it as many times as you want.
Function
Function7
\Dialog_Editor
function # hDlg message wParam lParam
if ( hDlg) goto messages
str controls = "3"
str c3Sta
if ( ! ShowDialog ( "Function7" & Function7 & controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80AC4 0x108 0 0 59 24 "Dialog"
;3 Button 0x54013003 0x0 6 6 48 14 "Start"
;END DIALOG
;DIALOG EDITOR: "" 0x2020100 "" ""
ret
;messages
sel message
, case WM_INITDIALOG
, case WM_DESTROY
, case WM_COMMAND goto messages2
ret
;messages2
sel wParam
, case 3
, if ( but ( lParam)) ;;checked
,, mac "Function57"
,, _s= "Stop"
, else ;;unchecked
,, shutdown - 6 0 "Function57"
,, _s= "Start"
, _s.setwintext( lParam)
, case IDOK
, case IDCANCEL
ret 1
Posts: 28
Threads: 12
Joined: Apr 2008
Denise, all the post was about was check pushlike, in order to make a function or macro repeat, you can use a few diffrent methods, click on the help section of your qm or search the site for rep. hope this helps!