mouse button not recognized in gui hotkey
mouse button not recognized in gui hotkey
hey guys, when i press XButton1 or XButton2 or WheelUp or WheelDown in interface "GUI, Add, Hotkey" is not recognized as a Hotkey.
is there any way I can make the GUI recognize the mouse as hotkey buttons?
is there any way I can make the GUI recognize the mouse as hotkey buttons?
Re: mouse button not recognized in gui hotkey
Gui, Add, Hotkey documentation wrote:The Hotkey control has limited capabilities. For example, it does not support mouse/joystick hotkeys or Win (LWin and RWin). One way to work around this is to provide one or more checkboxes as a means for the user to enable extra modifiers such as Win.
Besides the checkboxes for modifiers as suggested in the documentation quoted above, you could list other hotkeys such as the mouse buttons you mentioned in a DropDownList or other control.
Re: mouse button not recognized in gui hotkey
Code: Select all
#if MouseIsOverHotkeyControl()
WheelUp::
...
return
WheelDown::
...
return
...
#if
MouseIsOverHotkeyControl() {
MouseGetPos...
...
return true or false
}
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
Re: mouse button not recognized in gui hotkey
I was wondering what would be the best way to do this...boiler wrote: ↑27 Jan 2022, 17:41Gui, Add, Hotkey documentation wrote:The Hotkey control has limited capabilities. For example, it does not support mouse/joystick hotkeys or Win (LWin and RWin). One way to work around this is to provide one or more checkboxes as a means for the user to enable extra modifiers such as Win.
Besides the checkboxes for modifiers as suggested in the documentation quoted above, you could list other hotkeys such as the mouse buttons you mentioned in a DropDownList or other control.
maybe create a "Tab" in the GUI with a "RemapKeys Mouse"?
or else, always put a DropDownList next to each "Gui, Hotkey"?
what would be your idea?
Re: mouse button not recognized in gui hotkey
This is how I have done it before, with checkboxes for all of the modifier keys, a hotkey control for the main hotkey, and a dropdown list for mouse buttons and other keys not covered by the hotkey control:
Re: mouse button not recognized in gui hotkey
WOOOW, SUPER !!!
could you share your script?
Re: mouse button not recognized in gui hotkey
It’s part of a much larger proprietary script, and if I pull that part out, it will just be some non-working controls. It wouldn’t be any more helpful than the picture and not worth the effort.
Re: mouse button not recognized in gui hotkey
I already finished hehe, thank you very much. would you have any tips to give me when building my GUI? I have a basic notion.
for example, I really liked putting the text in "Bold". it was a great idea
Code: Select all
Gui, font, bold
Gui, Add, Text, x50 y30 w25 h15 Center, Shift
Gui, Add, CheckBox, x55 y50 w25 h15 Center, ;first checkbox Shift
Gui, font, bold
Gui, Add, Text, x80 y30 w25 h15 Center, Ctrl
Gui, Add, CheckBox, x85 y50 w25 h15 Center, ;first checkbox Ctrl
Gui, font, bold
Gui, Add, Text, x110 y30 w25 h15 Center, Alt
Gui, Add, CheckBox, x115 y50 w25 h15 , ;first checkbox Alt
Gui, font, bold
Gui, Add, Text, x140 y30 w60 h15 Center, Spell
Gui, font, norm
Gui, Add, Hotkey, x140 y48 w60 h20 , ;first Hotkey Spell
Gui, font, bold
Gui, Add, Text, x205 y30 w60 h15 Center, Potions
Gui, font, norm
Gui, Add, Hotkey, x205 y48 w60 h20 , ;first Hotkey Potion
Gui, Add, Text, x275 y50 w15 h15 Center, `or
Gui, font, bold
Gui, Add, Text, x295 y30 w80 h15 Center, Mouse/Others
Gui, font, norm
Gui, Add, DropDownList, x295 y48 w80 h20 r4, WheelUp|WheelDown|XButton1|XButton2
;GUI SHOW
Gui, Show, x409 y220 h379 w479, New GUI Window
Return
GuiClose:
ExitApp
Re: mouse button not recognized in gui hotkey
Unless I am totally missing what you are trying to do, I can’t see how what you have laid out makes sense logically. It looks like you want one hotkey for spells and another for potions, correct? If so, then how would you define one hotkey to be Ctrl+F1 and another to be Shift+Right Mouse Button? The way you have it, which one would the drop down list apply to? How could you choose separate items from the drop down list for both? How could you choose different modifier keys for each?
You would need separate rows for each like in the picture I showed. Each row is used to assign a hotkey for a different function. I just cut off the labels to the left of the controls in my picture. That’s where you would label one row “Spells” and another one “Potions.”
You would need separate rows for each like in the picture I showed. Each row is used to assign a hotkey for a different function. I just cut off the labels to the left of the controls in my picture. That’s where you would label one row “Spells” and another one “Potions.”
Re: mouse button not recognized in gui hotkey
it was just a draft heheboiler wrote: ↑27 Jan 2022, 23:58Unless I am totally missing what you are trying to do, I can’t see how what you have laid out makes sense logically. It looks like you want one hotkey for spells and another for potions, correct? If so, then how would you define one hotkey to be Ctrl+F1 and another to be Shift+Right Mouse Button? The way you have it, which one would the drop down list apply to? How could you choose separate items from the drop down list for both? How could you choose different modifier keys for each?
You would need separate rows for each like in the picture I showed. Each row is used to assign a hotkey for a different function. I just cut off the labels to the left of the controls in my picture. That’s where you would label one row “Spells” and another one “Potions.”
Re: mouse button not recognized in gui hotkey
I won't need to use the "CheckBox" of Alt, Shift, Control.
I created a function to "format" the GUI Hotkey string so that ControlSend understands, take a look:
would change anything?
Code: Select all
#SingleInstance, Force
Gui, Add, Hotkey, w90 h20 vHotkeyGuiButton, +!F5
Gui, Show, w200 h200 Center,
GuiControlGet, HotkeyGuiButton
fix_Hotkey_to_ControlSend(HotkeyGuiButton, HotkeyControlSend)
;ControlSend,, %HotkeyControlSend%, ahk_id 0x010101
MsgBox, HotkeyGuiButton is: %HotkeyGuiButton% `nHotkeyControlSend is: %HotkeyControlSend%
RETURN
; returns a string correctly to insert into "ControlSend"
fix_Hotkey_to_ControlSend(HotkeyGuiButton, ByRef HotkeyControlSend) {
;Global
;StringGetPos, pos, Haystack, %Needle%
ShiftString := "+"
ControlString := "^"
AltString := "!"
PosTransformHotkeyControlSend := 0
;[Search for a String Shift]
StringGetPos, SearchShiftString, HotkeyGuiButton, %ShiftString% ;position start ZERO
if (SearchShiftString >= 0) { ;if found string
PosTransformHotkeyControlSend++ ;usage in transform string
}
;[Search for a String Control]
StringGetPos, SearchControlString, HotkeyGuiButton, %ControlString%
if (SearchControlString >= 0) {
PosTransformHotkeyControlSend++ ;usage in transform string
}
;[Search for a String Alt]
StringGetPos, SearchAltString, HotkeyGuiButton, %AltString%
if (SearchAltString >= 0) {
PosTransformHotkeyControlSend++ ;usage in transform string
}
;[Transform em String]
if (PosTransformHotkeyControlSend > 0) {
HotkeyControlSend := SubStr(HotkeyGuiButton, 1, PosTransformHotkeyControlSend) . "{" . SubStr(HotkeyGuiButton, PosTransformHotkeyControlSend+1, StrLen(HotkeyGuiButton)) . "}"
return
} else {
HotkeyControlSend := "{" . HotkeyGuiButton . "}"
return
}
}
Re: mouse button not recognized in gui hotkey
Yes, I would use the return value of the function instead of ByRef, and I would use RegEx:
Code: Select all
#SingleInstance, Force
Gui, Add, Hotkey, w90 h20 vHotkeyGuiButton, +!F5
Gui, Show, w200 h200 Center,
GuiControlGet, HotkeyGuiButton
HotkeyControlSend := fix_Hotkey_to_ControlSend(HotkeyGuiButton)
;ControlSend,, %HotkeyControlSend%, ahk_id 0x010101
MsgBox, HotkeyGuiButton is: %HotkeyGuiButton% `nHotkeyControlSend is: %HotkeyControlSend%
RETURN
; returns a string correctly to insert into "ControlSend"
fix_Hotkey_to_ControlSend(hotkeyGB) {
return RegExReplace(hotkeyGB, "([!+^]*)(.+)", "$1{$2}")
}
Re: mouse button not recognized in gui hotkey
wtf?! its a magicboiler wrote: ↑28 Jan 2022, 06:29Yes, I would use the return value of the function instead of ByRef, and I would use RegEx:Code: Select all
#SingleInstance, Force Gui, Add, Hotkey, w90 h20 vHotkeyGuiButton, +!F5 Gui, Show, w200 h200 Center, GuiControlGet, HotkeyGuiButton HotkeyControlSend := fix_Hotkey_to_ControlSend(HotkeyGuiButton) ;ControlSend,, %HotkeyControlSend%, ahk_id 0x010101 MsgBox, HotkeyGuiButton is: %HotkeyGuiButton% `nHotkeyControlSend is: %HotkeyControlSend% RETURN ; returns a string correctly to insert into "ControlSend" fix_Hotkey_to_ControlSend(hotkeyGB) { return RegExReplace(hotkeyGB, "([!+^]*)(.+)", "$1{$2}") }
I didn't understand how the "Haystack" was used. where can i learn about?
Re: mouse button not recognized in gui hotkey
Ahahah! That is called "experience".boiler wrote: ↑28 Jan 2022, 06:29Code: Select all
fix_Hotkey_to_ControlSend(hotkeyGB) { return RegExReplace(hotkeyGB, "([!+^]*)(.+)", "$1{$2}") }
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.