Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog Variables
#1
I'm having a problem with this dialog cuz the value for the z variable isn't being carried over when the 'stop' button is being pushed. Can anyone tell me why?

thanks.

Function Quick_Timer
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
double- x y z
str a
VARIANT v
if(!ShowDialog("Quick_Timer" &Quick_Timer 0 0 64 0 0 0 -127 241)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 57 61 "Timer"
;3 Static 0x54000000 0x0 0 0 56 10 "Start Time"
;5 Static 0x54000000 0x0 0 12 56 10 "Total Time"
;6 Button 0x54032000 0x0 4 26 48 14 "Start"
;7 Button 0x5C032000 0x0 4 44 48 14 "Stop"
;END DIALOG
;DIALOG EDITOR: "" 0x2030002 "" "" ""

ret
;messages
sel message
,case WM_ACTIVATE
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 6;;Start time
,,_s.time("%X")
,,_s.setwintext(id(3 win("Timer")))
,,a.setwintext(id(5 win("Timer")))
,,z=GetTickCount
,,EnableWindow(id(6 win("Timer"))0)
,,EnableWindow(id(7 win("Timer"))1)
,case 7;;Stop time
,,EnableWindow(id(6 win("Timer"))1)
,,EnableWindow(id(7 win("Timer"))0)
,,y=GetTickCount
,,x=y-z
,,x=(((x/1000)/60)/60)
,,;out x
,,v.round(x 2)
,,x=v
,,_s=x
,,_s.setwintext(id(5 win("Timer")))
,,_s.setclip
,case IDOK

,case IDCANCEL
ret 1
An old blog on QM coding and automation.

The Macro Hook
#2
The function is called many times. The variable is local and therefore is destroyed every time. Use thread variable.
#3
I figured it out by looking at the response to my other question. When I put the "-" after the variable declaration it passed the value through to the 'stop' button.
An old blog on QM coding and automation.

The Macro Hook
#4
I have one other question ( :lol: )
Is there a way to have the 'Start' button pushed when it starts up without creating another macro that will do it?

thanks.
An old blog on QM coding and automation.

The Macro Hook
#5
but 6 hDlg
or goto
#6
I put "but 6 hDlg" in the "WM_INITDIALOG" section but it happens before the dialog appears. Should I put it into a different section?
An old blog on QM coding and automation.

The Macro Hook
#7
Push with delay? Use SetTimer.
#8
Yeah, a delay (to wait for the window to open) and then push the button would work just great.
I searched through the dialogs for the use of the SetTimer and the only thing I figured out was that it kept performing the action like a rep command the other doesn't work at all. I just need it to push that button.

heres the two ways i've tried it.
Function Quick_Timer
Trigger N3 //FF_Keyboard2     Help - how to add the trigger to the macro
Code:
Copy      Help
,case WM_INITDIALOG
,,SetTimer hDlg 1 450 6
,,but 6 hDlg


and this.

Function Quick_Timer
Trigger N3 //FF_Keyboard2     Help - how to add the trigger to the macro
Code:
Copy      Help
,case WM_INITDIALOG
,,SetTimer hDlg 6 50 0
,case WM_TIMER
,,but 6 hDlg
An old blog on QM coding and automation.

The Macro Hook
#9
KillTimer under WM_TIMER.
#10
DANG!!!
that's it thanks!!!

now i know how to do all kinds of fun things when a dialog opens!!!!
:mrgreen:
An old blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 3 Guest(s)