| View previous topic :: View next topic |
| Author |
Message |
Jiltdijk
Joined: 04 Sep 2006 Posts: 22
|
Posted: Thu Sep 28, 2006 6:32 pm Post subject: Running a script several times |
|
|
| 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 |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5376 Location: /b/
|
Posted: Thu Sep 28, 2006 9:00 pm Post subject: |
|
|
| Put #SingleInstance off in your script. |
|
| Back to top |
|
 |
Jiltdijk
Joined: 04 Sep 2006 Posts: 22
|
Posted: Fri Sep 29, 2006 7:32 am Post subject: |
|
|
| Thanks!!! |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Fri Sep 29, 2006 7:44 am Post subject: |
|
|
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 |
|
 |
Jiltdijk
Joined: 04 Sep 2006 Posts: 22
|
Posted: Fri Sep 29, 2006 7:59 am Post subject: |
|
|
| 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 |
|
 |
silveredge78
Joined: 25 Jul 2006 Posts: 387 Location: Midwest, USA
|
Posted: Fri Sep 29, 2006 6:34 pm Post subject: |
|
|
I think Jiltdijk has a script file something like:
Which, for me, only runs the window once. Hitting the hotkey again just goes to that window. Whereas:
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 |
|
 |
Jiltdijk
Joined: 04 Sep 2006 Posts: 22
|
Posted: Sat Sep 30, 2006 9:35 pm Post subject: |
|
|
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 |
|
 |
Guest
|
Posted: Sat Sep 30, 2006 9:53 pm Post subject: |
|
|
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
|
Posted: Sun Oct 01, 2006 7:54 am Post subject: |
|
|
| 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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sun Oct 01, 2006 10:11 am Post subject: |
|
|
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 |
|
 |
|