Help with Dialog

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Tazzy
Newbie
Posts: 2
Joined: Sat Dec 24, 2005 6:18 am

Help with Dialog

Post by Tazzy » Sat Dec 24, 2005 6:24 am

I wanted to write a program with a dialog that would give the option of running the macro, pausing it and stopping it.
This is what I have but does not seem to work. ANY help would be greatly appreciated !!

Dialog>Dialog1
Caption=Dialog1
Top=64
Width=305
Left=708
Height=250
Button=Start,16,8,75,25,1
Button=Stop,112,8,75,25,2
Button=Paused,208,8,75,25,3
Edit=msLabel1,16,48,185,Stopped
EndDialog>Dialog1

Let>counter=1

Show>Dialog1

label>loop
wait>.1
gda>Dialog1,result
If>result=2,Stopped
If>result=1,Start
If>result=3,Paused
goto>loop

label>Start
add>counter,1
wait>1
/message>%counter%
wait>.1
;ResetDialogAction>Dialog1
let>Dialog1.msLabel1=Running
Let>Dialog1.msbutton0=Running
ResetDialogAction>Dialog1

gda>Dialog1,result
If>result=2,Stopped
If>result=1,Start
If>result=3,Paused
goto>Start

label>Paused
ResetDialogAction>Dialog1
let>Dialog1.msLabel1=Paused
ResetDialogAction>Dialog1
goto>loop

label>Stopped
ResetDialogAction>Dialog1
let>Dialog1.msLabel1=Stopped
ResetDialogAction>Dialog1
goto>end
goto>loop

Label>end

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Sat Dec 24, 2005 2:18 pm

Tazzy,
Not sure what you're wanting to accomplish. I stuck your "counter" result in the dialog, it could still be in a separate message if you'd prefer. Took the counter loop out of your start label and created a variable called "runnin" to replace its action. If "runnin" is 1 your counter is incremented in the "loop" loop. If pause is selected "runnin" is set to 0 and the counter is bypassed in the "loop" loop.

Try this, let me know how it goes:

Dialog>Dialog1
Caption=Dialog1
Width=305
Height=250
Top=64
Left=708
Button=Start,16,8,75,25,1
Button=Stop,112,8,75,25,2
Button=Paused,208,8,75,25,3
Edit=msLabel1,16,48,185,Stopped
Edit=msEdit1,16,88,185,
EndDialog>Dialog1

Let>counter=0
let>runnin=0

Show>Dialog1

label>loop
gda>Dialog1,result
If>result=2,Stopped
If>result=1,Start
If>result=3,Paused
wait>.1
If>runnin=1
Wait>1
gda>Dialog1,result
add>counter,1
let>Dialog1.msEdit1=%counter%
If>resultDialog1
EndIf
EndIf
goto>loop

Label>Start
Let>runnin=1
let>Dialog1.msLabel1=Running
Let>Dialog1.msbutton0=Running
ResetDialogAction>Dialog1
goto>loop

label>Paused
Let>runnin=0
let>Dialog1.msLabel1=Paused
ResetDialogAction>Dialog1
goto>loop

label>Stopped
let>Dialog1.msLabel1=Stopped and closing dialog
ResetDialogAction>Dialog1
wait>2
CloseDialog>Dialog1
goto>end

Label>end


Hope this helps,
Dick

Tazzy
Newbie
Posts: 2
Joined: Sat Dec 24, 2005 6:18 am

Post by Tazzy » Mon Dec 26, 2005 11:23 am

Thanks JRL got me pointed in right direction.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts