I want my script to take priority and make sure the key strokes are send Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ulfric Stormcloak
Posts: 39
Joined: 28 Apr 2017, 23:26

I want my script to take priority and make sure the key strokes are send

25 May 2017, 11:21

If i am doing other stuff on my keyboard while the script is active, I want ahk to ignore the other stuff i am doing on my keyboard and send the keystrokes from the script.
Meaning i want ahk script to take priority and stop everything else and make sure the keystrokes are sent.

For example if i am holding down the left mouse key. I want the left mouse key to ignored and command from my script to be send. Than i go back to holding down my left mouse key.

this is my script, it basically send keystrokes every few seconds and i want those keystrokes to take priority over other things i am doing with my mouse/keyboard.

Code: Select all

z::
RepeatKey := !RepeatKey
If RepeatKey
{
	SetTimer, SendTheKey1, 10000
	SetTimer, SendTheKey2, 5000
	SetTimer, SendTheKey3, 6000
	SetTimer, SendTheKey4, 7000
	SetTimer, SendTheKey5, 30000
}
Else
{
	SetTimer, SendTheKey1, Off
	SetTimer, SendTheKey2, Off
	SetTimer, SendTheKey3, Off
	SetTimer, SendTheKey4, Off
	SetTimer, SendTheKey5, off
}
Return

SendTheKey1:		
	SendInput 1
	sleep 1000
Return

SendTheKey2:	
	SendInput 2
	sleep 1000
Return

SendTheKey3:
	SendInput 3
Return

SendTheKey4:
	SendInput 4
Return

SendTheKey5:
	Send, {Tab}
	Sleep, 500
	SendInput 1
	Sleep, 1000
	Send, {Tab}
Return
I dont know much about Ahk so please use an example of a code or try to add the code into my script.
Thank you
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: I want my script to take priority and make sure the key strokes are send

25 May 2017, 11:56


[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

Ulfric Stormcloak
Posts: 39
Joined: 28 Apr 2017, 23:26

Re: I want my script to take priority and make sure the key strokes are send  Topic is solved

25 May 2017, 12:13

I dont understand what you did in that code but i used blockinput in my script and came up with this code

Code: Select all

z::
RepeatKey := !RepeatKey
If RepeatKey
{
	SetTimer, SendTheKey1, 10000
	SetTimer, SendTheKey2, 5000
	SetTimer, SendTheKey3, 6000
	SetTimer, SendTheKey4, 7000
	SetTimer, SendTheKey5, 30000
}
Else
{
	SetTimer, SendTheKey1, Off
	SetTimer, SendTheKey2, Off
	SetTimer, SendTheKey3, Off
	SetTimer, SendTheKey4, Off
	SetTimer, SendTheKey5, off
}
Return

SendThekey1:		
	BlockInput On
	sleep 500	
	SendInput 1
	sleep 1000
	BlockInput Off
Return

SendTheKey2:
	BlockInput On
	sleep 500
	SendInput 2
	sleep 1000
	BlockInput Off
Return

SendTheKey3:
	BlockInput On
	sleep 500
	SendInput 3
	BlockInput Off
Return

SendTheKey4:
	BlockInput On	
	sleep 500
	SendInput 4
	BlockInput Off
Return

SendTheKey5:
	BlockInput On	
	Send, {Tab}
	Sleep, 500
	SendInput 1
	Sleep, 1000
	Send, {Tab}
	BlockInput Off
Return
Sometimes the timers overlap and press the keystroke really fast in the script how do i stop my script from finishing 1 input before sending in another input. Also i want block input to be on while doing this.
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: I want my script to take priority and make sure the key strokes are send

25 May 2017, 13:49

Ulfric Stormcloak wrote: I dont understand what you did in that code but i used blockinput in my script and came up with this code
Show me what you want the script to do.
Are you wanting to send some numbers, press tab, then type more numbers, then repeat?

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

Ulfric Stormcloak
Posts: 39
Joined: 28 Apr 2017, 23:26

Re: I want my script to take priority and make sure the key strokes are send

25 May 2017, 14:17

Delta Pythagorean wrote:
Ulfric Stormcloak wrote: I dont understand what you did in that code but i used blockinput in my script and came up with this code
Show me what you want the script to do.
Are you wanting to send some numbers, press tab, then type more numbers, then repeat?
Its okay i figured it out :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Aqualest, Bing [Bot] and 291 guests