dialog timing question

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Jmac2501
Pro Scripter
Posts: 76
Joined: Tue Nov 15, 2005 8:11 pm

dialog timing question

Post by Jmac2501 » Mon Apr 10, 2006 6:29 pm

Hey
I am using a MS to help with my work program and i have it set up where all my work in done in the MS dialog. My work program has a log out timer of 15 mins. There for if i don't do any work in my work program in 15 mins it logs me out. What i am trying to find is a way that i can add a timer to my script that will keep me logged in if i don't use it in 15 mins.
I also need it to stay on the dialog screen so that i can still use all the button and things. this is my dailog script below, each button dose somthing in my work program. I am just looking for a way to put a timer into this so that if i don't use my dialog with in 15 mins it will run a "stay logged script" that also below. I was using both scrips together running at the same time but if there is a way to get them both into one that would be awsome. thanks...

Dialog script:

Dialog>MyDialog
Caption=Pass Or Fail It.
Width=318
Height=280
Top=447
Left=141
Max=1
Min=1
Close=1
Resize=1
Label=Type Failure's Here:,8,40,true
Image=C:\Documents and Settings\jmccoard\My Documents\My Pictures\Snowboard-Sierra1.bmp,0,0,309,252
Label=Enter Notes Here:,8,112,true
Label=COM2,38,168,true
Label=Type Failure's Here:,8,40,true
Label= PASS,112,0,true
Label= FAIL,152,0,true
Label=TOTAL,192,0,true
Button=PASS (NTF),232,8,73,33,1,,This will Pass the unit into W-NTF along with Notes.
Edit=msEdit5,8,56,73,
Edit=msEdit1,88,56,65,
Edit=msEdit2,160,56,73,
Edit=msEdit7,8,88,73,
Button=FAIL,240,48,65,33,3,,This will Fail the unit without notes. Must have failure code listed
Button=Exit Macro,232,160,73,25,2,,This will exit the program.
Button=Resize,80,160,65,25,4,,This will resize your screen.
Button=Fail w/ Notes,152,160,73,25,5,,This will fail the unit with the failure code entered along with what the notes you had enterd.
ComboBox=msComboBox1,8,8,97,COMBO%CRLF%DFL%CRLF%DISPOSITION%CRLF%HYPERCOM%CRLF%IMS%CRLF%LINKPOINT%CRLF%OTV%CRLF%PRINTERS%CRLF%RFB%CRLF%RTO%CRLF%SCRAP
Edit=MyEdit2,8,128,289,None
Edit=msEdit3,112,16,33,%k%
Edit=msEdit4,152,16,33,%x%
Edit=msEdit6,192,16,33,%y%
Button=RO,240,88,65,33,6
CheckBox=msCheckBox1,msCheckBox1,160,88,17,False
Button=18AO,8,192,65,25,7
Button=Test,80,192,65,25,8
Button=Clear,152,192,73,25,10
Button=704p16,232,192,73,25,9
CheckBox=msCheckBox2,msCheckBox2,16,168,17,False
Button=16A6,80,224,65,25,11
Button=50US2,152,224,73,25,12
Button=3200 Test,232,224,73,25,13
CheckBox=msCheckBox3,,160,112,17,False
Button=VMAC,8,224,65,25,14
Edit=msEdit8,89,88,64,
Label=Rework,184,88,true
Label=OTV RTN,182,112,true
EndDialog>MyDialog

Label>MainLoop
Show>MyDialog,result
Let>x=%MyDialog.msEdit4%
Let>k=%MyDialog.msEdit3%
let>y=%MyDialog.msEdit6%
if>result=1,NTF
If>result=2,end1
If>result=3,SayHello
if>result=4,resize
if>result=5,failnote
if>result=6,RO
if>result=7,18AO
if>result=8,Test
if>result=9,704p16
if>result=10,Clear
if>result=11,16A6
if>result=12,50US2
if>result=13,3200
if>result=14,VMAC
goto>MainLoop

stay loged script:

Label>1
Wait>900
gpc>735,507,pc
if>%pc%9408370
goto>1
else
gcp>x,y
mou>696,477
lcl
wait>1
lcl
mou>%x%,%y%
goto>1

ANY help would be great thanks...

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Apr 11, 2006 8:51 am

You will not be able to do it with a modal dialog. You need a non-modal dialog with an action loop. Inside the action loop you can measure elapsed time and exit the loop when the timeout period is reached. Use the VBScript Timer function to get elapsed time.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Jmac2501
Pro Scripter
Posts: 76
Joined: Tue Nov 15, 2005 8:11 pm

Post by Jmac2501 » Wed Apr 19, 2006 4:03 pm

is there an example that i can see?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Apr 19, 2006 9:14 pm

