EDIT:
Or - and since everything occurs here when the scripts exits - does exist a function that unregister indiscriminately all hotkeys, not needed anymore, in order here to free script objects? Thanks
Code: Select all
Class C {
__New() {
MsgBox, 64,, % A_ThisFunc
}
MFR(__param) {
MsgBox % __param . " from " . A_ThisFunc
}
MES(__param) {
MsgBox % __param . " from " . A_ThisFunc
}
__Delete() {
MsgBox, 16,, % A_ThisFunc
}
}
OnExit("ExitFunc")
K := new C()
var := K.MFR.bind(K, "Bonjour")
Hotkey, ifWinActive, ahk_class Notepad
Hotkey, !f, % var, on
var := K.MES.bind(K, "Hola")
Hotkey, ifWinActive, AutoHotkey Help ; ahk_exe hh.exe
Hotkey, !e, % var, on
return
!x::
ExitApp
ExitFunc(__exitReason, __exitCode) {
; Hotkey, ifWinActive, ahk_class Notepad
; Hotkey, !f, funcF, on
; Hotkey, ifWinActive, AutoHotkey Help ; ahk_exe hh.exe
; Hotkey, !e, funcF, on ; once these lines uncommented, __Delete meta-function is called
return 0
}
funcF() {
return true
}