Main > Software Forum

AHK (exit) for SUperModel 3

<< < (4/5) > >>

Moksi:
; press key 3 & key 4 to exit Supermodel

4::
if not GetKeyState("3","P")
return
Winclose, Supermodel
sleep, 1000
return


works with making the ahk yourself & put it in the windows Startup folder

Moksi:
with this enabled now i have another little problem.
 
with this script running all the time i cant press 4 because the script has it locked

possible i can give a command to active the script when hyperspin is started en stop the script when hyperspin is closed.

and how to type that command to the script i use

R083RT0:
better script....

~3 & 4::
Winclose, Supermodel
sleep, 1000
return

DrakeTungsten:
The #IfWin family of directives is what you want to use to have a hotkey in effect only when a certain program is running (#IfWinExist), or has focus (#IfWinActive)

https://autohotkey.com/docs/commands/_IfWinActive.htm

I tested this with Supermodel and it works (if I switch to Notepad, even with Supermodel running, I can type a "4". If I hit "4" on the Supermodel Window, then Supermodel exits)

--- Code: ---#IfWinActive, Supermodel
4::
Winclose, Supermodel
sleep, 1000
return

--- End code ---
I assume this would also work with Roberto's "~3 & 4::" substitution. You probably do want this only in effect when Supermodel is running instead of basing the hotkey on Hyperspin, unless Supermodel is the only emulator you are going to use from Hyperspin. If for some reason you do prefer to use Hyperspin as the program for AHK to look for, then you would have to use the #IfWinExist directive instead of #IfWinActive.

BTW, why the "sleep"?

Moksi:
yes  :applaud: it works perfectly now. 

thanks for the help!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version