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 

Running a script several times

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



Joined: 04 Sep 2006
Posts: 22

PostPosted: Thu Sep 28, 2006 6:32 pm    Post subject: Running a script several times Reply with quote

I just noticed you can use a hotkey as often as you want to open a program or website, but running a script works only once. If I want it to run again, I have to reload the script. What is a way around this?
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5376
Location: /b/

PostPosted: Thu Sep 28, 2006 9:00 pm    Post subject: Reply with quote

Put #SingleInstance off in your script.
Back to top
View user's profile Send private message Visit poster's website
Jiltdijk



Joined: 04 Sep 2006
Posts: 22

PostPosted: Fri Sep 29, 2006 7:32 am    Post subject: Reply with quote

Thanks!!!
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Fri Sep 29, 2006 7:44 am    Post subject: Reply with quote

Uh?
Titan's advice allows to have the same script running in several instances at once. If that's what you want, fine.
If you defined a hotkey, the script should stay in memory, waiting other hotkey presses. Unless you wrote ExitApp instead of Return...
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
Jiltdijk



Joined: 04 Sep 2006
Posts: 22

PostPosted: Fri Sep 29, 2006 7:59 am    Post subject: Reply with quote

I'm not sure anymore now what works for me and what doesn't, but I'll get back to you if I find out.
Back to top
View user's profile Send private message
silveredge78



Joined: 25 Jul 2006
Posts: 387
Location: Midwest, USA

PostPosted: Fri Sep 29, 2006 6:34 pm    Post subject: Reply with quote

I think Jiltdijk has a script file something like:

Code:
^z::Run, www.google.com

Which, for me, only runs the window once. Hitting the hotkey again just goes to that window. Whereas:

Code:
^z::Run, iexplore.exe www.google.com

Will open multiple instances of the window.

I also agree with PhiLho. I wouldnt think that allowing for multiple instances of a script with a hotkey would be something you would want though.
_________________
SilverEdge78
Back to top
View user's profile Send private message
Jiltdijk



Joined: 04 Sep 2006
Posts: 22

PostPosted: Sat Sep 30, 2006 9:35 pm    Post subject: Reply with quote

Here's an example:

I have this in my script:

#!i::
IfWinExist Movie Database
{
WinActivate
}
else
{
Run www.imdb.com
}
WinWaitActive Movie Database
Return

If I reload it, it will run once. After that, there's no response to the shortkey #!i. It doesn't matter if the imdb window still exists or not.
Back to top
View user's profile Send private message
Guest






PostPosted: Sat Sep 30, 2006 9:53 pm    Post subject: Reply with quote

Try this-

Code:
SetTitleMatchMode,2

#!i::
IfWinExist Movie Database
{
WinActivate
}
else
{
Run www.imdb.com
}
WinWaitActive Movie Database
Return


Have a look at SetTitleMatchMode in the help files. Also, double clicking th tray icon of the script gives a good indication of what is wrong. In this case the WinWaitActive and IfWinExist command was never finding a window title that started with "Movie Database".
Back to top
Jiltdijk



Joined: 04 Sep 2006
Posts: 22

PostPosted: Sun Oct 01, 2006 7:54 am    Post subject: Reply with quote

How can I set titlematchmode for all the scripts in the text file? I already had it at the beginning and through guest's comment I found out I have to put it in every little script AFTER the shortkey (#!i in this case)
Back to top
View user's profile Send private message
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Sun Oct 01, 2006 10:11 am    Post subject: Reply with quote

No, just put it before the first hotkey, and it will work for all scripts inside the file.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
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