AutoHotkey Community

It is currently May 27th, 2012, 1:59 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: September 12th, 2005, 10:50 am 
Offline

Joined: September 12th, 2005, 10:33 am
Posts: 4
Location: Regina, Canada
I have a script activated by a hotkey but only executes on the first hit. If however I put in a dummy assignment statement, it works fine.
Here's the code that executes only once:

!f::
;MsgBox starting
WinWait, Creative MediaSource,
IfWinNotActive, Creative MediaSource, , WinActivate, Creative MediaSource,
WinWaitActive, Creative MediaSource,
MouseClick, left, 331, 96
MouseClick, left, 331, 99
WinWait, EAX Advanced HD,
IfWinNotActive, EAX Advanced HD, , WinActivate, EAX Advanced HD,
MouseClick, left, 477, 52
MouseClick, left, 477, 52
MouseClick, left, 455, 50
MouseClick, left, 257, 181
MouseClick, left, 257, 181
Send, {CTRLDOWN}c{CTRLUP}
; MsgBox %clipboard%
if (clipboard <= 1.90)
clipboard := clipboard + 0.10
; MsgBox %clipboard%
Send, {CTRLDOWN}v{CTRLUP}
MouseClick, left, 480, 20

If I display the first "starting" textbox, the script will work every time the alt-f is hit.

Can someone explain why it works with the display message box but works only on the first invocation if the textbox "starting" is commented out?

Blaine.

Furthernote. I've added a dummy assignment "Var1 := 1", and the script works fine. Then I took the assignment statement out and it still works fine. The script/program appears unstable. Can someone explain why this is happening?

Blaine.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 11:41 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Hi,
does your code have a return at the end?
What AHK version are you using?

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 5:49 pm 
Offline

Joined: September 12th, 2005, 10:33 am
Posts: 4
Location: Regina, Canada
I tried both "return" and "exit." Neither one works.

Blaine.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2005, 8:43 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Try opening the script's main window via its tray icon. It shows you the lines most recently executed, which can help debug a script.

If the problem persists, please post again and more investigation will be done.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 15th, 2005, 6:23 pm 
Offline

Joined: September 12th, 2005, 10:33 am
Posts: 4
Location: Regina, Canada
The "latest lines executed" was helpful -thanks Chris.
After the script clicks on a button, it will often (not always) hang on a statement like:

Code:
WinWait, EAX Advanced HD,


The lines following this above statement are:

Code:
 IfWinNotActive, EAX Advanced HD, , WinActivate, EAX Advanced HD,
 WinWaitActive, EAX Advanced HD,


If I reload the script or manually click the button to activate the window it will continue with the script.
Any suggestions?

Blaine.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 16th, 2005, 1:12 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
blucyk wrote:
it will often (not always) hang on a statement like:
Code:
WinWait, EAX Advanced HD,
Chances are, the window "EAX Advanced HD" doesn't exist, isn't visible, or doesn't exactly match the title according to SetTitleMatchMode. You could try changing the above line to:
Code:
WinWait, EAX Advanced HD, , 2  ; Time out in 2 seconds.
if ErrorLevel  ; It timed out.
     MsgBox The window "EAX Advanced HD" doesn't exist or isn't visible.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 17th, 2005, 3:16 am 
Offline

Joined: September 12th, 2005, 10:33 am
Posts: 4
Location: Regina, Canada
That is a useful piece of code - thanks.
It showed the window wasn't active, so now instead of displaying a message I have it click the button again.

Cheers,
Blaine.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group