Page 1 of 2
Require for help to make a spam script when the key is pressed
Posted: 13 Aug 2022, 11:55
by healar4
Hello guys, can anyone tell me how to make this seript?
The thing I want to do is when u hold mouse4, it automatically starts to spam numpad4 and i can change the hotkey speed time
Hope u can help me
)
Re: Require for help to make a spam script when the key is pressed
Posted: 13 Aug 2022, 12:33
by mikeyww
Welcome to this AutoHotkey forum!
Code: Select all
delay = 25
XButton1::
SetKeyDelay, delay
While GetKeyState("XButton1", "P")
Send {Numpad4}
Return
Re: Require for help to make a spam script when the key is pressed
Posted: 13 Aug 2022, 12:45
by healar4
mikeyww wrote: ↑13 Aug 2022, 12:33
Welcome to this AutoHotkey forum!
Code: Select all
delay = 25
XButton1::
SetKeyDelay, delay
While GetKeyState("XButton1", "P")
Send {Numpad4}
Return
thanks for your help! but how can i change numpad4 to my keyboard right number 4?
Re: Require for help to make a spam script when the key is pressed
Posted: 13 Aug 2022, 13:00
by mikeyww
Re: Require for help to make a spam script when the key is pressed
Posted: 13 Aug 2022, 13:05
by healar4
doesn't work for me
do u have way to get keyboard right numpad 4 value?
Re: Require for help to make a spam script when the key is pressed
Posted: 13 Aug 2022, 13:12
by boiler
That is the right (correct) key name. Perhaps what you need is NumpadLeft.
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 00:56
by healar4
boiler wrote: ↑13 Aug 2022, 13:12
That is the right (correct) key name. Perhaps what you need is NumpadLeft.
i know that is correct keyname, if i do
XButton1::Numpad4 it will press right numpad4
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 03:12
by boiler
What do you mean by “right numpad4”? Do you mean you want it to press the right arrow key followed by the Numpad4 key, like below?
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 04:21
by healar4
boiler wrote: ↑14 Aug 2022, 03:12
What do you mean by “right numpad4”? Do you mean you want it to press the right arrow key followed by the Numpad4 key, like below?
i mean when i press mouse4 it will spam numpad4 key (keyboard right number 4)
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 04:44
by mikeyww
When you tested my script in Notepad, what did it do? A description beyond "doesn't work for me" would be useful.
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 04:48
by healar4
mikeyww wrote: ↑14 Aug 2022, 04:44
When you tested my script in Notepad, what did it do? A description beyond "doesn't work for me" would be useful.
your script will spam Numpad4 key( the left one), what i want is spam Numpad4 key (the right one)
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 05:08
by mikeyww
You might want to check the
scan code. You could then use it in your Send command. Some of the forum posts about multiple input devices may also help you.
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 05:32
by healar4
mikeyww wrote: ↑14 Aug 2022, 05:08
You might want to check the
scan code. You could then use it in your Send command. Some of the forum posts about multiple input devices may also help you.
i have no idea how to do this
can u give me an example?
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 06:23
by mikeyww
EDIT: More of the same....
Code: Select all
/* Scan code ----------------------------------------------------
This script gets a scan code from a key.
It copies the corresponding Send command to the clipboard.
By mikeyww on 14 August 2022 • For AutoHotkey 1.1.34.03
https://www.autohotkey.com/boards/viewtopic.php?p=477399#p477399
-----------------------------------------------------------------
*/
#InstallKeybdHook
Menu, main, Add, Exit, GuiEscape
Menu, main, Add, List
Menu, main, Add, KeyHistory, History
Menu, main, Add, About
Gui, +AlwaysOnTop
Gui, Font, s10
Gui, Menu, main
Gui, Add, Text , w230 , Press a key.
Gui, Add, Hotkey, wp vhk gGet
Gui, Add, Text , wp y+20, Scan code:
Gui, Add, Edit , wp vsc ReadOnly
Gui, Add, Edit , wp vsc2 ReadOnly
Gui, Add, Text , wp y+20, Send command:
Gui, Add, Edit , wp vcmd ReadOnly
Gui, Show,, Scan code
Return
History:
KeyHistory
Return
Get:
Gui, Submit, NoHide
GuiControl,, sc , % sc := Format("{:03X}", GetKeySC(hk))
GuiControl,, sc2, % sc2 := "SC" sc
GuiControl,, cmd, % Clipboard := "Send {" sc2 "}"
Return
List:
FileRecycle, % out := A_ScriptDir "\scanCodes.txt"
Loop, 0xFF {
n := 0x100 - A_Index
vk := Format("{:02X}", n)
key := "VK" vk
sc := GetKeySC(key)
name := GetKeyName(key)
(name != "") && list .= Format("{:03} {} {:03X} {}", n, vk, sc, name) "`n"
}
Sort, list
FileAppend, % Trim("N VK SC Key`n--- -- --- ------------`n" list, "`n"), %out%
Run, %out%
Return
About:
MsgBox, 64, About,
(
This script gets a scan code from a key.
It copies the corresponding Send command to the clipboard.
By mikeyww on 14 August 2022 • For AutoHotkey 1.1.34.03
https://www.autohotkey.com/boards/viewtopic.php?p=477399#p477399
Press CTRL-C to copy this box's text to the Windows clipboard.
)
Return
GuiClose:
GuiEscape:
ExitApp
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 06:36
by MrDodel
The last post in this thread may help:
viewtopic.php?f=76&t=107250
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 07:23
by boiler
healar4 wrote: ↑
your script will spam Numpad4 key( the left one), what i want is spam Numpad4 key (the right one)
Your keyboard has two Numpad4 keys?
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 07:29
by Rohwedder
Hallo,
this script viewtopic.php?f=76&t=107250
is only the beginning of SKAN's old, but very interesting topic:
https://www.autohotkey.com/board/topic/21105-crazy-scripting-scriptlet-to-find-scancode-of-a-key/
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 07:38
by healar4
boiler wrote: ↑14 Aug 2022, 07:23
healar4 wrote: ↑
your script will spam Numpad4 key( the left one), what i want is spam Numpad4 key (the right one)
Your keyboard has two Numpad4 keys?
nvm, already got the keyname
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 08:13
by mikeyww
What was the key name?
Re: Require for help to make a spam script when the key is pressed
Posted: 14 Aug 2022, 08:42
by healar4
mikeyww wrote: ↑14 Aug 2022, 08:13
What was the key name?
SC04B