This thread has a dialog with a simple timer http://www.mjtnet.com/usergroup/viewtopic.php?t=2593

Jmac2501
Pro Scripter
Posts: 76
Joined: Tue Nov 15, 2005 8:11 pm

Post by Jmac2501 » Tue Apr 25, 2006 6:01 pm

OK i tryed that but it still won't work. Did i do somthing wrong? It just sits there and non of the buttons work.

Let>k=0
let>x=0
let>y=0
Dialog>MyDialog
Caption=Pass Or Fail It.
Width=301
Height=260
Top=473
Left=142
Max=1
Min=1
Close=1
Resize=1
Label=Type Failure's Here:,8,40,true
Image=C:\Documents and Settings\jmccoard\My Documents\My Pictures\Snowboard-Sierra1.bmp,0,0,292,232
Label=Enter Notes Here:,8,80,true
Label=COM2,32,200,true
Label=Type Failure's Here:,8,40,true
Label= PASS,96,0,true
Label= FAIL,136,0,true
Label=TOTAL,176,0,true
Button=PASS (NTF),216,8,73,33,1,,This will Pass the unit into W-NTF along with Notes.
Edit=msEdit5,8,56,60,
Edit=msEdit1,80,56,60,
Edit=msEdit2,152,56,60,
Button=Fail It,216,48,74,33,3,,This will Fail the unit without notes. Must have failure code listed
Button=Exit Macro,197,128,92,25,2,,This will exit the program.
Button=Resize,8,128,73,25,4,,This will resize your screen.
Button=Fail it w/ Notes,96,128,89,25,5,,This will fail the unit with the failure code entered along with what the notes you had enterd.
ComboBox=msComboBox1,0,8,92,COMBO%CRLF%DFL%CRLF%DISPOSITION%CRLF%HYPERCOM%CRLF%IMS%CRLF%LINKPOINT%CRLF%OTV%CRLF%PRINTERS%CRLF%RFB%CRLF%RTO%CRLF%SCRAP
Edit=MyEdit2,8,96,273,None
Edit=msEdit3,96,16,33,%k%
Edit=msEdit4,136,16,33,%x%
Edit=msEdit6,176,16,33,%y%
Button=RO,168,80,41,17,6
CheckBox=msCheckBox1,msCheckBox1,104,80,17,False
Button=18AO,8,160,65,25,7
Button=Test,80,160,65,25,8
Button=Clear,152,160,65,25,10
Button=704p16,224,160,65,25,9
CheckBox=msCheckBox2,msCheckBox2,16,200,17,False
Button=16A6,80,192,65,25,11
Button=50US2,152,192,65,25,12
Button=3200 Test,224,192,65,25,13
Label=Rework,120,80,true
EndDialog>MyDialog

show>MyDialog

let>n=0
Label>ActionLoop
getdialogaction>MyDialog,result
Let>x=%MyDialog.msEdit4%
Let>k=%MyDialog.msEdit3%
let>y=%MyDialog.msEdit6%
if>result=1,NTF
If>result=2,end1
If>result=3,SayHello
if>result=4,resize
if>result=5,failnote
if>result=6,RO
if>result=7,18AO
if>result=8,Test
if>result=9,704p16
if>result=10,Clear
if>result=11,16A6
if>result=12,50US2
if>result=13,3200
wait>0.1
add>n,1
if>n=15,staylog,ActionLoop

//OTHER SCRIP STUFF HERE

Label>staylog
Wait>900
gpc>735,507,pc
if>%pc%9408370
goto>1
else
gcp>x,y
mou>696,477
lcl
wait>1
lcl
mou>%x%,%y%
goto>ActionLoop

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Apr 25, 2006 6:29 pm

I'm not sure what all you are trying to do but I see that this:

wait>0.1
add>n,1
if>n=15,staylog,ActionLoop

loops through the dialog for only 1.5 seconds (15*0.1), which isn't very long for anyone to enter anything, and then the program will go to staylog, then it will wait 900 = 15 minutes before doing the pixel color check - but since you didn't close the dialog it's still there on the screen although nothing can be entered.

I think what you probably mean to do is loop through the dialog for a longer period, and then you need to close the dialog as the first step when the program drops to "staylog".

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

Post by JRL » Tue Apr 25, 2006 6:38 pm

I ran your script and it works, but I don't know for sure what you expect it to do. You say none of the buttons work, but they are working. The way you have the script written, the dialog opens then times for 1.5 seconds then jumps to the "staylog" lable and waits 15 minutes. In other words, if you wait more than 1.5 seconds to pick a button you won't see the result of that selection for 15 minutes.

All of your if>result= lines are jumping to labels that you are not showing in the posted script. I assume they exist somewhere in the script or you would be getting error messages.

You also have a line goto>1 and you don't show the lable "1".

Hope this is helpful,
Dick

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