Jump to content

Timing problems Reloaded


normeus
 Share

Recommended Posts

:ph34r:

Well I tried

Opt("WinWaitDelay", 250)

and it helped a bit but I am wondering if there is a certain type of computer where autoit 3 will not work?

I am running a P3 866 (compaq ) 512 meg of ram and 80 gig hd

this is the code that some times works and others does not.

;==========

$input="c:\readdata.txt"

$input="c:\options.txt"

WinWaitActive("SELECT AND PRINT LABELS")

Sleep(1000)

WinWaitActive("SELECT AND PRINT LABELS")

Opt("WinWaitDelay", 250)

; Now that prog window is active do your stuff

; check progs to be run

ControlFocus("SELECT AND PRINT LABELS", "", "Button5")

Send(" ")

ControlFocus("SELECT AND PRINT LABELS", "", "Button6")

Send(" ")

ControlFocus("SELECT AND PRINT LABELS", "", "Button7")

Send(" ")

;so far so good but then we hit this statement

ControlFocus("SELECT AND PRINT LABELS", "", "Edit1")

Send($input)

send("{TAB}") ; this tab will either work or else

Send($weeknum) ; tab to next window and click etc...

ControlClick("SELECT AND PRINT LABELS", "", "Button1")

Sleep(500)

my concern is that this is just a small script and it is heck when it works like a

charm for 5 6 times then it just will not.

1) it helps to have some programs running in the background (some times)

2) the position of the background windows matters ( but I am not using them)

3) the amount of time the system matters (some times)

I've spent a few hours changing timing this is personal now so I will find out

what the deal is.

is anybody else having this issues ?

Link to comment
Share on other sites

My initial reaction to this as a programmer would be that you have 1 variable assigned to 2 different .txt file names. Do you want both of those to be in the variable or should you have 2 variables?

Let me know and I may be able to do something for you, and also do you have the window minimized when you are trying to do any of this?

Thanks,

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

My initial reaction to this as a programmer would be that you have 1 variable assigned to 2 different .txt file names. Do you want both of those to be in the variable or should you have 2 variables?

Let me know and I may be able to do something for you, and also do you have the window minimized when you are trying to do any of this?

Thanks,

JS

<{POST_SNAPBACK}>

Link to comment
Share on other sites

I also had some problems with sending TAB keys at times and I was able to resolve them by adding a very short time out between the SEND("string") and the SEND("{TAB"})

;so far so good but then we hit this statement
ControlFocus("SELECT AND PRINT LABELS", "", "Edit1")
Send($input)

Sleep(100)

send("{TAB}"); this tab will either work or else
Send($weeknum); tab to next window and click etc...
ControlClick("SELECT AND PRINT LABELS", "", "Button1")
Sleep(500)

CheersNobby

Link to comment
Share on other sites

should've been:

$input="c:\readdata.txt"

$weeknum="c:\options.txt"

sorry the first 2 lines I typed in after I copied the text ( leave typing to the experts!)

the script works then.... it does not.

it is pretty simple

select a window called "SELECT AND PRINT LABELS"

send spaces to my 3 checkboxes to check them

send $input to and edit1 field

tab to the next field

send $weeknum to this field

send a click to button1

move to edit8 field

============= this part works fine BUT... then sometimes for next step

send "MASTSEL{TAB}" ; it will send mastsel but the tab will be sent

; somewhere else

; only sometime!!!

; so the tab tabs to next window or next whatever

; and the script continues to send keystrokes to

; whatever was selected

Link to comment
Share on other sites

Try

send ("MASTSEL")
sleep(100)
send("{TAB}")

<{POST_SNAPBACK}>

it is working fine (that section anyway) with sleep before tab I guess it is all about SLEEP

I started working on this program yesterday and being new to the language it took me

a couple of hours to figure out what to do. What really gets me is the fact that once I was done with the program and it was running fine :( and made me realize I

could shave 2 hours of work each friday, it just would not work :ph34r:

thanks for your help I will add sleep left and right until I get it right.

Norm

Link to comment
Share on other sites

EUREKA!!!

1 restart system

2 run FIREBIRD then minimize it ; (my internet browser)

3 run NPOP then minimize it ; (my email pop3 program )

3 run my script

4 good vibes!!!

I figured firebird & npop slow down the system enough to make my script work!!!!

I dont care how you do it as long as it gets done!!!

-norm-

if ifs and buts were candy and nuts everybody would have a merry xmas

-steck- a.k.a. complete stud

Link to comment
Share on other sites

OK so I got 1 hour free on friday thanks people for all your help

when in doubt:

add pause(1000) every where!!! it will help you see what is going on

some programs are picky about tabs so send(text) then pause(100) then send("{tab}") same thing if you are sending an enter.

some programs take a while to load so you might need Opt("WinWaitDelay", 500)

before you send keystrokes (actually at the top of your scripts unless you are modifying the delay as you go 500,600,700,etc...)

WinWaitActive("notepad") might comeback and tell you the window is ready a few milliseconds before the window is ready to receive keystrokes so put another pause(200) there.

ASK QUESTIONS AFTER YOU READ THE HELP FILE :ph34r:

P.S. I WAS READY TO MOVE TO REBOL FOR MY PROGRAMMING BUT NOW AUTOIT3 has given new life to my COBOL dbms ; thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...