Edit: sry, mine and freedies post crossed, so sry, if the following is alittlebit redundant
Jeah, to get into HotkeyNet is not as simply as installing KC or ISBoxer, but for the first steps, I recommend looking at the sample-scripts on hotkeynet.com and reading the HKN-Guide in this forum (ok, this is a little self promoting, but I think its quite helpfull).
You are right, some more advanced thinks like Templates (and Virtual Buttons) aren'T covered in it, but I wrote it more as a beginner guide to get a 'normal' setup.
The best thing to look for informations on the more advanced stuff is the HKN-Command-Reference (to get an Ideawhat commands are available) and the HKN-Forum. Normaly if you have a specific problem and ask there for help, you will find some nice people who are willing to give it to you...
But back to Templates:
The general idea of templates in HKN is, to give a way to simplify some definitions, that occure quite often, and have a very similar structure.
One relay simple example:
-Lets say you want to define multiple keys (1,2) which sends the key to w1 and always 'w' to w2 (and you don't know about keylists
).
This could be done by defining a Template like:
Code:
<Template blubb>
<Sendlabel w1>
<Key %trigger%>
<Sendlabel w2>
<Key w>
<EndTemplate>
and calling it like:
Code:
<Hotkey 1>
<ApplyTemplate blubb>
<Hotkey 2>
<ApplyTemplate blubb>
What HotkeyNet now does, is simply when finding the '<ApplyTemplate blubb>' look if there a definition for the template with the name 'blubb' specified by <Template blubb> and if it finds such a definition, it substitutes the <ApplyTemplate blubb> with the text defined between <Template blubb> and <EndTemplate>.
So on runtime, the tow Hotkey definitions would look like:
Code:
<Hotkey 1>
<Sendlabel w1>
<Key %trigger%>
<Sendlabel w2>
<Key w>
<Hotkey 2>
<Sendlabel w1>
<Key %trigger%>
<Sendlabel w2>
<Key w>
This is a real simple working example, but if this would be all templates could do, it wouldn't be so usefull.
The next component of templates are parameters. With parameters you can, when calling a template with <ApplyTemplate> give the call some specific values, which then are used in the template.
For this the calling syntax is:
<ApplyTemplate name parameter1 parameter2 parameter3 ..>
in the Template itself every occurence of %PARAMETER_NUMBER% is than replaced with the text for the parameter.
Short example:
<ApplyTemplate test This is a test>
in the Template specified by <Template test> every occurence of:
- %1% is replaced with This
- %2% is replaced with is
- %3% is replaced with a
- %4% is replaced with test
so the following
Code:
<Template sendkey>
<Hotkey %1%>
<SendLabel %2%>
<Key %3%>
<EndTemplate>
<ApplyTemplate 1 w1 u>
would create the following Hotkey:
Code:
<Hotkey 1>
<Sendlabel w1>
<Key u>
Now, one last important thing:
Normaly HKN seperates parameters by a space.
If you want to use a phrase as an Parameter which containes spaces (like f.e. a path) you have to capsulate it in "" like "This is a test".
So to come back to the original code:
<Template If>
<If MouseIsOverWindowRect %1% %2%>
<SendLabel %3%>
<Key %4%>
<EndTemplate>
<Template Else>
<If MouseIsOverWindowRect %1% %2%>
<SendLabel %3%>
<Key %4%>
<EndTemplate>
<Hotkey ScrollLockOn LButton>
<ApplyTemplate If "WoW5" "88 299 125 58" "w3" "Numpad1">
<ApplyTemplate ElseIf "WoW5" "88 367 125 58" "w3" "Numpad2">
<ApplyTemplate ElseIf "WoW5" "88 433 125 58" "w3" "Numpad3">
<Else>
<SendFocusWin>
<ClickMouse down %Trigger%>
Lets have a look at what <ApplyTemplate If "WoW5" "88 299 125 58" "w3" "Numpad1"> does:
it replaces the <ApplayTemplate If ...> with the block between <Template If> and <EndTemplate> and substitutes:
- %1% with WoW5
- %2% with 88 299 125 58
- %3% with w3
- %4% with Numpad1
So the code in HKN would look like:
<Hotkey ScrollLockOn LButton>
<If MouseIsOverWinRect WoW5 88 299 125 58>
<Sendlabel w3>
<Key Numpad1>
<ApplyTemplate ElseIf "WoW5" "88 367 125 58" "w3" "Numpad2">
<ApplyTemplate ElseIf "WoW5" "88 433 125 58" "w3" "Numpad3">
<Else>
<SendFocusWin>
<ClickMouse down %Trigger%>
( And of course <ApplyTemplate ElseIf ..> would then be replaced with the text of <Template ElseIf> )
I hope I could bring some light in defining/using templates and some of the 'fog' went away 
Connect With Us