Delay for Press X

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Hardware_Tester
Pro Scripter
Posts: 58
Joined: Mon Jun 27, 2005 7:03 am
Location: Switzerland

Delay for Press X

Post by Hardware_Tester » Wed Nov 09, 2005 3:17 pm

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

User avatar
Monkster
Junior Coder
Posts: 42
Joined: Fri Oct 04, 2002 9:37 pm
Location: On an Island with Wilson

Post by Monkster » Fri Nov 11, 2005 10:28 pm

How about Wait?

Wait>1 'wait a second then press enter
Press Enter

Wait>2 'wait two seconds then press enter
Press Tab

etc.
Best Wishes,
Monkster

Hardware_Tester
Pro Scripter
Posts: 58
Joined: Mon Jun 27, 2005 7:03 am
Location: Switzerland

Post by Hardware_Tester » Sat Nov 12, 2005 4:38 pm

What about 100 Wait's which have to be tuned to the right length, for not slowing down the script?

It would be a much better solution, if there could be a global value. At the moment I'm working with

wait>0.02

and so on.

PS: Sorry for the sarcasm

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Sat Nov 12, 2005 5:15 pm

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
MJT Net Support
[email protected]

bnc1
Pro Scripter
Posts: 127
Joined: Sun Jul 31, 2005 5:10 pm

Post by bnc1 » Sun Nov 13, 2005 2:41 pm

Well that wasnt much help. I find many of my scripts are 30-50% "wait" code. I think the original poster has a point. A global wait value would be a very nice enhancement. Other software packages have it

:P

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Sun Nov 13, 2005 4:30 pm

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]

bnc1
Pro Scripter
Posts: 127
Joined: Sun Jul 31, 2005 5:10 pm

Post by bnc1 » Sun Nov 13, 2005 7:24 pm

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 ?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Sun Nov 13, 2005 7:31 pm

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.
MJT Net Support
[email protected]

bnc1
Pro Scripter
Posts: 127
Joined: Sun Jul 31, 2005 5:10 pm

Post by bnc1 » Sun Nov 13, 2005 7:49 pm

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

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Mon Nov 14, 2005 3:21 am

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
FIREFIGHTER

Hardware_Tester
Pro Scripter
Posts: 58
Joined: Mon Jun 27, 2005 7:03 am
Location: Switzerland

Post by Hardware_Tester » Tue Nov 15, 2005 1:21 pm

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.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Nov 15, 2005 1:25 pm

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
MJT Net Support
[email protected]

Hardware_Tester
Pro Scripter
Posts: 58
Joined: Mon Jun 27, 2005 7:03 am
Location: Switzerland

Post by Hardware_Tester » Tue Nov 15, 2005 1:35 pm

Can there be used also variables for step delay?

Example:
///Header
Let>Menue1delay=50
Let>Menue2delay=200

///code
Let>STEP_DELAY=Menue1delay
Press Tab
Press Enter
Press Tab
Press Down
Press Tab
Press Tab
Let>STEP_DELAY=Menue2delay
Press Tab
Press Down
Press Tab
Press Enter

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Nov 15, 2005 1:37 pm

Yes, of course.
MJT Net Support
[email protected]

User avatar
CyberCitizen
Automation Wizard
Posts: 721
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Tue Nov 15, 2005 10:53 pm

Good Work Support, Way To Make A Great Program, Even Better.

MS Is Still One Of The Best Programs I Have Used By Far & The Support Received Is Top Notch.
FIREFIGHTER

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