AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Optimize my script (sleep function)

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
djodjolyon



Joined: 12 May 2008
Posts: 21

PostPosted: Wed May 28, 2008 12:16 pm    Post subject: Optimize my script (sleep function) Reply with quote

Hello,
I want to improve my script.
The one I made just open tabs in a new window. But I hd to put many times the entry "sleep" with a long time because it's not working If I put only 50 for exemple.

So, is there an other way without putting a time after sleep just wait that the action before is done?

Here is the script I made.


Code:
Run, D:\
Sleep, 200

; ______________ PHOTO TAB ___________________

; open a new window -------------------
MouseMove, 606, 102
MouseClick, left
Sleep, 500

; select adress bar ---------------
MouseMove, 350, 70
MouseClick, left
Sleep, 50

; rename tab ------------------------------
Send, D:\Photos
Sleep, 200
Send,{Enter}
Sleep, 200

; ______________ PHOTOSHOP TAB _______________


; copy tab -------------------------------
Send,^n
Sleep, 200

; select adress bar ---------------
MouseMove, 350, 70
MouseClick, left
Sleep, 50

; delete adress in adress bar --------------------------
Send, {Backspace 40}
Sleep, 200

; rename tab ------------------------------
Send, D:\Photos\- Exportation photoshop -
Sleep, 200
Send,{Enter}
Sleep, 200

; ______________ LIGHTROOM TAB _______________

; copy tab -------------------------------
Send,^n
Sleep, 200

; select adress bar ---------------
MouseMove, 350, 70
MouseClick, left
Sleep, 50

; delete adress in adress bar --------------------------
Send, {Backspace 40}
Sleep, 200

; rename tab ------------------------------
Send, D:\Photos\- Exportation lightroom -
Sleep, 200
Send,{Enter}
Sleep, 200

; _______________________________________________


; activate photo tab ------------------------
MouseMove, 37, 131
MouseClick, left

return
Back to top
View user's profile Send private message
Red Hat Boy



Joined: 10 Apr 2008
Posts: 112

PostPosted: Wed May 28, 2008 5:13 pm    Post subject: Reply with quote

Sorry, can't help you there. You pretty much gotta get the timing down for yourself. If it clicks too early...
success := no
Now, if there were a way to read the actions of the program, to see if it's ready to continue, that would be a good way to make your script more efficient. But aside from WinWait (to wait for a window to open) and the like, I know of none.
_________________
I slit the sheet, the sheet I slit,
and on the slitted sheet I sit. ;~}
Back to top
View user's profile Send private message Send e-mail
IsNull



Joined: 10 May 2007
Posts: 112
Location: .switzerland

PostPosted: Wed May 28, 2008 7:16 pm    Post subject: Reply with quote

"WinWaitActive" will help you. Search the Help. Go for it! Smile
_________________
http://securityvision.ch
Back to top
View user's profile Send private message
djodjolyon



Joined: 12 May 2008
Posts: 21

PostPosted: Wed May 28, 2008 9:18 pm    Post subject: Reply with quote

Thanks for trying to help me.

In fact, winwaitactive doesn't work because when I open a new tab, it open the same folder. So, the windows is allready active.

And for the other stuffs like Send..., Mouse click..., etc there is nothing to do?
Back to top
View user's profile Send private message
Thrillski



Joined: 18 Jul 2007
Posts: 65
Location: South Florida

PostPosted: Thu May 29, 2008 12:51 am    Post subject: Timing issues Reply with quote

Good morning!

I've had similar problems as well where winwaitactive won't work. What I have done is figure out what the time is, and then over-compensate. So if your average is about a half-second, make sleep, 999. You'd rather have that extra half-second wait than a crashed script.

It's not elegant, I know. You can try pixel hunting tricks if you want to the hassle but a long delay is better than no script. Remember, these scripts are supposed to work first, and then we work for elegance.

Have a nice day!
Thrillski
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group