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 

Noob question with hotkey

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






PostPosted: Sat Oct 31, 2009 9:38 pm    Post subject: Noob question with hotkey Reply with quote

~F1::
sleep 100
run, my_program
sleep 5000
winclose, my_program
return

OK, that's pretty basic and works. Now I need this:

~F1::
sleep 100
run, my_program
sleep 5000
F1 here = winclose, my_program (not running my_program again)

F1 now is restored and should run again my_program when pressed
return
Back to top
jethrow



Joined: 24 May 2009
Posts: 722
Location: Iowa, USA

PostPosted: Sat Oct 31, 2009 9:50 pm    Post subject: Reply with quote

Something like this?
Code:
#IfWinExist, my_program
F1:: WinClose, my_program
#IfWinExist

F1::
Sleep, 100
Run, my_program
Return

Is that what you're looking for?
_________________
AHKL, COM_L,Webpage Controls,Donate to AHK
Back to top
View user's profile Send private message
Guest






PostPosted: Sat Oct 31, 2009 10:11 pm    Post subject: Reply with quote

#IfWinExist, Untitled - Notepad
F1::
WinClose, Untitled - Notepad ahk_class Notepad
#IfWinExist

F1::
Run, notepad
Return

I've tried it with a real example and it works, but when F1 closes Notepad, it runs it again. ?¿?
Back to top
jethrow



Joined: 24 May 2009
Posts: 722
Location: Iowa, USA

PostPosted: Sat Oct 31, 2009 10:13 pm    Post subject: Reply with quote

That's because you didn't copy my example Wink

If the hotkey is more that one line, the script will keep executing until it reaches the end of the script, or a terminating command (Return, Exit, ExitApp).
_________________
AHKL, COM_L,Webpage Controls,Donate to AHK
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