 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Vinthian Guest
|
Posted: Sun May 11, 2008 4:57 pm Post subject: Dynamic Hotkeys |
|
|
I've been searching around the forums for a while and picked up a few things, but this one is stumping me. I'm trying to remap the Inventory hotkeys for Warcraft III from numpad to TYGHBN setup. (for test). There's another part of the code where I use Gui, Hotkey to set some of these variables, but this part is where it's giving me errors.
| Code: |
;Settings
#SingleInstance force
#HotkeyInterval 0
#InstallKeybdHook
#UseHook On
#MaxThreads 20
SetBatchLines, -1
SetKeyDelay , -1, -1
#Persistent
NUM1 := B
NUM2 := N
NUM4 := G
NUM5 := H
NUM7 := T
NUM8 := Y
enhotkeys := True
;Hotkeys
Hotkey, %NUM1%, numpad1, On
return
Hotkey, %NUM2%, numpad2, On
return
Hotkey, %NUM4%, numpad4, On
return
Hotkey, %NUM5%, numpad5, On
return
Hotkey, %NUM7%, numpad7, On
return
Hotkey, %NUM8%, numpad8, On
return
numpad1:
if (WinActive, Warcraft III && enhotkeys == True)
{
Send {Numpad1}
} else {
Send %A_ThisHotKey%
}
return
numpad2:
if (WinActive, Warcraft III && enhotkeys == True)
{
Send {Numpad2}
} else {
Send %A_ThisHotKey%
}
return
numpad4:
if (WinActive, Warcraft III && enhotkeys == True)
{
Send {Numpad4}
} else {
Send %A_ThisHotKey%
}
return
numpad5:
if (WinActive, Warcraft III && enhotkeys == True)
{
Send {Numpad5}
} else {
Send %A_ThisHotKey%
}
return
numpad7:
if (WinActive, Warcraft III && enhotkeys == True)
{
Send {Numpad7}
} else {
Send %A_ThisHotKey%
}
return
numpad8:
if (WinActive, Warcraft III && enhotkeys == True)
{
Send {Numpad8}
} else {
Send %A_ThisHotKey%
}
return
|
Problems:
1) If you run the script, it gives you a Error: "" is not a valid key name.
2) When not in the Warcraft III screen, it outputs g as capitalized G.
3) The label just don't work in Warcraft III. For some reason, the hotkeys aren't being assigned.
Any help would be appreciated.  |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 753 Location: London, UK
|
Posted: Sun May 11, 2008 4:59 pm Post subject: |
|
|
| Code: | NUM1 := "B"
NUM2 := "N"
NUM4 := "G"
NUM5 := "H"
NUM7 := "T"
NUM8 := "Y" |
That should sort the first error out.
Full edited:
| Code: | ;Settings
#SingleInstance force
#HotkeyInterval 0
#InstallKeybdHook
#UseHook On
#MaxThreads 20
SetBatchLines, -1
SetKeyDelay , -1, -1
#Persistent
NUM1 := "B"
NUM2 := "N"
NUM4 := "G"
NUM5 := "H"
NUM7 := "T"
NUM8 := "Y"
enhotkeys := True
Hotkey, IfWinActive,Warcraft III
;Hotkeys
Hotkey, %NUM1%, numpad1, On
Hotkey, %NUM2%, numpad2, On
Hotkey, %NUM4%, numpad4, On
Hotkey, %NUM5%, numpad5, On
Hotkey, %NUM7%, numpad7, On
Hotkey, %NUM8%, numpad8, On
numpad1:
numpad2:
numpad4:
numpad5:
numpad7:
numpad8:
Send,{%a_thislabel%}
REturn |
_________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
Vinthian Guest
|
Posted: Sun May 11, 2008 5:24 pm Post subject: |
|
|
Thanks a lot for your help Superfraggle, but now when I incorporate your code into my full script, it doesn't work. I think I'm assigning my variable in the wrong way. Or something is wrong with the code structure. I'm still new to AutoHotKey scripting, so any more help would be appreciated!
| Code: |
;Settings
#SingleInstance force
#HotkeyInterval 0
#InstallKeybdHook
#UseHook On
#MaxThreads 20
SetBatchLines, -1
SetKeyDelay , -1, -1
#Persistent
;Variables
ShowAHp := True
ShowEHp := True
DWK := True
EQC := True
NUM1 := 1
NUM2 := 2
NUM4 := 4
NUM5 := 5
NUM7 := 7
NUM8 := 8
enhotkeys := True
tab := 1
;Quick Command Variables
QCVF5 := "-di"
QCVF6 := "-rd"
QCVF7 := "-ma"
QCVF8 := "-apm"
;Ini
ifExist, %A_WorkingDir%\dotahotkeys.ini
{
IniRead, ShowAHP, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowAHP
IniRead, ShowEHP, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowEHP
IniRead, DQK, %A_WorkingDir%\dotahotkeys.ini, Settings, DWK
IniRead, EQC, %A_WorkingDir%\dotahotkeys.ini, Settings, EQC
IniRead, enhotkeys, %A_WorkingDir%\dotahotkeys.ini, Settings, enhotkeys
IniRead, NUM1, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM1
IniRead, NUM2, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM2
IniRead, NUM4, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM4
IniRead, NUM5, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM5
IniRead, NUM7, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM7
IniRead, NUM8, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM8
IniRead, QCVF5, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF5
IniRead, QCVF6, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF6
IniRead, QCVF7, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF7
IniRead, QCVF8, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF8
} else {
IniWrite, %ShowAHP%, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowAHP
IniWrite, %ShowEHP%, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowEHP
IniWrite, %DWK%, %A_WorkingDir%\dotahotkeys.ini, Settings, DWK
IniWrite, %EQC%, %A_WorkingDir%\dotahotkeys.ini, Settings, EQC
IniWrite, %enhotkeys%, %A_WorkingDir%\dotahotkeys.ini, Settings, enhotkeys
IniWrite, %NUM1%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM1
IniWrite, %NUM2%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM2
IniWrite, %NUM4%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM4
IniWrite, %NUM5%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM5
IniWrite, %NUM7%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM7
IniWrite, %NUM8%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM8
IniWrite, %QCVF5%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF5
IniWrite, %QCVF6%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF6
IniWrite, %QCVF7%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF7
IniWrite, %QCVF8%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF8
}
;Menu
Menu, tray, tip, Dota Hot Keys
Menu, tray, NoStandard
Menu, tray, DeleteAll
Menu, tray, add, showahp
Menu, tray, Rename, showahp, Show Ally HP
Menu, tray, add, showehp
Menu, tray, Rename, showehp, Show Enemy HP
Menu, tray, add
Menu, tray, add, dwk
Menu, tray, Rename, dwk, Disable Windows Key
Menu, tray, add
Menu, tray, add, eqc
Menu, tray, Rename, eqc, Enable Quick Commands
Menu, tray, add, editqc
Menu, tray, Rename, editqc, Edit Quick Commands
Menu, tray, add, enhotkeys
Menu, tray, Rename, enhotkeys, Enable Hotkeys
Menu, tray, add, edithk
Menu, tray, Rename, edithk, Edit Hotkeys
Menu, tray, add
Menu, tray, add, Help
Menu, tray, add, About
Menu, tray, add
Menu, tray, add, Pause
Menu, tray, add, Exit
Menu, tray, Icon,,, 1
if (showahp == true)
Menu, tray, check, Show Ally HP
if (showehp == true)
Menu, tray, check, Show Enemy HP
if (dqk == true)
Menu, tray, check, Disable Windows Key
if (eqc == true)
Menu, tray, check, Enable Quick Commands
if (enhotkeys == true)
Menu, tray, check, Enable Hotkeys
return
Hotkey, IfWinActive, Warcraft III
;Hotkeys
Hotkey, %NUM1%, numpad1, On
Hotkey, %NUM2%, numpad2, On
Hotkey, %NUM4%, numpad4, On
Hotkey, %NUM5%, numpad5, On
Hotkey, %NUM7%, numpad7, On
Hotkey, %NUM8%, numpad8, On
numpad1:
numpad2:
numpad4:
numpad5:
numpad7:
numpad8:
Send,{%a_thislabel%}
REturn
;Settings GUI
settings:
Gui, +Default -MinimizeBox -MaximizeBox
if (tab == 2)
{
Gui, Add, Text, x8 y13 w20 h20 , 1
Gui, Add, Text, x108 y13 w20 h20 , 2
Gui, Add, Text, x8 y43 w20 h20 , 4
Gui, Add, Text, x108 y43 w20 h20 , 5
Gui, Add, Text, x8 y73 w20 h20 , 7
Gui, Add, Text, x108 y73 w20 h20 , 8
Gui, Add, Hotkey, vNUM1 x26 y10 w70 h20 , %NUM1%
Gui, Add, Hotkey, vNUM2 x126 y10 w70 h20 , %NUM2%
Gui, Add, Hotkey, vNUM4 x26 y40 w70 h20 , %NUM4%
Gui, Add, Hotkey, vNUM5 x126 y40 w70 h20 , %NUM5%
Gui, Add, Hotkey, vNUM7 x26 y70 w70 h20 , %NUM7%
Gui, Add, Hotkey, vNUM8 x126 y70 w70 h20 , %NUM8%
Gui, Add, Button, x6 y100 w90 h20 , OK
Gui, Add, Button, x106 y100 w90 h20 , Cancel
} else {
Gui, Add, Edit, vQCVF5 x6 y30 w90 h20 , %QCVF5%
Gui, Add, Edit, vQCVF6 x106 y30 w90 h20 , %QCVF6%
Gui, Add, Edit, vQCVF7 x6 y70 w90 h20 , %QCVF7%
Gui, Add, Edit, vQCVF8 x106 y70 w90 h20 , %QCVF8%
Gui, Add, Text, x6 y10 w30 h20 , F5
Gui, Add, Text, x106 y10 w30 h20 , F6
Gui, Add, Text, x6 y50 w30 h20 , F7
Gui, Add, Text, x106 y50 w30 h20 , F8
Gui, Add, Button, x6 y100 w90 h20 , OK
Gui, Add, Button, x106 y100 w90 h20 , Cancel
}
Gui, Show, h133 w208, Settings
Return
ButtonOK:
Gui, Submit
IniWrite, %ShowAHP%, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowAHP
IniWrite, %ShowEHP%, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowEHP
IniWrite, %DWK%, %A_WorkingDir%\dotahotkeys.ini, Settings, DWK
IniWrite, %EQC%, %A_WorkingDir%\dotahotkeys.ini, Settings, EQC
IniWrite, %enhotkeys%, %A_WorkingDir%\dotahotkeys.ini, Settings, enhotkeys
IniWrite, %NUM1%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM1
IniWrite, %NUM2%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM2
IniWrite, %NUM4%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM4
IniWrite, %NUM5%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM5
IniWrite, %NUM7%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM7
IniWrite, %NUM8%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM8
IniWrite, %QCVF5%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF5
IniWrite, %QCVF6%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF6
IniWrite, %QCVF7%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF7
IniWrite, %QCVF8%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF8
Gui, Destroy
return
ButtonCancel:
GuiClose:
GuiEscape:
Gui, Cancel
Gui, Destroy
return
lwin::
ifWinActive, Warcraft III
{
if (DWK == True)
{
return
} else {
Send {lwin}
return
}
} else {
Send {lwin}
return
}
rwin::
if (DWK == True)
{
if (DWK == True)
{
return
} else {
Send {rwin}
return
}
} else {
Send {rwin}
return
}
;Toggle Ally HP
showahp:
if (ShowAHP == True)
{
ShowAHp := False
Menu, tray, uncheck, Show Ally HP
}
else if (ShowAHP == False)
{
ShowAHp := True
Menu, tray, check, Show Ally HP
}
return
;Toggle Enemy HP
showehp:
if (ShowEHP == True)
{
ShowEHp := False
Menu, tray, uncheck, Show Enemy HP
}
else if (ShowEHP == False)
{
ShowEHp := True
Menu, tray, check, Show Enemy HP
}
return
;Toggle Disable Windows Key
dwk:
if (DWK == True)
{
DWK := False
Menu, tray, uncheck, Disable Windows Key
}
else if (DWK == False)
{
DWK := True
Menu, tray, check, Disable Windows Key
}
return
;Toggle Enable Quick Commands
eqc:
if (EQC == True)
{
EQC := False
Menu, tray, uncheck, Enable Quick Commands
}
else if (EQC== False)
{
EQC := True
Menu, tray, check, Enable Quick Commands
}
return
;Quick Command Hotkeys
F5::
ifWinActive, Warcraft III
{
if (EQC == True)
{
Send {Enter}
Send %QCVF5%
Send {Enter}
return
} else {
Send {F5}
return
}
} else {
Send {F5}
}
F6::
ifWinActive, Warcraft III
{
if (EQC == True)
{
Send {Enter}
Send %QCVF6%
Send {Enter}
return
} else {
Send {F6}
return
}
} else {
Send {F5}
}
F7::
ifWinActive, Warcraft III
{
if (EQC == True)
{
Send {Enter}
Send %QCVF7%
Send {Enter}
return
} else {
Send {F7}
return
}
} else {
Send {F5}
}
F8::
ifWinActive, Warcraft III
{
if (EQC == True)
{
Send {Enter}
Send %QCVF8%
Send {Enter}
return
} else {
Send {F8}
return
}
} else {
Send {F5}
}
return
editqc:
tab := 1
GoSub, settings
Return
edithk:
tab := 2
GoSub, settings
return
enhotkeys:
if (enhotkeys == True)
{
Menu, tray, uncheck, Enable Hotkeys
enhotkeys := False
} else {
Menu, tray, check, Enable Hotkeys
enhotkeys := True
}
return
;Help Window
Help:
Gui, 2:+Default -MinimizeBox -MaximizeBox
Gui, 2:Add, Text, x10 y10 w200 h20 , Press Ctrl+Cap Locks while Ingame to
Gui, 2:Add, Text, x10 y25 w200 h20 , activate the HP Bars.
Gui, 2:Add, Text, x10 y40 w200 h20 , Quick Commands:
Gui, 2:Add, Text, x10 y55 w200 h20 , F5 = %QCVF5%
Gui, 2:Add, Text, x10 y70 w200 h20 , F6 = %QCVF6%
Gui, 2:Add, Text, x10 y85 w200 h20 , F7 = %QCVF7%
Gui, 2:Add, Text, x10 y100 w200 h20 , F8 = %QCVF8%
Gui, 2:Show, h125 w200, Help
return
;About Window
About:
Gui, 3:+Default -MinimizeBox -MaximizeBox
Gui, 3:Add, Picture, x10 y15 w32 h32 , %A_WorkingDir%\%A_ScriptName%
Gui, 3:Add, Text, x50 y10 w200 h20 , Dota Hot Keys v1.04b
Gui, 3:Add, Text, x50 y25 w200 h20 , By Vinthian (vinthian@gmail.com)
Gui, 3:Add, Text, x50 y40 w200 h20 , Version Date: May 10`, 2008
Gui, 3:Show, h65 w220, About
return
;Pause
Pause:
Menu, tray, togglecheck, Pause
Pause, Toggle
return
Exit:
ExitApp
return
OnExit, ExitSub
return
ExitSub:
ExitApp
;Ingame Activation
^Capslock::
ifWinActive, Warcraft III
{
if (ShowAHP == True)
{
Send, {[ Down}
}
if (ShowEHP == True)
{
Send, {] Down}
}
}
return
|
|
|
| Back to top |
|
 |
Vinthian
Joined: 11 May 2008 Posts: 14 Location: USA
|
Posted: Mon May 12, 2008 1:46 am Post subject: |
|
|
| Bump, Anyone? |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 753 Location: London, UK
|
Posted: Mon May 12, 2008 1:55 am Post subject: |
|
|
You just said it doesn't work. What exactly doesn't work what does/doesn't it do. _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
Vinthian
Joined: 11 May 2008 Posts: 14 Location: USA
|
Posted: Mon May 12, 2008 3:07 am Post subject: |
|
|
| When assigned a "custom" dynamic hotkey that is set by the user via a gui, the hotkeys don't work ingame. For example, I set it to the TYGHBN setup I was testing earlier and they didn't work. Everything else works fine, it's just the hotkeys for the inventory. |
|
| Back to top |
|
 |
Z Gecko Guest
|
Posted: Mon May 12, 2008 3:29 am Post subject: |
|
|
| Quote: | | When assigned a "custom" dynamic hotkey that is set by the user via a gui, the hotkeys don't work ingame. |
If that means, Hotkeys made as a HK-Label ( e.g. #n:: ) work,
you could have your script create anther one, containing only the hotkeys, an then run it. But itīs just a workaround  |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 753 Location: London, UK
|
Posted: Mon May 12, 2008 3:37 am Post subject: |
|
|
| Code: | ;Settings
#SingleInstance force
#HotkeyInterval 0
#InstallKeybdHook
#UseHook On
#MaxThreads 20
SetBatchLines, -1
SetKeyDelay , -1, -1
#Persistent
;Variables
ShowAHp := True
ShowEHp := True
DWK := True
EQC := True
NUM1 := 1
NUM2 := 2
NUM4 := 4
NUM5 := 5
NUM7 := 7
NUM8 := 8
enhotkeys := True
tab := 1
;Quick Command Variables
QCVF5 := "-di"
QCVF6 := "-rd"
QCVF7 := "-ma"
QCVF8 := "-apm"
;Ini
ifExist, %A_WorkingDir%\dotahotkeys.ini
{
IniRead, ShowAHP, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowAHP
IniRead, ShowEHP, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowEHP
IniRead, DQK, %A_WorkingDir%\dotahotkeys.ini, Settings, DWK
IniRead, EQC, %A_WorkingDir%\dotahotkeys.ini, Settings, EQC
IniRead, enhotkeys, %A_WorkingDir%\dotahotkeys.ini, Settings, enhotkeys
IniRead, NUM1, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM1
IniRead, NUM2, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM2
IniRead, NUM4, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM4
IniRead, NUM5, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM5
IniRead, NUM7, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM7
IniRead, NUM8, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM8
IniRead, QCVF5, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF5
IniRead, QCVF6, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF6
IniRead, QCVF7, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF7
IniRead, QCVF8, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF8
} else {
IniWrite, %ShowAHP%, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowAHP
IniWrite, %ShowEHP%, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowEHP
IniWrite, %DWK%, %A_WorkingDir%\dotahotkeys.ini, Settings, DWK
IniWrite, %EQC%, %A_WorkingDir%\dotahotkeys.ini, Settings, EQC
IniWrite, %enhotkeys%, %A_WorkingDir%\dotahotkeys.ini, Settings, enhotkeys
IniWrite, %NUM1%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM1
IniWrite, %NUM2%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM2
IniWrite, %NUM4%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM4
IniWrite, %NUM5%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM5
IniWrite, %NUM7%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM7
IniWrite, %NUM8%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM8
IniWrite, %QCVF5%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF5
IniWrite, %QCVF6%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF6
IniWrite, %QCVF7%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF7
IniWrite, %QCVF8%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF8
}
;Menu
Menu, tray, tip, Dota Hot Keys
Menu, tray, NoStandard
Menu, tray, DeleteAll
Menu, tray, add, showahp
Menu, tray, Rename, showahp, Show Ally HP
Menu, tray, add, showehp
Menu, tray, Rename, showehp, Show Enemy HP
Menu, tray, add
Menu, tray, add, dwk
Menu, tray, Rename, dwk, Disable Windows Key
Menu, tray, add
Menu, tray, add, eqc
Menu, tray, Rename, eqc, Enable Quick Commands
Menu, tray, add, editqc
Menu, tray, Rename, editqc, Edit Quick Commands
Menu, tray, add, enhotkeys
Menu, tray, Rename, enhotkeys, Enable Hotkeys
Menu, tray, add, edithk
Menu, tray, Rename, edithk, Edit Hotkeys
Menu, tray, add
Menu, tray, add, Help
Menu, tray, add, About
Menu, tray, add
Menu, tray, add, Pause
Menu, tray, add, Exit
Menu, tray, Icon,,, 1
if (showahp == true)
Menu, tray, check, Show Ally HP
if (showehp == true)
Menu, tray, check, Show Enemy HP
if (dqk == true)
Menu, tray, check, Disable Windows Key
if (eqc == true)
Menu, tray, check, Enable Quick Commands
if (enhotkeys == true){
Menu, tray, check, Enable Hotkeys
GoSub,Inithotkeys
}
return
InitHotkeys:
Hotkey, IfWinActive,Warcraft III
;Hotkeys
Hotkey, %NUM1%, numpad1, On
Hotkey, %NUM2%, numpad2, On
Hotkey, %NUM4%, numpad4, On
Hotkey, %NUM5%, numpad5, On
Hotkey, %NUM7%, numpad7, On
Hotkey, %NUM8%, numpad8, On
Hotkey, IfWinActive,
REturn
Hotkeysoff:
Hotkey, IfWinActive,Warcraft III
Hotkey, %NUM1%, Off
Hotkey, %NUM2%, Off
Hotkey, %NUM4%, Off
Hotkey, %NUM5%, Off
Hotkey, %NUM7%, Off
Hotkey, %NUM8%, Off
Hotkey, IfWinActive,
Return
numpad1:
numpad2:
numpad4:
numpad5:
numpad7:
numpad8:
Send,{%a_thislabel%}
REturn
;Settings GUI
settings:
Gui, +Default -MinimizeBox -MaximizeBox
if (tab == 2)
{
Gui, Add, Text, x8 y13 w20 h20 , 1
Gui, Add, Text, x108 y13 w20 h20 , 2
Gui, Add, Text, x8 y43 w20 h20 , 4
Gui, Add, Text, x108 y43 w20 h20 , 5
Gui, Add, Text, x8 y73 w20 h20 , 7
Gui, Add, Text, x108 y73 w20 h20 , 8
Gui, Add, Hotkey, vNUM1 x26 y10 w70 h20 , %NUM1%
Gui, Add, Hotkey, vNUM2 x126 y10 w70 h20 , %NUM2%
Gui, Add, Hotkey, vNUM4 x26 y40 w70 h20 , %NUM4%
Gui, Add, Hotkey, vNUM5 x126 y40 w70 h20 , %NUM5%
Gui, Add, Hotkey, vNUM7 x26 y70 w70 h20 , %NUM7%
Gui, Add, Hotkey, vNUM8 x126 y70 w70 h20 , %NUM8%
Gui, Add, Button, x6 y100 w90 h20 , OK
Gui, Add, Button, x106 y100 w90 h20 , Cancel
} else {
Gui, Add, Edit, vQCVF5 x6 y30 w90 h20 , %QCVF5%
Gui, Add, Edit, vQCVF6 x106 y30 w90 h20 , %QCVF6%
Gui, Add, Edit, vQCVF7 x6 y70 w90 h20 , %QCVF7%
Gui, Add, Edit, vQCVF8 x106 y70 w90 h20 , %QCVF8%
Gui, Add, Text, x6 y10 w30 h20 , F5
Gui, Add, Text, x106 y10 w30 h20 , F6
Gui, Add, Text, x6 y50 w30 h20 , F7
Gui, Add, Text, x106 y50 w30 h20 , F8
Gui, Add, Button, x6 y100 w90 h20 , OK
Gui, Add, Button, x106 y100 w90 h20 , Cancel
}
Gui, Show, h133 w208, Settings
Return
ButtonOK:
Gosub,Hotkeysoff
Gui, Submit
GoSub,InitHotkeys
IniWrite, %ShowAHP%, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowAHP
IniWrite, %ShowEHP%, %A_WorkingDir%\dotahotkeys.ini, HPBars, ShowEHP
IniWrite, %DWK%, %A_WorkingDir%\dotahotkeys.ini, Settings, DWK
IniWrite, %EQC%, %A_WorkingDir%\dotahotkeys.ini, Settings, EQC
IniWrite, %enhotkeys%, %A_WorkingDir%\dotahotkeys.ini, Settings, enhotkeys
IniWrite, %NUM1%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM1
IniWrite, %NUM2%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM2
IniWrite, %NUM4%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM4
IniWrite, %NUM5%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM5
IniWrite, %NUM7%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM7
IniWrite, %NUM8%, %A_WorkingDir%\dotahotkeys.ini, Hotkeys, NUM8
IniWrite, %QCVF5%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF5
IniWrite, %QCVF6%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF6
IniWrite, %QCVF7%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF7
IniWrite, %QCVF8%, %A_WorkingDir%\dotahotkeys.ini, QCommands, QCVF8
Gui, Destroy
return
ButtonCancel:
GuiClose:
GuiEscape:
Gui, Cancel
Gui, Destroy
return
lwin::
ifWinActive, Warcraft III
{
if (DWK == True)
{
return
} else {
Send {lwin}
return
}
} else {
Send {lwin}
return
}
rwin::
if (DWK == True)
{
if (DWK == True)
{
return
} else {
Send {rwin}
return
}
} else {
Send {rwin}
return
}
;Toggle Ally HP
showahp:
if (ShowAHP == True)
{
ShowAHp := False
Menu, tray, uncheck, Show Ally HP
}
else if (ShowAHP == False)
{
ShowAHp := True
Menu, tray, check, Show Ally HP
}
return
;Toggle Enemy HP
showehp:
if (ShowEHP == True)
{
ShowEHp := False
Menu, tray, uncheck, Show Enemy HP
}
else if (ShowEHP == False)
{
ShowEHp := True
Menu, tray, check, Show Enemy HP
}
return
;Toggle Disable Windows Key
dwk:
if (DWK == True)
{
DWK := False
Menu, tray, uncheck, Disable Windows Key
}
else if (DWK == False)
{
DWK := True
Menu, tray, check, Disable Windows Key
}
return
;Toggle Enable Quick Commands
eqc:
if (EQC == True)
{
EQC := False
Menu, tray, uncheck, Enable Quick Commands
}
else if (EQC== False)
{
EQC := True
Menu, tray, check, Enable Quick Commands
}
return
;Quick Command Hotkeys
F5::
ifWinActive, Warcraft III
{
if (EQC == True)
{
Send {Enter}
Send %QCVF5%
Send {Enter}
return
} else {
Send {F5}
return
}
} else {
Send {F5}
}
F6::
ifWinActive, Warcraft III
{
if (EQC == True)
{
Send {Enter}
Send %QCVF6%
Send {Enter}
return
} else {
Send {F6}
return
}
} else {
Send {F5}
}
F7::
ifWinActive, Warcraft III
{
if (EQC == True)
{
Send {Enter}
Send %QCVF7%
Send {Enter}
return
} else {
Send {F7}
return
}
} else {
Send {F5}
}
F8::
ifWinActive, Warcraft III
{
if (EQC == True)
{
Send {Enter}
Send %QCVF8%
Send {Enter}
return
} else {
Send {F8}
return
}
} else {
Send {F5}
}
return
editqc:
tab := 1
GoSub, settings
Return
edithk:
tab := 2
GoSub, settings
return
enhotkeys:
if (enhotkeys == True)
{
Menu, tray, uncheck, Enable Hotkeys
enhotkeys := False
Gosub,Hotkeysoff
} else {
Menu, tray, check, Enable Hotkeys
enhotkeys := True
Gosub,initHotkeys
}
return
;Help Window
Help:
Gui, 2:+Default -MinimizeBox -MaximizeBox
Gui, 2:Add, Text, x10 y10 w200 h20 , Press Ctrl+Cap Locks while Ingame to
Gui, 2:Add, Text, x10 y25 w200 h20 , activate the HP Bars.
Gui, 2:Add, Text, x10 y40 w200 h20 , Quick Commands:
Gui, 2:Add, Text, x10 y55 w200 h20 , F5 = %QCVF5%
Gui, 2:Add, Text, x10 y70 w200 h20 , F6 = %QCVF6%
Gui, 2:Add, Text, x10 y85 w200 h20 , F7 = %QCVF7%
Gui, 2:Add, Text, x10 y100 w200 h20 , F8 = %QCVF8%
Gui, 2:Show, h125 w200, Help
return
;About Window
About:
Gui, 3:+Default -MinimizeBox -MaximizeBox
Gui, 3:Add, Picture, x10 y15 w32 h32 , %A_WorkingDir%\%A_ScriptName%
Gui, 3:Add, Text, x50 y10 w200 h20 , Dota Hot Keys v1.04b
Gui, 3:Add, Text, x50 y25 w200 h20 , By Vinthian (vinthian@gmail.com)
Gui, 3:Add, Text, x50 y40 w200 h20 , Version Date: May 10`, 2008
Gui, 3:Show, h65 w220, About
return
;Pause
Pause:
Menu, tray, togglecheck, Pause
Pause, Toggle
return
Exit:
ExitApp
return
OnExit, ExitSub
return
ExitSub:
ExitApp
;Ingame Activation
^Capslock::
ifWinActive, Warcraft III
{
if (ShowAHP == True)
{
Send, {[ Down}
}
if (ShowEHP == True)
{
Send, {] Down}
}
}
return |
Works for me, _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
Vinthian
Joined: 11 May 2008 Posts: 14 Location: USA
|
Posted: Mon May 12, 2008 4:12 am Post subject: |
|
|
| Thanks again Superfraggle, but 1 more issue to address. When I set one of them to "None" (blank variable) it gives the Error: "" is not a valid key name. How would I check if there is a blank variable? (one that i don't want to use) Like if i wanted to not assign a hotkey for a numpad button. |
|
| Back to top |
|
 |
Vinthian
Joined: 11 May 2008 Posts: 14 Location: USA
|
Posted: Mon May 12, 2008 1:10 pm Post subject: |
|
|
I tried using the following, but it doesn't seem to work,
| Code: |
InitHotkeys:
Hotkey, IfWinActive,Warcraft III
;Hotkeys
if (NUM1 <> )
Hotkey, %NUM1%, numpad1, On
Hotkey, %NUM2%, numpad2, On
Hotkey, %NUM4%, numpad4, On
Hotkey, %NUM5%, numpad5, On
Hotkey, %NUM7%, numpad7, On
Hotkey, %NUM8%, numpad8, On
Hotkey, IfWinActive,
REturn
Hotkeysoff:
Hotkey, IfWinActive,Warcraft III
if (NUM1 <> )
Hotkey, %NUM1%, Off
Hotkey, %NUM2%, Off
Hotkey, %NUM4%, Off
Hotkey, %NUM5%, Off
Hotkey, %NUM7%, Off
Hotkey, %NUM8%, Off
Hotkey, IfWinActive,
Return
numpad1:
numpad2:
numpad4:
numpad5:
numpad7:
numpad8:
Send,{%a_thislabel%}
REturn
|
only edited to show for the NUM1 hotkey for this example, but ingame, the hotkey doesn't work anymore. What am I doing wrong? |
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 753 Location: London, UK
|
Posted: Mon May 12, 2008 1:39 pm Post subject: |
|
|
| Code: | if (NUM1 != ""){
Hotkey, %NUM1%, numpad1, On
} ; The brackets are not needed however I prefer them for clarity, and in case extra code is needed. |
_________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
Vinthian
Joined: 11 May 2008 Posts: 14 Location: USA
|
Posted: Mon May 12, 2008 1:46 pm Post subject: |
|
|
| Quote: | | Empty strings: To specify an empty string in an expression, use an empty pair of quotes. For example, the statement if (MyVar <> "") would be true if MyVar is not blank. However, in a traditional-if, a pair of empty quotes is treated literally. For example, the statement if MyVar = "" is true only if MyVar contains an actual pair of quotes. Thus, to check if a variable is blank with a traditional-if, use = or <> with nothing on the right side as in this example: if Var = |
|
|
| Back to top |
|
 |
Superfraggle
Joined: 02 Nov 2004 Posts: 753 Location: London, UK
|
Posted: Mon May 12, 2008 2:02 pm Post subject: |
|
|
To quote your quote
| Quote: | | To specify an empty string in an expression, use an empty pair of quotes |
We are using expression mode, not traditional mode. _________________ Steve F AKA Superfraggle
http://r.yuwie.com/superfraggle |
|
| Back to top |
|
 |
Vinthian
Joined: 11 May 2008 Posts: 14 Location: USA
|
Posted: Mon May 12, 2008 2:41 pm Post subject: |
|
|
| Many many thanks for your help Superfraggle! It has been invaluable to me for completing this project! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|