AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using Variables from a GUI Hotkey for a Hotkey

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
CoronaCA



Joined: 02 Jul 2005
Posts: 2

PostPosted: Sat Jul 02, 2005 7:43 pm    Post subject: Using Variables from a GUI Hotkey for a Hotkey Reply with quote

I am not trying to write a very complicated program but I have ran into a rather annoying snag and I can not figure it out. I'm a very novice programmer, that is if you even consider HTML a programming language, and I needs some help.

Here is what I'm trying to accomplish:
I am using GUI Hotkeys to capture two pressed buttons. Once you click Load, it reads those GUI Hotkeys and then creates a Hotkey to remap the two keys that you pushed. However when I run the script I get this error: %Bk11% is not a valid key name within a hotkey label.

Anyways here is the code:
Code:

; Generated using SmartGUI Creator 3.5

Gui, Add, Button, x26 y377 w70 h30,Load   
Gui, Add, Button, x106 y377 w70 h30,Reset   
Gui, Add, Button, x186 y377 w70 h30,Exit   
Gui, Add, Text, x6 y47 w70 h30 +Center,Hot Key #1
Gui, Add, Text, x6 y87 w70 h30 +Center,Hot Key #2 
Gui, Add, Text, x6 y127 w70 h30 +Center,Hot Key #3 
Gui, Add, Text, x6 y167 w70 h30 +Center,Hot Key #4 
Gui, Add, Text, x6 y207 w70 h30 +Center,Hot Key #5 
Gui, Add, Text, x6 y247 w70 h30 +Center,Hot Key #6 
Gui, Add, Text, x6 y287 w70 h30 +Center,Hot Key #7 
Gui, Add, Text, x6 y327 w70 h30 +Center,Hot Key #8
Gui, Add, Hotkey, x86 y47 w70 h30 vBk11, Bk11
Gui, Add, Hotkey, x166 y47 w70 h30 vBk12, Bk12   
Gui, Add, Hotkey, x86 y87 w70 h30 vBk21, Bk21
Gui, Add, Hotkey, x166 y87 w70 h30 vBk22, Bk22
Gui, Add, Hotkey, x86 y127 w70 h30 vBk31, Bk31
Gui, Add, Hotkey, x166 y127 w70 h30 vBk32, Bk32
Gui, Add, Hotkey, x86 y167 w70 h30 vBk41, Bk41
Gui, Add, Hotkey, x166 y167 w70 h30 vBk42, Bk42
Gui, Add, Hotkey, x86 y207 w70 h30 vBk51, Bk51
Gui, Add, Hotkey, x166 y207 w70 h30 vBk52, Bk52
Gui, Add, Hotkey, x86 y247 w70 h30 vBk61, Bk61
Gui, Add, Hotkey, x166 y247 w70 h30 vBk62, Bk62
Gui, Add, Hotkey, x86 y287 w70 h30 vBk71, Bk71
Gui, Add, Hotkey, x166 y287 w70 h30 vBk72, Bk72
Gui, Add, Hotkey, x86 y327 w70 h30 vBk81, Bk81
Gui, Add, Hotkey, x166 y327 w70 h30 vBk82, Bk82
Gui, Show, x270 y110 h445 w311, Generated using SmartGUI Creator 3.5
Return

ButtonLoad:
GuiControlGet, Bk11
GuiControlGet, Bk12
If Bk11 and Bk12
{
   %Bk11%::Send %Bk12% ; First Binding
}
GuiControlGet, Bk21
GuiControlGet, Bk22
If Bk21 and Bk22
{
   %Bk21%::Send %Bk22% ; Second Binding
}

GuiControlGet, Bk31
GuiControlGet, Bk32
If Bk31 and Bk32
{
   %Bk31%::Send %Bk32% ; Third Binding
}

GuiControlGet, Bk41
GuiControlGet, Bk42
If Bk41 and Bk42
{
   %Bk41%::Send %Bk42% ; Fourth Binding
}

GuiControlGet, Bk51
GuiControlGet, Bk52
If Bk51 and Bk52
{
   %Bk51%::Send %Bk52% ; Fifth Binding
}

GuiControlGet, Bk61
GuiControlGet, Bk62
If Bk61 and Bk62
{
   %Bk61%::Send %Bk62% ; Sixth Binding
}

GuiControlGet, Bk71
GuiControlGet, Bk72
If Bk71 and Bk72
{
   %Bk71%::Send %Bk72% ; Seventh Binding
}

GuiControlGet, Bk81
GuiControlGet, Bk82
If Bk81 and Bk82
{
   %Bk81%::Send %Bk82% ; Eighth Binding
}

Return

ButtonReset:
Return

ButtonExit:
ExitApp


Also do you guys know of a reset code for the reset button?
Thanks for help in advance,
Ron.
Back to top
View user's profile Send private message
dijiyd



Joined: 01 Apr 2004
Posts: 90
Location: Philippines

PostPosted: Sat Jul 02, 2005 10:17 pm    Post subject: Reply with quote

"Hotkey" is used for dynamic hotkeys.

Try:

Code:

GuiControlGet, Bk31
GuiControlGet, Bk32
If Bk31 and Bk32
{
   Hotkey, %Bk31%, FirstBinding
}


then adding something like:

Code:

FirstBinding:
Send, %Bk32%
return


Edit:
Oh yeah, it may happen that your hotkeys only work when your window is open, because if you exit, the script closes along with the hotkeys. Maybe you could try hiding the window instead. (I say "may", because I was too lazy to test it. I really haven't done that much on GUI stuff. Smile )
Back to top
View user's profile Send private message
CoronaCA



Joined: 02 Jul 2005
Posts: 2

PostPosted: Sun Jul 03, 2005 2:03 am    Post subject: Reply with quote

Worked like a charm, thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group