How to make hotkey tool
Posted 10-15-2011 at 09:59 AM by AucT
Hello guys! Im going to tell u how to create simple autohotkey script. It will be some advanced version of EasyPack. It will include 3 steps.
1. Creating Basic Tool
2. Adding interface
3. Adding special functions
NOTE: Autohotkey script will work only in windows.
You will need:
1) Autohotkey
2) some text editor
I used variables h1-h7 for future purposes (detecting same variable).
I would like all hotkeys iniread and hotkey via loop, but for better understanding I will make loop only for item hotkeys and for pause script I will do it manually. To do that we will read our ini file, and if key not a blank - we will create hotkey
This is how to do in the loop. Mb it is a bit advanced for you now.
Here how to simply make hotkey
Final code for step 1:
1. Creating Basic Tool
2. Adding interface
3. Adding special functions
NOTE: Autohotkey script will work only in windows.
You will need:
1) Autohotkey
2) some text editor
Step 1 : Creating Basic Tool
To create autohotkey script simply rightlick mouse - create autohotkey script or save text file in .ahk extension.Header
First of all we need make some changes in the options of the script so in the header we will put this preferences:Code:
#SingleInstance force #HotkeyInterval 0 #InstallKeybdHook #UseHook On #MaxThreads 25 SetBatchLines, -1 SetKeyDelay , -1, -1 SetDefaultMouseSpeed, 0 SetMouseDelay, -1 Process, priority, , High SetWorkingDir %A_ScriptDir% #NoEnv #ifWinActive, ahk_class Warcraft III
Setting Keys
Now we will read the .ini file. If it doesnt exist we will get default hotkeys (alt+q; alt+w, alt+a, alt+s, alt+z, alt+x).I used variables h1-h7 for future purposes (detecting same variable).
I would like all hotkeys iniread and hotkey via loop, but for better understanding I will make loop only for item hotkeys and for pause script I will do it manually. To do that we will read our ini file, and if key not a blank - we will create hotkey
This is how to do in the loop. Mb it is a bit advanced for you now.
Code:
loop {
IniRead, h%A_Index%, %A_WorkingDir%\EasyPack2.ini, Inventory, item%A_Index%, %A_Space%
if % h%A_Index%
Hotkey, % h%A_Index%, a%A_Index%
if A_Index=6
break
}
Code:
IniRead, h7, %A_WorkingDir%\EasyPack2.ini, Other, Pause, Home if h7 Hotkey, %h7%, a7
Basic labels
Here our labels. I used names a - action so in next steps we can easily put it all to the loopCode:
a1:
send {vk67}
return
a2:
send {vk68}
return
a3:
send {vk64}
return
a4:
send {vk65}
return
a5:
send {vk61}
return
a6:
send {vk62}
return
a7:
suspend
return
Total Comments 0




























