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 

Send work only if a msgbox is before

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



Joined: 16 Jun 2007
Posts: 245

PostPosted: Wed Feb 27, 2008 4:14 pm    Post subject: Send work only if a msgbox is before Reply with quote

I have a script that work well for months. Totay it stop. It is simple but it dose not want to send the content of the variable pv to the screen.
so I place a msgbox, just before the send command, then it start to send it. Seem the msgbox make some sort of a pause, I don't know.

Code:

a:=1
pv:= a*1.2 
MouseClick, Left,  860,-650,2 ; PRIX
Send {CTRLDOWN}a{CTRLUP}
Sleep, 500
msgbox, pv=%pv%
Send, %pv%
Back to top
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 906

PostPosted: Wed Feb 27, 2008 8:25 pm    Post subject: Reply with quote

Try putting a slight delay there instead Like this:
Code:
Sleep 100
Back to top
View user's profile Send private message
feejo



Joined: 16 Jun 2007
Posts: 245

PostPosted: Wed Feb 27, 2008 8:28 pm    Post subject: Reply with quote

I try sleep 500 and it react the same way.
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1494

PostPosted: Wed Feb 27, 2008 9:05 pm    Post subject: Reply with quote

Most likely, when the msgbox closes, it restores focus to the top-most window (I think your trouble has been losing focus.
Code:

Myhwnd := WinExist("a")
a:=1
pv:= a*1.2 
MouseClick, Left,  860,-650,2 ; PRIX
Send {CTRLDOWN}a{CTRLUP}
;;Sleep, 500
;;msgbox, pv=%pv%
WinActivate, ahk_id %Myhwnd%
WinWaitActive, ahk_id %Myhwnd%
sleep, 25
Send, %pv%

see if that works.
_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
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