| View previous topic :: View next topic |
| Author |
Message |
brotherS
Joined: 01 Jun 2005 Posts: 174
|
Posted: Mon Mar 02, 2009 7:10 am Post subject: AHK executing a command in the wrong way? |
|
|
Hi,
I'm using AutoHotkey to start Locate (http://www.locate32.net/) with the Win+f key combination, and (annonyingly) often Locate wouldn't start another instance but only bring an instance that's already running to the foreground. And when that happens I can try as often as I want, Locate would NOT start another instance. I'm using this code:
| Code: | #Persistent
#f::
IfExist,C:\Program Files\Locate
run, C:\Program Files\Locate\Locate32.exe -i
return
|
The Locate author suggested that AutoHotkey is the problem since he can't reproduce this behavior without AutoHotkey - and this seems to be correct, when I just hit Win+r (to open Windows' execute box) and type
| Code: | | C:\Program Files\Locate\locate32.exe -i |
there, it works just fine!
So... do I have to change the AHK code to make this work correctly? _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
garry
Joined: 19 Apr 2005 Posts: 2214 Location: switzerland
|
Posted: Mon Mar 02, 2009 7:39 am Post subject: |
|
|
use fullpath
| Code: | #Persistent
#f::
IfExist,%A_programfiles%\Locate\Locate32.exe
run, %A_programfiles%\Locate\Locate32.exe -i
return
|
|
|
| Back to top |
|
 |
brotherS
Joined: 01 Jun 2005 Posts: 174
|
Posted: Mon Mar 02, 2009 9:55 am Post subject: |
|
|
| garry wrote: | use fullpath
| Code: | #Persistent
#f::
IfExist,%A_programfiles%\Locate\Locate32.exe
run, %A_programfiles%\Locate\Locate32.exe -i
return
|
|
I get an error when I try that:
| Quote: |
Error: This line does not contain a recognized action.
|
Edit:
I then tried
| Code: | #Persistent
#f::
IfExist,%Programfiles%\Locate
run, %Programfiles%\Locate\Locate32.exe -i
return
|
but that isn't solving the problem either. _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
Jex
Joined: 01 Aug 2008 Posts: 101
|
Posted: Mon Mar 02, 2009 11:58 pm Post subject: |
|
|
Why not just use:
| Code: | #Persistent
#f::
run, C:\Program Files\Locate\Locate32.exe -i
return |
if that doesn't work, try putting quotes around it:
"C:\Program Files\Locate\Locate32.exe"
then:
"C:\Program Files\Locate\Locate32.exe -i" _________________ Woot.
Please read forum etiquette |
|
| Back to top |
|
 |
brotherS
Joined: 01 Jun 2005 Posts: 174
|
Posted: Tue Mar 03, 2009 1:06 am Post subject: |
|
|
| Jex wrote: | Why not just use:
| Code: | #Persistent
#f::
run, C:\Program Files\Locate\Locate32.exe -i
return |
if that doesn't work, try putting quotes around it:
"C:\Program Files\Locate\Locate32.exe"
then:
"C:\Program Files\Locate\Locate32.exe -i" |
The extra check is to make sure the hotkey wouldn't work on another system where Locate is not installed.
I changed it to:
| Code: |
#Persistent
#f::
IfExist,%Programfiles%\Locate
run, "C:\Program Files\Locate\Locate32.exe" -i
return
|
and while it *seemed* to work at first, it still isn't *always* causing the expected results (like using Windows' command line). Strange... _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
brotherS
Joined: 01 Jun 2005 Posts: 174
|
Posted: Wed Mar 04, 2009 10:50 am Post subject: |
|
|
I tried to make it work with %comspec% but that also failed...
Anyone got more ideas how I could make this work? Or *is* this a bug? _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
closed
Joined: 07 Feb 2008 Posts: 509
|
Posted: Wed Mar 04, 2009 2:09 pm Post subject: |
|
|
try adding workingdir
| Quote: | | The working directory for the launched item. Do not enclose the name in double quotes even if it contains spaces. If omitted, the script's own working directory (A_WorkingDir) will be used. |
| Quote: | | Run, Target , WorkingDir |
 |
|
| Back to top |
|
 |
brotherS
Joined: 01 Jun 2005 Posts: 174
|
Posted: Wed Mar 04, 2009 2:25 pm Post subject: |
|
|
Thanks for the suggestion.
Sadly, that also doesn't work. It still mostly just activates the Locate instance that has been launched most recently. _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1651 Location: Denmark
|
|
| Back to top |
|
 |
brotherS
Joined: 01 Jun 2005 Posts: 174
|
Posted: Wed Mar 04, 2009 3:17 pm Post subject: |
|
|
| tonne wrote: | Change locate as, tools|options|keyboard shortcuts:
Change or remove the shortcut for Win+f|Global (hook)|Open dialog. |
Aaaaaaaaaaaaaah... who would have thought of THAT... (I obviously didn't)
Thanks a lot! _________________ DonationCoder.com brings AHK to the newbies!
Fan of AutoHotkey? Consider an occasional donation to its developer, Chris Mallett. |
|
| Back to top |
|
 |
|