r/AutoHotkey 1h ago

General Question what are some practical uses for auto hotkey

Upvotes

so far the only things i've made is whenever type dih it'll make an ACSII drawing of a penis and some hot keys so that i can type out ±,√,≥, and ≤. I want to code something more complicated and more practical, like a calculator, but thats prolly far to difficult for me, do yall have any ideas?


r/AutoHotkey 5h ago

v2 Script Help Trying to use A_PriorPriorHotKey

0 Upvotes

Hi, this is just a little post to say I've been trying to implement "A_PriorPriorHotKey" in AutoHotKey.

If you don't know what "A_PriorHotKey" is, it's just a variable that contains the last HotKey you pressed.

And... I'm sorry if I make mistakes btw, I really don't want to get called out for this again, AutoHotKey is an extremely massive language to a point where people that have used it for 20 years probably could still discover new things about it, so... if I'm not wrong, "A_PriorPriorHotKey", a variable that would contain the second to last HotKey you pressed, is not implemented by default, but I did find a way to implement it.

I don't have the code on this computer and I figured it would be fine if I don't add it in this post, if you want to use it yourself I can give it, but I don't think I need to give it so people can help me do the fix I want to do, hopefully... just know the one thing it doesn't do is that it doesn't store the HotKey if it's the same as A_PriorHotKey, so A_PriorPriorHotKey and A_PriorHotKey are never equal once they start to contain things, and we can say that APPHK contains the second to last HotKey you pressed, but not counting duplicates.

However, it has an annoying thing: to make it work, I used a "SetTimer", which can call a function at a wanted interval, but SetTimer still needs an interval; it can't be every 0s seconds, and so, that means there is a slight delay between the moment the HotKey is pressed and the moment APPHK updates.

And so, let's say I want to do something if I press a, b then c, when I press a, it doesn't get updated yet (that's how A_PriorHotKey works, it waits for the next HotKey to store something), when I press b, APHK gets updated to "a", but when I press c, let's say I wrote a line in the code that checks the value of APHK and APPHK (if (A_PriorHotKey = "b" && A_PriorPriorHotKey = "c")), it won't work, because it will check both variables, see that APHK = "b" and APPHK = whatever, because of this slight delay, let's say SetTimer is set to 10ms, the code will check instantly, and only 10ms APPHK will be set to "a" but it's too late.

Now APPHK can still be used, you can simply add a "Sleep" so that the code does check APPHK after it was updated, but that's still annoying, so, is there a way for APPHK to be instantly updated? I mean, APHK is instantly updated, or at least it gives the feeling it is, wouldn't be surprised if there is a trick with APHK and it's technically not instant, but is there a way to make APPHK work the same?


r/AutoHotkey 17h ago

v2 Script Help How do I make a macro with 2 different toggles for fortnite?

0 Upvotes

I want an AutoClicker that Enables when I press "1" and Disable when I press "F" but it only clicks when I hold Left Click.

Also it does need to have a random offset due fortnite's eac detection.