Delay for Press X
Moderators: Dorian (MJT support), JRL
-
- Pro Scripter
- Posts: 58
- Joined: Mon Jun 27, 2005 7:03 am
- Location: Switzerland
Delay for Press X
Is there a way to set a delay for the press command?
It would be very nice for the ESC, ENTER and TAB because this opens in a dialog often a new Window, so always a wait is necessary after. This isn't a proper solution for me, and blows up the code.
*edit* and I forgot CTRL
It would be very nice for the ESC, ENTER and TAB because this opens in a dialog often a new Window, so always a wait is necessary after. This isn't a proper solution for me, and blows up the code.
*edit* and I forgot CTRL
-
- Pro Scripter
- Posts: 58
- Joined: Mon Jun 27, 2005 7:03 am
- Location: Switzerland
You want a global wait value? What about this:
Let>Wait_Value=0.02
Press Enter
Wait>Wait_Value
Press Tab
Wait>Wait_Value
Press Enter
Wait>Wait_Value
Etc
Etc
Etc
Let>Wait_Value=0.02
Press Enter
Wait>Wait_Value
Press Tab
Wait>Wait_Value
Press Enter
Wait>Wait_Value
Etc
Etc
Etc
MJT Net Support
[email protected]
[email protected]
Maybe there is some misunderstanding over what is required. How about a system variable called something like STEP_DELAY which will cause a delay (milliseconds) between each line of code (until it is changed or set back to 0)? It can be set once at the start of the script, or where the delay is required, and then reset if needed. So no need for any wait commands anywhere.
MJT Net Support
[email protected]
[email protected]
Yes I would love to have that option. It would make my MJT world much easier to maintain becuase I have to adjust the wait values continuously for different machines. I am going to start testing beta version 8 , the new OnEvent function looks promising .. is it too late for a global type wait function ?
No, we should be able to get STEP_DELAY into the next beta release. Final release is not until early Jan anyway.
Ideally you shouldn't really be relying on Wait commands anyway. Granted, in some cases they are unavoidable, but you can usually avoid static waits and instead use dynamic waits so that the script is more generic and sensitive to timing differences and will work on multiple target platforms. E.g. with WaitWindowOpen/Closed, WaitReady, WaitWindowChanged, WaitCursorChanged, WaitPixelColor, WaitRectChanged and custom loops in which you check for other eventualities such as files existing, status bars changing etc.
Ideally you shouldn't really be relying on Wait commands anyway. Granted, in some cases they are unavoidable, but you can usually avoid static waits and instead use dynamic waits so that the script is more generic and sensitive to timing differences and will work on multiple target platforms. E.g. with WaitWindowOpen/Closed, WaitReady, WaitWindowChanged, WaitCursorChanged, WaitPixelColor, WaitRectChanged and custom loops in which you check for other eventualities such as files existing, status bars changing etc.
MJT Net Support
[email protected]
[email protected]
I understand completely and I make frequent use of the other wait functions when I can. But I still need hard coded waits on a frequent basis.
For example , in one script
Waitwindowopen>
waitready>
mouseover>
did not work properly for my application until I added a hard coded wait>1 after the waitready. Otherwise the mouseover command executed too "fast" for the application. Just one example
For example , in one script
Waitwindowopen>
waitready>
mouseover>
did not work properly for my application until I added a hard coded wait>1 after the waitready. Otherwise the mouseover command executed too "fast" for the application. Just one example
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Hello bnc1,
Yes I Also Have To Use Wait Commands In Alot Of My Scripts Still.
If I Dont Have The Wait Command It Tries To Enter The Information To Quickly & Even Though i Have It Set To Wait For The Window Open & Also Set Focus To The Window Is Still Does It 2 Quickly.
Note This Is For A Google Search & Entering The Username & Password For Internet Access (Lan Enviroment).
Example
Dialog>SearchGoogle
Caption=Search Google
Width=218
Height=110
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label=Search Google,8,8,true
Edit=SearchGoogle,8,24,193,
Button=Search,71,48,75,25,1
Default=Search
EndDialog>SearchGoogle
Label>Start
Show>SearchGoogle,r
If>r=2,Exit
If>%SearchGoogle.SearchGoogle%=
MessageModal>No Search Term Entered%CRLF%%CRLF%Try Again!
ResetDialogAction>SearchGoogle
CloseDialog>SearchGoogle
Goto>Start
Else
Endif
If>r=1,Search
Label>Search
Let>RP_WINDOWMODE=3
Run Program>C:\Program Files\Internet Explorer\iexplore.exe http://www.google.com.au/search?hl=en&q ... archGoogle%
Let>RP_WINDOWMODE=1
WaitWindowOpen>Connect to*
SetFocus>Connect to*
Wait>0.5
SetControlText>Connect to*,Edit,2,USERNAME
SetControlText>Connect to*,Edit,3,PASSWORD
Wait>0.5
Press Enter
Goto>Exit
Label>Exit
Yes I Also Have To Use Wait Commands In Alot Of My Scripts Still.
If I Dont Have The Wait Command It Tries To Enter The Information To Quickly & Even Though i Have It Set To Wait For The Window Open & Also Set Focus To The Window Is Still Does It 2 Quickly.
Note This Is For A Google Search & Entering The Username & Password For Internet Access (Lan Enviroment).
Example
Dialog>SearchGoogle
Caption=Search Google
Width=218
Height=110
Top=CENTER
Left=CENTER
Max=0
Min=0
Close=1
Resize=0
Label=Search Google,8,8,true
Edit=SearchGoogle,8,24,193,
Button=Search,71,48,75,25,1
Default=Search
EndDialog>SearchGoogle
Label>Start
Show>SearchGoogle,r
If>r=2,Exit
If>%SearchGoogle.SearchGoogle%=
MessageModal>No Search Term Entered%CRLF%%CRLF%Try Again!
ResetDialogAction>SearchGoogle
CloseDialog>SearchGoogle
Goto>Start
Else
Endif
If>r=1,Search
Label>Search
Let>RP_WINDOWMODE=3
Run Program>C:\Program Files\Internet Explorer\iexplore.exe http://www.google.com.au/search?hl=en&q ... archGoogle%
Let>RP_WINDOWMODE=1
WaitWindowOpen>Connect to*
SetFocus>Connect to*
Wait>0.5
SetControlText>Connect to*,Edit,2,USERNAME
SetControlText>Connect to*,Edit,3,PASSWORD
Wait>0.5
Press Enter
Goto>Exit
Label>Exit
FIREFIGHTER
-
- Pro Scripter
- Posts: 58
- Joined: Mon Jun 27, 2005 7:03 am
- Location: Switzerland
I can give simple examples, where a hardcoded wait is necessary:
- The Waitwindowsopen is too fast, the window is open but not ready
- Waiting for a connected hardware to perform some actions
- Waiting for a value to be changed, our dialogs have many routines in the background to disable illegal states.
- The Waitwindowsopen is too fast, the window is open but not ready
- Waiting for a connected hardware to perform some actions
- Waiting for a value to be changed, our dialogs have many routines in the background to disable illegal states.
Yes, there are occasions where a wait is necessary and cannot be avoided. We have added STEP_DELAY to the next beta. So you can do:
//set delay between script lines to half a second
Let>STEP_DELAY=500
Press Tab
Send>Hello World
Press Enter
etc
etc
//set delay between script lines to half a second
Let>STEP_DELAY=500
Press Tab
Send>Hello World
Press Enter
etc
etc
MJT Net Support
[email protected]
[email protected]
-
- Pro Scripter
- Posts: 58
- Joined: Mon Jun 27, 2005 7:03 am
- Location: Switzerland
- CyberCitizen
- Automation Wizard
- Posts: 721
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia