View Full Version : [AutoHotKey] Need help with shift+number key cloning to wow windows
PandaCan
09-13-2012, 09:07 PM
So I've been fiddling around a lot and finally stumbled on how to clone shift+ letters for wow (below)
WinGet, wowid, list, World of Warcraft
+Q::
ControlSend,, {Shift down}{Q down}{Q up}{Shift up}, ahk_id %wowid1%
ControlSend,, {Shift down}{Q down}{Q up}{Shift up}, ahk_id %wowid2%
Return
However it seems to not be working with numbers, I think its because it thinks im pressing the shift character for the key (1 would be !, 2 would be @, 3 would be # etc...) so heres what I came up with, its an improvement because now my main window is working correctly but my offwindow is still trying to cast just the number as if the shift is not held down
WinGet, wowid, list, World of Warcraft
+2::
ControlSend,, {Shift down}{@ down}{@ up}{Shift up}, ahk_id %wowid1%
ControlSend,, {Shift down}{@ down}{@ up}{Shift up}, ahk_id %wowid2%
Return
WinGet, wowid, list, World of Warcraft
+3::
ControlSend,, {Shift down}{# down}{# up}{Shift up}, ahk_id %wowid1%
ControlSend,, {Shift down}{# down}{# up}{Shift up}, ahk_id %wowid2%
Return
WinGet, wowid, list, World of Warcraft
+4::
ControlSend,, {Shift down}{$ down}{$ up}{Shift up}, ahk_id %wowid1%
ControlSend,, {Shift down}{$ down}{$ up}{Shift up}, ahk_id %wowid2%
Return
aasi888
09-15-2012, 10:43 AM
Seems like AHK can't hijack the hotkey properly. You can test it this way:
space::
return
Go in game and perss space to jump. If your character just jumped it means the hijacking of hotkeys is broken in that game. I got this problem in Skyrim myself and I haven't found a way to hijack the keys in games that don't support the hijacking.
One way to solve your problem could be to lift the hotkeys UP before executing the clonepush:
+2::
SEND {2 up}{Shift up}
ControlSend,, {Shift down}{2}{Shift up}, ahk_id %wowid1%
ControlSend,, {Shift down}{2}{Shift up}, ahk_id %wowid2%
Return
PandaCan
09-16-2012, 09:35 PM
Well it is working correctly, I mean I have every key on the keyboard bound for the most part including capitals and shift+ letters but I think the problem is coming from the fact that the number keys' shift item are different from the number itself (1 = ! 2 = @)
aasi888
09-17-2012, 12:35 PM
EDIT: Script not working
Could be the case.How about changing the settings for hotkey 2 as follows:
2::
If GetKeyState("Shift","D")
{
; This gets triggered when shift button is down
; INSERT CODE for hotkey: shift +2
}
If GetKeyState("Shift","U")
{
; This is triggered when you do not press shift button
; INSERT CODE for hotkey: 2
}
return
Not tested it so I don't know if works or not.
PandaCan
09-17-2012, 01:28 PM
So you are saying that I should change it to when I press shift D the game recognizes it as me pressing shift 2? Or when I press shift 2 the game recognizes it as me pressing shift D?
aasi888
09-17-2012, 04:57 PM
Answer to question:
Looks like my script didnt work after all. And I was trying to make a too complicated example without reference to what I was aiming at.
Check Autohotkey manual that comes with the program. I love to use it since it has a search function (I use the offline manual since it faster than online manual). Just search for Getkeystate (http://http://www.autohotkey.com/docs/commands/GetKeyState.htm) and you will find out what it means.
In my case it would execute the If statement only if the shift key was being pressed. Atleast that was my aim.
Back to topic. Is it working at the moment or not? If it's not working then you might wanna try this:
+2::
ControlSend,, {@}, ahk_id %wowid1%
ControlSend,, {@}, ahk_id %wowid2%
Return
PandaCan
09-18-2012, 12:08 AM
The problem is when I go to keybind @ it just kebinds "Shift+2"
aasi888
09-18-2012, 08:14 AM
You might wanna try Autohotkey forums. I don't know how you can do it.
Darkreign11
09-21-2012, 01:28 PM
~+2::
ControlSend,,{Shift down}{2 down}{2 up}{Shift up}, ahk_id %wowid1%
ControlSend,,{Shift down}{2 down}{2 up}{Shift up}, ahk_id %wowid2%
return
And for conditionals to getting key states you can simply use:
~a::
If GetKeyState("a","P")
{
ControlSend,, {a down}, ahk_id %wowid2%
}
Else
{
ControlSend,, {a up}, ahk_id %wowid2%
}
return
And nest shift and key required within the required blocks. D & U can still be used. P defines a physical key press. No need to define 2 blocks for up and down. Just test the key state. Longer way would have been to write If GetKeyState("a","P") = 1 .. which means of course true (key is being pressed). If key is not true, then just automatically do else.
I am truly happy someone is trying to also learn AHK .. I do hope you are using AHK L however. Can be found as a link to their main site. Its the newest version. I have found AHK to be a bit slow on my machine. While AHK L is not. Its a wonderful version.
I feel the reason most use other boxer tools. Is because scripting becomes daunting to them. Though it gives you a sense of accomplishment, when you roll your own code for your own use. And truthfully compared to all the other free applications around AHK / AHK L. Is far superior, and can do just as well and often times better. Just not everything is so easily found. Google is your friend.
aasi888
09-21-2012, 11:14 PM
AHK L. Never heard of that one. I guess I gotta have a look at it.
vBulletin® v4.2.2, Copyright ©2000-2025, Jelsoft Enterprises Ltd.