Hi everyone,
I'm trying to define hotkeys on the fly for a game. Th euser have the possibility to edit his Custom button from his Joystick.
But then I need to take this info and initiate the hotkey.
Example :
User define the button A to be 1joy3 (using gui text field) thus this name is stored in the variable KeyA
I need to be able to do something like :
%KeyA%::DoSomething()
How can I do that ? if even possible ?
Hotkey dynamic definition %Joykey%::something()
Re: Hotkey dynamic definition %Joykey%::something()
No, you cannot do that. Instead, you need to use the Hotkey command. I don't have time to explain it right now, so I'll just point you to the help file (it's rather hard to find it if you don't know where it is--it doesn't seem to appear in the table of contents and a search brings so much others stuff it's hard to find). Look here.
Re: Hotkey dynamic definition %Joykey%::something()
The general answer for these questions has always been No; but with AutoHotkey_H, then it actually is possible. You can find an exact example of what you are trying to do here
Re: Hotkey dynamic definition %Joykey%::something()
Thanks guyz,
AHK_H is something I'll need to look into, but not yet, still a bit to high for my level.
I made a workaround with GetKeyState loops for the moment. And focus on the other big issues.
EDit :
I feel dumb everytime this happens to me, but english isn't that easy with all the words with double sens with french ones. Well, I finally understood how to use these "label" out of Gui context.
And it's just as simple as to write:
with the label somewhere:
AHK_H is something I'll need to look into, but not yet, still a bit to high for my level.
EDit :
I feel dumb everytime this happens to me, but english isn't that easy with all the words with double sens with french ones. Well, I finally understood how to use these "label" out of Gui context.
And it's just as simple as to write:
Code: Select all
Hotkey, %foo%, myLabelName
Code: Select all
myLabelName:
something to do...
return
Re: Hotkey dynamic definition %Joykey%::something()
I still have a hard time understanding how to disable hotkeys defined with Hotkey, XXX, label command.
Contextual hotkey to be precise. Those you create with a Hotkey, IfWinActive, before.
Must be something I don't get with the way I place those command in the code and Not enough, if any example of this case in documentation
Contextual hotkey to be precise. Those you create with a Hotkey, IfWinActive, before.
Must be something I don't get with the way I place those command in the code and Not enough, if any example of this case in documentation
Re: Hotkey dynamic definition %Joykey%::something()
Sorry for my bad english. Not sure if this is what you need
Pressing the 2 key you disable the hotkey 1.
Greetings!
Code: Select all
Hotkey, ~1,ratonix
Hotkey, ~2,anula
return
ratonix:
Msgbox Insert shutdown command here after testing
return
anula:
Hotkey, ~1,nada
return
nada:
Sleep,1
return
esc::
ExitApp
return
Greetings!
Everything is possible!
Re: Hotkey dynamic definition %Joykey%::something()
Code: Select all
MyContextSensitiveHotkey := "Esc"
EnableHotkeys:
Hotkey, IfWinActive, MyWindow ; start of context-sensitive hotkeys
Hotkey, %MyContextSensitiveHotkey%, MyHotkeyLabel, On
Hotkey, IfWinActive ; end of context-sensitive hotkeys
Return
DisableHotkeys:
Hotkey, IfWinActive, MyWindow ; start of context-sensitive hotkeys
Hotkey, %MyContextSensitiveHotkey%, Off
Hotkey, IfWinActive ; end of context-sensitive hotkeys
Return
MyHotkeyLabel:
MsgBox, You pressed %A_ThisHotkey%!
Return
Who is online
Users browsing this forum: Bing [Bot], Lpanatt and 323 guests