| View previous topic :: View next topic |
| Author |
Message |
Julio
Joined: 03 Apr 2009 Posts: 2
|
Posted: Fri Apr 03, 2009 1:17 pm Post subject: Close Program |
|
|
I wrote a script called Moffsoft.ahk for keyboard shortcuts which works. I wrote another called close.ahk to close Moffsoft.ahk but I cannot work out why this fails:
WinClose Moffsoft.ahk - AutoHotkey
which is the syntax suggested in FAQ. Apologies for elementary nature of this question. |
|
| Back to top |
|
 |
aCkRiTe
Joined: 21 Jul 2006 Posts: 555
|
Posted: Fri Apr 03, 2009 1:26 pm Post subject: |
|
|
Im assuming your Moffsoft script is just keyboard shortcuts, which has no gui so there is really no window to close. Why dont you just assign a hotkey like the following in your Moffsoft script to exit it when you want. I dont see the need for a second script to close the first one, unless Im missing something here.
_________________
HTH...
|
|
| Back to top |
|
 |
DevX
Joined: 07 Jan 2009 Posts: 43
|
Posted: Fri Apr 03, 2009 2:51 pm Post subject: An easy way |
|
|
If you really want to close one script from another, an easy way is to compile the script you want to terminate. That way, it will run as Moffsoft.exe and not Autohotkey.exe. Then you can
| Code: | | Process, Close, Moffsoft.exe |
If you dont want to compile, then you need a bit more code.
| Code: |
IfWinExist, ahk_pid %Capturer%
{
WinClose, ahk_pid %Capturer%
}
else
{
Run,"%A_ProgramFiles%\AutoHotkey\AutoHotkey.exe" "C:\Documents and Settings\konakm\Desktop\Ahk\capturer.ahk",,,Capturer
}
|
if winclose does not work use
| Code: | | Process, Close, %Capturer% |
This will cause the taskbar system tray icon to not dissapear until mouse rollover though ( another script can fix this, lol )
The code above will launch your script and save its pid for later termination, which also means that your closing script must launch your other script(s).
There might be other ways to do it, but I remember spending a lot of time getting this menu of mine to work, and this is what works. |
|
| Back to top |
|
 |
Julio
Joined: 03 Apr 2009 Posts: 2
|
Posted: Fri May 29, 2009 1:01 pm Post subject: |
|
|
| Hi, thanks for prompt replies. Using Esc for exit in Moffsoft - it's a calculator - works perfectly and is exactly what I wanted. I'm afraid 'compiling' scripts and those kind of things are way beyond my competence but I intend to study this a bit more as this stuff is incredibly helpful. |
|
| Back to top |
|
 |
Drugwash
Joined: 07 Sep 2008 Posts: 921 Location: Ploiesti, RO
|
Posted: Fri May 29, 2009 8:10 pm Post subject: |
|
|
Check your AHK\Compiler folder, there should be Ahk2Exe.exe in there. Launch it and follow the white rabbit... erm, I mean.. you know...  |
|
| Back to top |
|
 |
drainx1
Joined: 10 Apr 2009 Posts: 139 Location: Wichita,Kansas
|
Posted: Fri May 29, 2009 8:16 pm Post subject: |
|
|
also tryit forces the window to close _________________ Drainx1
Your favorite.
What says that we aren't a visualization of someones dream?
And that person could change the laws of physics without thinking a thing about it.
They could recreate the world, and not know what happened. |
|
| Back to top |
|
 |
Anyr
Joined: 28 Apr 2009 Posts: 56
|
Posted: Fri May 29, 2009 9:00 pm Post subject: |
|
|
| The problem has already been answered guys. The ExitApp worked |
|
| Back to top |
|
 |
|