Tl;DR , skip here---> ANYWAY, ive had to rewrite my hotkey/main scripts which usually include them, and ive had to do it about 5 or so times. I usually end up with some weird error. Ive turned appskey and rwin into F14/15, tilde into google key (f13) and use all the function keys for programs (1=picture related, 2 = text related, etc. until 11/12 become copy/paste) and Im using Morse to 1 2 3 tap hotkey them all. (if not just the key, then the AHK key is held) and I have ctrl+function keys as the regular function for the record.
First I did standard hotkey stuff, last attempt was a beautiful chart using Alt special chars and labels to call all the real code from the bottom, that was after the include attempt got all weird on me. (cant include file(wrong directory stated)).
I keep getting, through one key or another, key 1 being pressed by key 2, which is also pressing key 2. Ive had Circle Dock popping up when quick links should, but not the other way around, when circle was set to 2x press and ql set to 1. For some reason, once, I had Lwin as a hotkey with lwin+space nullifying the cancellation effect of holding it down (you know what I mean by that, yes?) and for some ungodly reason, it made l ctrl do the function that lwin & Space was set to (being 5x tab. Destroyed some script many times)
I gave up on all that, now im using
Code: Select all
Hot:
if (%A_ThisHotkey%Key_presses > 0) ; SetTimer already started, so we log the keypress instead.
{
%A_ThisHotkey%Key_presses += 1
return
} The Guts
; Otherwise, this is the first press of a new series. Set count to 1 and start
; the timer:
%A_ThisHotkey%Key_presses := 1
SetTimer, %A_ThisHotkey%Key, -400 ; Wait for more presses within a 400 millisecond window.
return
F1:: goto hot
F2:: Goto Hot
F3:: Goto Hot
F1Key: ;{
if (%A_ThisHotkey%Key_presses = 1) ;The key was pressed once.
;}
msgbox 2 ;{
else if (%A_ThisHotkey%Key_presses = 2) ; The key was pressed twice.
;} The Dirty Work
msgbox 22 ;{
else if (%A_ThisHotkey%Key_presses > 2)
;}
msgbox 222;{
%A_ThisHotkey%_presses := 0
;}
reload
return
;======================================================<>
F2Key: ;{
......... .you get the idea
QUESTIONS!!
1) Is that reload gonna give my pc lag? Its gonna happen after EVERY hotkey, if all goes according to plan
2) I didnt realize gosub returns to its spot, which Im starting to think is what ruined my last script. However, I went and placed the appropriate returns and I still had issues. So I was thinking:
Code: Select all
Hotkey, %keyname%, labelfor said key
FOR EVERY KEY
---------------------------
under all that, the labels and guis and includes.
How do I Library? How do I call a directory with include? I followed the help file and it didnt work. So labels cant be global? Can I use Functions to make hotkeys? Im still new to functions. I'd like to do that so I dont need include OR all my code in 1 script.
ULTIMATELY, I wanna know what the best way to make a hotkey script, either all in one script, or with each instance of a hotkey bring included from its own script, into once "main" script. Is there some protip amazing way to make that super easy and short? That 1st code I modded so the 1st part only has to be coded once, maybe something along the lines of that? Am I safe going with the Hotkey command? Keep in mind, almost every key will have 3x press. (maybe not the abc ones)
And for bonus, cause yalls seem awesome: How can I write a hotkey for a mod key, and be 100% certain its not gonna act all weird. My winkey and ctrl attempts are on/off/incorrectly executing all the time. I know you gotta do
MOD & whatever::
-then -
MOD::
then I usually do MOD::MOD
but...errors. at one point or anotherr. Luckly I copy most to start over.
Double Bonus: Nearly Every time I do something with the mouse, one of the used keys stop working normally. wtf. PLZ halp. I NEED my Mouse chording.
Sorry for the book. I'll be happy with any answer, but Ive looked all over the googles and the helps. I couldnt search here till now but I ficured if im signed up, to try asking. Im sorry if some of this is asked all the time. But I havent found the 100% answer yet so here goes. Thanks guys.