Search found 4454 matches

by evilC
04 Feb 2019, 06:02
Forum: Gaming
Topic: Trying to read XBox One / Elite pads with AutoHotkey? READ THIS BEFORE POSTING
Replies: 0
Views: 163

Trying to read XBox One / Elite pads with AutoHotkey? READ THIS BEFORE POSTING

AutoHotkey's GetKeyState() command no longer works properly on Windows 10 (As of 1809 or thereabouts) with non-xbox360 XInput controllers. It will work fine while the AHK script is the active application, but as soon as you switch into a game, AHK will no longer be able to read the stick. The soluti...
by evilC
01 Feb 2019, 05:11
Forum: Scripts and Functions
Topic: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Replies: 185
Views: 18181

Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!

state holds the state of the input - 1 for pressed, 0 for released. Your code as it stands will press LMB when you press XB2, and never, ever release LMB. Also, mouseId is not in scope in your function To press LMB when you press XB2, and release LMB when you release XB2: testFunction(state){ globa...
by evilC
31 Jan 2019, 05:38
Forum: Ask For Help
Topic: I am baffled... How do you make it so while you hold down a key it presses itself until you let go? Topic is solved
Replies: 10
Views: 322

Re: I am baffled... How do you make it so while you hold down a key it presses itself until you let go? Topic is solved

You can shorten the code with a few more advanced techniques, especially because all your hotkeys use identical logic, only the key that gets sent changes. #SingleInstance force SetKeyDelay, 20 keys := ["q", "w", "e", "a", "s", "d"] SpamFns := {} KeyStates := {} for i, key in keys { fn := Func("KeyE...
by evilC
30 Jan 2019, 11:04
Forum: Gaming
Topic: Win10 1809 now seems to support sending synthetic Xbox input
Replies: 0
Views: 131

Win10 1809 now seems to support sending synthetic Xbox input

Just came across this: https://docs.microsoft.com/en-us/uwp/api/windows.ui.input.preview.injection.inputinjector.injectgamepadinput Seems like build 1809 now supports sending as a physical xbox controller, like how AHK can send synthetic keyboard / mouse? Not played with it yet, I don't have 1809 on...
by evilC
30 Jan 2019, 08:25
Forum: Scripts and Functions
Topic: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Replies: 185
Views: 18181

Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!

@Sdentin - good catch regarding the devices stopping working after sleep.
I will look into it and see if there is anything I can do - maybe I can detect the sleep and re-enumerate the devices or something, thus stopping it from incrementing the device IDs
by evilC
30 Jan 2019, 08:24
Forum: Scripts and Functions
Topic: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Replies: 185
Views: 18181

Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!

@ppapkor - I don't know how it knows, the input comes *from the driver*, which is exactly how it would look for real input. I have heard reports of some games being able to detect that Interception is installed, and refuse to run, but I have not heard about any games being able to identify a specifi...
by evilC
30 Jan 2019, 07:22
Forum: Ask For Help
Topic: Any help appreciated
Replies: 2
Views: 118

Re: Any help appreciated

FYI Sendinput {ENTER} is unaffected by SetKeyDelay, 200 , whereas all your other Sends are. Dunno if that is intentional or not. Furthermore, if your keys are not reliably recognized by a game, you appear to be setting the wrong value with SetKeyDelay. The 1st parameter controls how long to wait AFT...
by evilC
29 Jan 2019, 12:54
Forum: Ask For Help
Topic: Keyspam. Can't get to work Space or other special keys. Topic is solved
Replies: 3
Views: 116

Re: Keyspam. Can't get to work Space or other special keys. Topic is solved

Code: Select all

Tab::
toggle := !toggle
return

#if toggle
$Space::
$Q::
$W::
while GetKeyState(A_Thishotkey,"P")
{
	Send, % "{" SubStr(A_Thishotkey, 2) "}"
	sleep 200
}
return
#if
by evilC
29 Jan 2019, 12:47
Forum: Ask For Help
Topic: I need help.
Replies: 2
Views: 61

Re: I need help.

I doubt it can be made any faster If anything, it is too fast already - many games will not respond to keys that are not held for at least 20-50ms Also setkeydelay, -1 is not doing anything, as it is incompatible with SendInput Having SetBatchLines in your loop is pointless - you only need to set it...
by evilC
29 Jan 2019, 05:23
Forum: Ask For Help
Topic: Have getkeystate always running?
Replies: 3
Views: 113

Re: Have getkeystate always running?

You are likely using an Xbox One controller. AHK's built-in joystick support will not work properly for those any more, since a recent Win10 update.
You need the XInput library: https://autohotkey.com/board/topic/35848-xinput-xbox-360-controller-api/
by evilC
28 Jan 2019, 06:59
Forum: Gaming
Topic: Rapid fire stucks
Replies: 4
Views: 197

Re: Rapid fire stucks

I think you will find that AutoHotkey detected it just fine, but the game did not. Assume the game polls (checks) the state of the keys every 50ms At t+0, AHK sends key press at t+50, game checks state of key, sees it pressed at t+60, AHK releases key at t+70, AHK presses key again at t+100, game ch...
by evilC
28 Jan 2019, 06:33
Forum: Ask For Help
Topic: What is wrong with my loop?
Replies: 1
Views: 100

Re: What is wrong with my loop?

if %A_index% := 1 is an assignment AND a comparison ( := is assignment), and as such is always true Your code is also inefficient. When you check if A_Index is 1, you should use an ELSE IF to check if it is 2, else even if it is 1, you still check if it is 2 if (A_Index == 1){ } else if (A_Index ==...
by evilC
28 Jan 2019, 06:30
Forum: Ask For Help
Topic: Have getkeystate always running?
Replies: 3
Views: 113

Re: Have getkeystate always running?

Instead of a Loop, use SetTimer. This will fire the code at repeated intervals, whilst allowing the rest of your script to keep on running.
by evilC
28 Jan 2019, 06:27
Forum: Ask For Help
Topic: Keyboard debounce Topic is solved
Replies: 2
Views: 88

Re: Keyboard debounce Topic is solved

Try this - you can add debouncing to a key by using eg db.AddKey("x") to add the x key #SingleInstance force ;~ OutputDebug DBGVIEWCLEAR db := new Debouncer(20) ; Set Debounce Time here db.AddKey("x") db.AddKey("c") return class Debouncer{ KeyFns := {} __New(debounceTime := 20){ this.DebounceTime :=...
by evilC
28 Jan 2019, 05:51
Forum: Gaming
Topic: Rapid fire stucks
Replies: 4
Views: 197

Re: Rapid fire stucks

Your code looks fine I would suggest trying to remove the line SendMode Input , as that mode does not tend to play nicely with games, just use the default mode. 50 is also probably too fast a spam rate. When you send keys too fast (Too little time between press and release), games will often miss ke...
by evilC
28 Jan 2019, 05:45
Forum: Gaming
Topic: Joystick scripts only work if I "Open" the script. Why?
Replies: 1
Views: 83

Re: Joystick scripts only work if I "Open" the script. Why?

This is due to a change MS made with a recent-ish Windows 10 release. Xbox One pads are no longer readable via the WinMM API (The VERY old API that AHK uses to read sticks) when the AHK script is not the active application. You must use the XInput API to read them: https://autohotkey.com/board/topic...
by evilC
25 Jan 2019, 05:31
Forum: Scripts and Functions
Topic: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!
Replies: 185
Views: 18181

Re: AutoHotInterception (AHI): Multi-Keyboard / Multi-Mouse support for AHK. Per-device blocking!

You can use function binding to pass extra parameters to the function Here I add the name of the key and the code gotten from GetKeySC #SingleInstance force #Persistent #include Lib\AutoHotInterception.ahk AHI := new AutoHotInterception() keyboardId := AHI.GetKeyboardId(0x04F2, 0x0112) sc := GetKeyS...
by evilC
24 Jan 2019, 12:03
Forum: Ask For Help
Topic: Press a Key to immediately output a single "A", then when held for X milliseconds, it spams "A" until unheld
Replies: 4
Views: 127

Re: Press a Key to immediately output a single "A", then when held for X milliseconds, it spams "A" until unheld

FYI my sample code was set to spam @ 100ms, I think you wanted 10. Just change the line SetTimer, % fn, % (state ? 100 : "Off") to control the spam rate 10ms is one hell of a spam tho (100 times a second), many games will not see that - in fact they will quite possibly treat it as one long press. 10...
by evilC
24 Jan 2019, 11:56
Forum: Ask For Help
Topic: I am baffled... How do you make it so while you hold down a key it presses itself until you let go? Topic is solved
Replies: 10
Views: 322

Re: I am baffled... How do you make it so while you hold down a key it presses itself until you let go? Topic is solved

So timers do not interfere with each other? There is only one timer in this example, but the point is that a while(GetKeyState()) loop locks up the current thread. If, for example, you have a loop running, and you hit a hotkey with a GetKeyState loop in it, the loop in your main thread is suspended...
by evilC
24 Jan 2019, 08:54
Forum: Ask For Help
Topic: I am baffled... How do you make it so while you hold down a key it presses itself until you let go? Topic is solved
Replies: 10
Views: 322

Re: I am baffled... How do you make it so while you hold down a key it presses itself until you let go? Topic is solved

Y'all are forgetting your $ prefix And putting SetKeyDelay in a loop like that is pointless, it only needs to be used once, at the beginning of the script Plus getkeystate loops are just the wrong way to do this - It's all fair and well when there is only one hotkey, but if you try and do this with ...

Go to advanced search