How do I bind the hyphen key or equals key to a script? Topic is solved

Ask gaming related questions (AHK v1.1 and older)
baconbankai
Posts: 6
Joined: 24 Jun 2018, 11:40

How do I bind the hyphen key or equals key to a script?

Post by baconbankai » 10 Mar 2024, 16:54

How do I bind the hyphen key or equals key to a script? or keys in general that are not listed on the ahk key list? I have a mouse that has the keys 1234567890-= on the side. But I've never been able to bind hyphen or equals using the usual ::

example

Code: Select all

-::
send w
sleep 10
send a
[Mod edit: Added [code][/code] tags. Please use them yourself when posting code!]
[Mod edit: Moved topic from AHK v2 help to v1 help since this AHK v1 code.]

gregster
Posts: 9086
Joined: 30 Sep 2013, 06:48

Re: How do I bind the hyphen key or equals key to a script?

Post by gregster » 10 Mar 2024, 17:04

No problem here. You code works here with AHK v1 (it's not v2 code - that's why I moved your topic from AHK v2 help). As a side note, you should usually end your multi-line hotkeys with a return (at least if there is any other code below it which doesn't belong in this hotkey subroutine) - but that's not the problem here.
This works as well:

Code: Select all

=::msgbox
Are you using your hotkeys in a specific app - perhaps it is elevated or a game which doesn't cooperate?
I assume that you are not getting an error message with the code above. What does KeyHistory say, if you press - or = on your mouse while running your script above? Do these hotkeys work for you with the regular - and = keys?
Which AHK version are you using? Is it up-to-date?

gregster
Posts: 9086
Joined: 30 Sep 2013, 06:48

Re: How do I bind the hyphen key or equals key to a script?

Post by gregster » 10 Mar 2024, 17:08

Just in case, if you want to use the - key from the Numpad, then use this key name:

Code: Select all

NumpadSub::msgbox
I could imagine that your mouse emulates a numpad... and that you have to use the corresponding key names.

gregster
Posts: 9086
Joined: 30 Sep 2013, 06:48

Re: How do I bind the hyphen key or equals key to a script?

Post by gregster » 10 Mar 2024, 17:13

Since you tried to post a duplicate in the AHK v2 'Gaming' subforum, I will assume that this is for a game - which can be tricky and often involves trial-and-error.

You could try to run the script as admin.

Some other things to try, if the above doesn't work:
Why do Hotstrings, Send, and Click have no effect in certain games?
How to Make AHK Work in Most Games - The Basics

But there are no guarantees that a specific game will cooperate.

If your other keys work in the game, it has to be some other problem though. Then please see my posts above.

baconbankai
Posts: 6
Joined: 24 Jun 2018, 11:40

Re: How do I bind the hyphen key or equals key to a script?  Topic is solved

Post by baconbankai » 10 Mar 2024, 17:19

Tested it again it works never mind thanks

Post Reply

Return to “Gaming Help (v1)”