It has a Main Menu that start other InputHook so that you can arrange it the way you like it, one key activate other menu and only the keys assigned to the InputHook opened work.
Also has this KeyOpt that with GetKeyState you can use hotkeys to combine these keys and make pratically unlimited menus etc.
It works great, but when it is used with #InWinActive (to limit it to work only on one .exe) for some reason pressing the same hotkey doesn't restart/terminate the InputHook.
For example: In my own script, I have several menus that call different functions and labels, and it is wrote just like this one that I wrote for you guys test it. If you keep opening menus and coming back to the Main Menu to open another one (supposing you are trying to find something specific on it), it creates many InputHook one over another.
But when you don't use #IfWinActive, pressing the same hotkey that called the MainMenu InputHook terminate it. Also, the "{sc029}" in the InputHook keys was me trying to make it terminate using the >> ' << key, bc it is the scan code for it.
Basically I need it to restart using the same key that you call the MainMenu InputHook, in my case is >> ' << .
In the script Im sending, it has a #IfWinActive to work on chrome, you can change it if you use another browser.
I'd be very glad if someone could help me.
Code: Select all
#SingleInstance, force ;only one instance may run at a time
#IfWinActive ahk_exe chrome.exe
'::
MainMenuGui()
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;; ------------- MAIN MENU --------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MainMenuGui(){
tooltip,
(
////////////////////// MAIN MENU ////////////////////////////////////////////`n
[W] URLs 1 [E] URLs 2
`n
)
,
inputHook := InputHook("E","QWERTYUIOPASDFGHJKLZXCVBNMÇ{Escape}{sc029}\") ;; any other hotkey should be added here
inputHook.KeyOpt("{LCTRL}{LALT}{SHIFT}","+S") ;; any other additional modifiers should be added here
;; KeyOpt prevent those keys from being sent through the application while the inputhook is on
inputHook.OnEnd := Func("MainMenu")
inputHook.Start()
return
}
MainMenu(ih) {
tooltip,
shift := GetKeyState("Shift","P")
ctrl := GetKeyState("Ctrl","P")
alt := GetKeyState("Alt","P")
switch ih.EndKey {
Case, "w":
if shift
return
else if ctrl
return
else if alt
return
else
URL1Menu()
Case, "e":
if shift
return
else if ctrl
return
else if alt
return
else
URL2Menu()
}
return
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;; ------------- END OF MAIN MENU --------------- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ------------- START of URLs 1 ---------------
URL1Menu(){
tooltip,
(
////////////////////////////////// URLs 1 ////////////////////////////////`n
[W] GOOGLE [SHIFT+W] INSTAGRAM
[A] FACEBOOK [SHIFT+A] TWITTER
)
,
inputHook := InputHook("E","QWERTYUIOPASDFGHJKLZXCVBNMÇ{sc029}{Escape}\") ;; any other hotkey should be added here
inputHook.KeyOpt("{LCTRL}{LALT}{SHIFT}","+S") ;; any other additional modifiers should be added here
;; KeyOpt prevent those keys from being sent through the application while the inputhook is on
inputHook.OnEnd := Func("URL1") ;;
inputHook.Start()
return
}
URL1(ih) {
tooltip,
shift := GetKeyState("Shift","P")
ctrl := GetKeyState("Ctrl","P")
alt := GetKeyState("Alt","P")
switch ih.EndKey {
Case, "w":
if shift
Run https://www.instagram.com/
else if ctrl
return
else if alt
return
else
Run https://www.google.com/
Case, "a":
if shift
Run https://twitter.com/
else if ctrl
return
else if alt
return
else
Run https://www.facebook.com/
}
return,
}
; ------------- END of URLs 1 ---------------
; ------------- START of URLs 2 ---------------
URL2Menu(){
tooltip,
(
////////////////////// URL2 ////////////////////////////////`n
[Q] AHK FORUM [W] GMAIL
`n
)
,
inputHook := InputHook("E","QWERTYUIOPASDFGHJKLZXCVBNMÇ{sc029}{Escape}\") ;; any other hotkey should be added here
inputHook.KeyOpt("{LCTRL}{LALT}{SHIFT}","+S") ;; any other additional modifiers should be added here
;; KeyOpt prevent those keys from being sent through the application while the inputhook is on
inputHook.OnEnd := Func("URL2") ;;
inputHook.Start()
return
}
URL2(ih) {
tooltip,
shift := GetKeyState("Shift","P")
ctrl := GetKeyState("Ctrl","P")
alt := GetKeyState("Alt","P")
switch ih.EndKey {
Case, "q":
if shift
return
else if ctrl
return
else if alt
return
else
Run https://www.autohotkey.com/boards/
Case, "w":
if shift
return
else if ctrl
return
else if alt
return
else
Run https://mail.google.com/
}
return,
}
; ------------- END of URLs 2 ---------------