Jump to content
Sign in to follow this  
langthang084

Sometime, Script dont run correctly?

Recommended Posts

langthang084

Here's my code:

Opt("WinTitleMatchMode", 2)

For $i = 0 to 100
WinActive("SciTE-Lite")
WinWaitActive("SciTE-Lite")
sleep(150)
if WinActive("AAA.au3") = @error Then
ControlSend("SciTE-Lite", "", "[CLASS:Scintilla; INSTANCE:1]", "^o")
sleep(150)
WinWaitActive("Open File")
ControlSetText("Open File", "","[CLASS:Edit; INSTANCE:1]", "D:\Auto_New\MM\AAA.au3")
ControlSend("Open File", "","[CLASS:Edit; INSTANCE:1]","{enter}")
sleep(150)
endif
WinWaitActive("AAA.au3")
sleep(150)
ControlSend("SciTE-Lite", "", "[CLASS:Scintilla; INSTANCE:1]","^g")
WinWaitActive("Go To")
ControlSend("Go To", "", "[CLASS:Edit; INSTANCE:1]", 22)
sleep(150)
ControlSend("Go To", "", "[CLASS:Edit; INSTANCE:1]","{enter}")
WinWaitActive("SciTE-Lite")
ControlSend("SciTE-Lite", "", "[CLASS:Scintilla; INSTANCE:1]","+{end}")
sleep(150)
ControlSend("SciTE-Lite", "", "[CLASS:Scintilla; INSTANCE:1]","{delete 2}")
sleep(150)
ControlSend("SciTE-Lite", "", "[CLASS:Scintilla; INSTANCE:1]","^s")
sleep(150)
ControlSend("SciTE-Lite", "", "[CLASS:Scintilla; INSTANCE:1]","!{f4}")
sleep(150)
Next
exit
But SOMETIME it dont run correctly. Ex: Dont active SciTE-Lite in the next loop, or with CTRL + O, only O is Pressed; DELETE twice times but its pressed three times. How do I solve it?

Share this post


Link to post
Share on other sites
handofthrawn

This may not help but when I'm having trouble with a script I slow it down and throw in tons of breaks (Msgbox popups).  Try changing the sleeps to 500 or even 5000 and see how many times you can get it to run correctly.  If a certain part breaks no matter the speed, try doing it in another manner (mouseclick + send instead of controlsend?).  Good luck.

Share this post


Link to post
Share on other sites
MikahS

I'm going to agree with @handofthrawn I would increase your sleep commands as 1000ms = 1 sec. So, something like 250 would be good.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
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
Sign in to follow this  

×