View Full Version : Hotkeynet region click script help.
I am trying to get this squared away. Here is what I have but when Scroll Lock is on you can't use left click anywhere or for anything but clicking that region.
//================================================== ==============
// SAMPLE SCRIPT FOR TWO WOW'S ON ONE PC
//
// Instructions: Copy this entire script (all the blue writing
// on gray background including comments). Save it in a file.
// Load it into HotkeyNet.
//
// Toggle the scroll lock key to turn hotkeys off and on. (You
// can change this if you want, just like you can change
// everything else with HotkeyNet.)
//
// Requires HotkeyNet build 147 or higher.
//
// For more info, go to www.hotkeynet.com
//================================================== ==============
//-----------------------------------------------------------
// PRESS CTRL R TO RENAME WOW'S IF YOU LAUNCH THEM MANUALLY
//-----------------------------------------------------------
<Hotkey ScrollLockOn Ctrl R>
<SendPC local>
<RenameWin "World of Warcraft" WoW1>
<RenameWin "World of Warcraft" WoW2>
<RenameWin "World of Warcraft" WoW3>
<RenameWin "World of Warcraft" WoW4>
<RenameWin "World of Warcraft" WoW5>
//-----------------------------------------------------------
// SUBROUTINE TO Position Windows for 5 boxing.
//-----------------------------------------------------------
<Command ResizeAndPosition>
<SendPC Local>
<SendWin %1%>
<SetWinSize 1680 1050>
<SetWinPos 0 0>
<SendWinM %2%>
<SetWinSize 840 525>
<SetWinPos 1680 0>
<SendWinM %3%>
<SetWinSize 840 525>
<SetWinPos 1680 525>
<SendWinM %4%>
<SetWinSize 840 525>
<SetWinPos 2520 0>
<SendWinM %5%>
<SetWinSize 840 525>
<SetWinPos 2520 525>
//-----------------------------------------------------------
// SUBROUTINE TO LAUNCH AND RENAME A COPY OF WOW.
//-----------------------------------------------------------
<Command LaunchAndRename>
<SendPC %1%>
<Run %2%>
<RenameTargetWin %3%>
<RemoveWinFrame>
//-----------------------------------------------------------
// HOTKEY TO LAUNCH AND RENAME BOTH WOW'S.
//-----------------------------------------------------------
<Hotkey ScrollLockOn Alt Ctrl L>
<LaunchAndRename Local "d:\WoW5\WoW.exe"WoW5>
<LaunchAndRename Local "d:\WoW4\WoW.exe"WoW4>
<LaunchAndRename Local "d:\WoW3\WoW.exe"WoW3>
<LaunchAndRename Local "d:\WoW2\WoW.exe"WoW2>
<LaunchAndRename Local "d:\WoW1\WoW.exe"WoW1>
<ResizeAndPosition WoW1 WoW2 WoW3 WoW4 WoW5>
//-----------------------------------------------------------
// DEFINE MAIL LABELS FOR SENDING KEY STROKES
//-----------------------------------------------------------
<Label w1 Local SendWinM WoW1>
<Label w2 Local SendWinM WoW2>
<Label w3 Local SendWinM WoW3>
<Label w4 Local SendWinM WoW4>
<Label w5 Local SendWinM WoW5>
//----------------------------------------------------------------
//Window Switching
//----------------------------------------------------------------
<Hotkey F8>
<ResizeAndPosition WoW1 WoW2 WoW3 WoW4 WoW5>
<SendLabel w1, w2, w3, w4, w5>
<Key F8>
<Hotkey F9>
<ResizeAndPosition WoW2 WoW1 WoW3 WoW4 WoW5>
<SendLabel w1, w2, w3, w4, w5>
<Key F9>
<Hotkey F10>
<ResizeAndPosition WoW3 WoW2 WoW1 WoW4 WoW5>
<SendLabel w1, w2, w3, w4, w5>
<Key F10>
<Hotkey F11>
<ResizeAndPosition WoW4 WoW2 WoW3 WoW1 WoW5>
<SendLabel w1, w2, w3, w4, w5>
<Key F11>
<Hotkey F12>
<ResizeAndPosition WoW5 WoW2 WoW3 WoW4 WoW1>
<SendLabel w1, w2, w3, w4, w5>
<Key F12>
//--healing by click-----
<Hotkey ScrollLockOn LButton>
<If MouseIsOverWindowRect WoW5 0 291 146 48>
<SendLabel w3>
<Key Numpad1>
//-----------------------------------------------------------
// DEFINE HOTKEYS FOR ALL KEY COMBINATIONS THAT WILL GET
// SENT TO BOTH WOWS. ADD MORE KEY COMBO'S IF YOU WANT.
//-----------------------------------------------------------
<Hotkey ScrollLockOn A-Z, 0-9, F1-F7, Plus, Minus, Numpad1-Numpad9>
<SendLabel w1, w2, w3, w4, w5>
<Key %Trigger%>
//-----------------------------------------------------------
// DEFINE MOVEMENT KEYS THAT WILL GET SENT TO BOTH WOW'S.
// ADD MORE KEYS IF YOU WANT.
//-----------------------------------------------------------
<MovementHotkey ScrollLockOn up, down, left, right>
<SendLabel w1, w2, w3, w4, w5>
<Key %Trigger%>
//-----------------------------------------------------------
// BROADCAST MOUSE CLICKS. HOLD DOWN OEM3 (ON U.S. KEYBOARDS,
// THAT'S THE SQUIGGLE KEY IN UPPPER LEFT CORNER) WHEN YOU
// WANT TO BROADCAST.
//-----------------------------------------------------------
<UseKeyAsModifier Oem3>
<Hotkey ScrollLockOn Oem3 LButton, MButton, RButton, Button4, Button5>
<SendLabel w1, w2, w3, w4, w5>
<ClickMouse %TriggerMainKey%>
Thanks for any help.
olipcs
09-07-2009, 03:14 PM
you could try the following code for the left click:
<Hotkey ScrollLockOn LButton>
<If MouseIsOverWindowRect WoW5 0 291 146 48>
<SendLabel w3>
<Key Numpad1>
<Else>
<SendFocusWin>
<ClickMouse LButton Down Screen>
<HotkeyUp ScrollLockOn LButton>
<If MouseIsNotOverWindowRect WoW5 0 291 146 48>
<SendFocusWin>
<ClickMouse LButton Up Screen>
Abend
09-07-2009, 06:58 PM
I think you are missing a PassThrough (http://www.hotkeynet.com/ref/passthrough.html) there. Something like:
<Hotkey LButton>
<If ActiveWinIs wow5>
<PassThrough>
<EndIf>
<If MouseIsOverWindowRect wow5 0 291 146 48>
<SendLabel w3>
<Key Numpad1>
<EndIf>
Freddie
09-07-2009, 07:21 PM
You would think <PassThrough> could be used that way but it can't.
No matter where you write <PassThrough> in a hotkey definition, it always executes before anything else in the hotkey including <If>.
Therefore, PassThrough is not subject to If and the above hotkey executes like this:
<Hotkey LButton>
<PassThrough>
<If MouseIsOverWindowRect wow5 0 291 146 48>
<SendLabel w3>
<Key Numpad1>
<EndIf>
If you want the trigger to pass through conditionally, you have to emulate that behavior with <SendFocusWin> like Olipcs did.
Edit: The reason for this strange behavior is that PassThrough must be executed by the keyboard hook almost instantaneously, but <If> and everything else in the hotkey definition may not get evaluted for many seconds depending on how many hotkey definitions are buffered. This will probably be handled in a more intuitive way in HotkeyNet 2.
Well did my first real testing of this in ZF last night worked ok I'm having mouse problems now. What happens is sometimes when I'm clicking on mains(WoW5) or a slaves screen the pointer jumps back to the center of the mains screen and hadn't clicked anything. Below is my script(thanks again for the help) I see one thing I;m going to try and move when I get home and thats :
//--healing by click-----
<Hotkey ScrollLockOn LButton>
<If MouseIsOverWindowRect WoW5 88 299 125 58>
<SendLabel w3>
<Key Numpad1>
<Else>
<SendFocusWin>
<ClickMouse LButton Down Screen>
<HotkeyUp ScrollLockOn LButton>
<If MouseIsNotOverWindowRect WoW5 88 299 125 58>
<SendFocusWin>
<ClickMouse LButton Up Screen>
<If MouseIsOverWindowRect WoW5 88 367 125 58>
<SendLabel w3>
<Key Numpad2>
<Else>
<SendFocusWin>
<ClickMouse LButton Down Screen>
<If MouseIsNotOverWindowRect WoW5 88 367 125 58>
<SendFocusWin>
<ClickMouse LButton Up Screen>
To:
//--healing by click-----
<Hotkey ScrollLockOn LButton>
<If MouseIsOverWindowRect WoW5 88 299 125 58>
<SendLabel w3>
<Key Numpad1>
<Else>
<SendFocusWin>
<ClickMouse LButton Down Screen>
<If MouseIsOverWindowRect WoW5 88 367 125 58>
<SendLabel w3>
<Key Numpad2>
<Else>
<SendFocusWin>
<ClickMouse LButton Down Screen>
<If MouseIsOverWindowRect WoW5 88 433 125 58>
<SendLabel w3>
<Key Numpad3>
<Else>
<SendFocusWin>
<ClickMouse LButton Down Screen>
<If MouseIsOverWindowRect WoW5 88 499 125 58>
<SendLabel w3>
<Key Numpad4>
<Else>
<SendFocusWin>
<ClickMouse LButton Down Screen>
<HotkeyUp ScrollLockOn LButton>
<If MouseIsNotOverWindowRect WoW5 88 299 125 58>
<SendFocusWin>
<ClickMouse LButton Up Screen>
<If MouseIsNotOverWindowRect WoW5 88 367 125 58>
<SendFocusWin>
<ClickMouse LButton Up Screen>
<If MouseIsNotOverWindowRect WoW5 88 433 125 58>
<SendFocusWin>
<ClickMouse LButton Up Screen>
<If MouseIsNotOverWindowRect WoW5 88 499 125 58>
<SendFocusWin>
<ClickMouse LButton Up Screen>
But if this is just a "deal with" issue(which from how well everything else works with this program when its not an uneducated operator I don't see) then thanks for the heads up and saving me the time chasing my tail.
rahven32
09-08-2009, 11:16 PM
Not sure if you have to but I believe you want <Else IF yada yada after your first if statement.
Here's what I use maybe it can give you some idea's or whatever. I do use a ftl setup so doesnt matter which screen im on. If i hit the spot on any the screen it will heal or whatever i have it set on.
//--------------------------------------------------------------
//Leftclick Mouse over healing
//--------------------------------------------------------------
<Hotkey LButton>
//------------------------------------------------------
// Bore
// -----------------------------------------------------
// /cast [mod:LCtrl,target=Bore] lesser healing wave
// /cast [mod:LShift,target=Bore] healing wave
// /cast [mod:LAlt,target=Bore] Riptide
// /cast [target=Bore] Chain Heal
//------------------------------------------------------
// Top half of unit frame
//------------------------------------------------------
<If MouseIsOverWindowRect WoW1 768 1049 74 68>
<SendLabel w2>
<Key LShift G>
<Else If MouseIsOverWindowRect WoW2 768 1049 74 68>
<SendLabel w2>
<Key LShift G>
<Else If MouseIsOverWindowRect WoW3 768 1049 74 68>
<SendLabel w2>
<Key LShift G>
<Else If MouseIsOverWindowRect WoW4 768 1049 74 68>
<SendLabel w2>
<Key LShift G>
<Else If MouseIsOverWindowRect WoW5 768 1049 74 68>
<SendLabel w2>
<Key LShift G>
//------------------------------------------------------
// Bottom half of unit frame
//------------------------------------------------------
<Else If MouseIsOverWindowRect WoW1 768 1134 74 66>
<SendLabel w2>
<Key G>
<Else If MouseIsOverWindowRect WoW2 768 1134 74 66>
<SendLabel w2>
<Key G>
<Else If MouseIsOverWindowRect WoW3 768 1134 74 66>
<SendLabel w2>
<Key G>
<Else If MouseIsOverWindowRect WoW4 768 1134 74 66>
<SendLabel w2>
<Key G>
<Else If MouseIsOverWindowRect WoW5 768 1134 74 66>
<SendLabel w2>
<Key G>
//------------------------------------------------------
//Sedi
// /cast [mod:LCtrl,target=Sedi] lesser healing wave
// /cast [mod:LShift,target=Sedi] healing wave
// /cast [mod:LAlt,target=Sedi] Riptide
// /cast [target=Sedi] Chain Heal
//------------------------------------------------------
// Top half of unit frame
//------------------------------------------------------
<Else If MouseIsOverWindowRect WoW1 846 1049 74 68>
<SendLabel w2>
<Key LShift T>
<Else If MouseIsOverWindowRect WoW2 846 1049 74 68>
<SendLabel w2>
<Key LShift T>
<Else If MouseIsOverWindowRect WoW3 846 1049 74 68>
<SendLabel w2>
<Key LShift T>
<Else If MouseIsOverWindowRect WoW4 846 1049 74 68>
<SendLabel w2>
<Key LShift T>
<Else If MouseIsOverWindowRect WoW5 846 1049 74 68>
<SendLabel w2>
<Key LShift T>
//------------------------------------------------------
// Bottom half of unit frame
//------------------------------------------------------
<Else If MouseIsOverWindowRect WoW1 846 1134 74 66>
<SendLabel w2>
<Key T>
<Else If MouseIsOverWindowRect WoW2 846 1134 74 66>
<SendLabel w2>
<Key T>
<Else If MouseIsOverWindowRect WoW3 846 1134 74 66>
<SendLabel w2>
<Key T>
<Else If MouseIsOverWindowRect WoW4 846 1134 74 66>
<SendLabel w2>
<Key T>
<Else If MouseIsOverWindowRect WoW5 846 1134 74 66>
<SendLabel w2>
<Key T>Thats for 2 of my characters. I have a block like that for each one. For left, right, and middle click.
Then at the end of each click I have the normal mouse use. I do have my unit frames vertical so I use above the name for one thing and below for another.
<Else> //--Defaults mouse to normal when you dont click a predetermined cordinate
<SendFocusWin>
<ClickMouse Down %Trigger%> //--Use to allow mouse look with left click
<HotkeyUp LButton> //--Use to release left click when mouse looking
<SendFocusWin>
<ClickMouse Up %Trigger%>
Ok thanks Rahven I will update mine and give it a try and give mine more depth never thought of using some of the stuff you did.
Freddie
09-09-2009, 01:38 AM
In addition to what Rahven said, templates can come in handy here. When you follow his advice, you can shorten the amount of typing with templates:
<Hotkey ScrollLockOn LButton>
<ApplyTemplate IfTemplate WoW5 88 299 125 58 w3 Numpad1>
<ApplyTemplate ElseIfTemplate WoW5 88 367 125 58 w3 Numpad2>
<ApplyTemplate ElseIfTemplate WoW5 88 433 125 58 w3 Numpad3>
... etc. ....
<Else
<SendFocusWin>
<ClickMouse down %Trigger%>
You also have to write the templates. I'll leave that as an exercise for the reader! :)
rahven32
09-09-2009, 01:46 AM
I really do need to figure out templates someday cause he's right the way I did it was a TON of typing lol.
So let me see...
<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%>
I'm was really confused about the hole: %(number)% and what that is for seeing this helped some I think. Question also is the " " need to signify whats in the %% or is it just there location in the string? Also is this script language like that of like C++ or is this all in its own? I ask so that I might be able to pick up a How-To-For-Dummies book to get more info on stuff be for I ask.
I found what I think is right here Rahven
http://www.hotkeynet.com/phpBB3/viewtopic.php?f=8&t=1075&p=6944&hilit=templates#p6944 (holy crap what a set-up)
Man-O-Man everytime I see an example of someones set-up and script I wish I had the knowledge to see what they have in the script... And "they" say Multi-Boxxing is easy....
Thanks again All
rahven32
09-10-2009, 01:14 AM
I had zero knowledge about scripts when I started. I really wanted some of the more advanced stuff that keyclone couldn't handle. So I sat down and figured it out by trial and error. There's still a lot I don't know (like templates) but just by keeping at it I learned it.
That's my best advice to ya. Just keep trying different things and eventually you get better at it. It actually even starts to make sense lol. I can't actually "read' a script yet without a little bit of reference but I'm pretty close to being able to! Also whenever I found something that really gave me trouble Freddie was always great about helping or pointing in the right direction.
Freddie
09-10-2009, 03:46 AM
I can't actually "read' a script yet...
Here's a really useful trick. (At least I think so.) After you load the script, click "Show loaded hotkeys." The program will show you the hotkeys that it makes from your templates. The hotkeys are what really count -- they are the things that actually get loaded -- and they are much easier to read than templates.
Question also is the " " need to signify whats in the %%
Quotation marks are only needed if they enclose text that contains spaces and you want HotkeyNet to think of the enclosed text as a single thing.
You need them here for the arguments that contain spaces. If you had written things slightly differently you wouldn't have needed them.
For example, you could have written this:
<Template If>
<If MouseIsOverWindowRect %1% %2% %3% %4% %5%>
<SendLabel %6%>
<Key %7%>
<EndTemplate>
See the difference? I wrote seven %% symbols instead of three like you did. This allows me to apply the template without quotes like this:
<ApplyTemplate If WoW5 88 299 125 58 w3 Numpad1>
Also is this script language like that of like C++ or is this all in its own?
I should have made the language like C for exactly this reason. It would be easier for people to learn. (C is a subset of C++.)
However I was in an experimental mood when I designed HotkeyNet 1's language and as a result, the script language is bizarre and unlike anything I've ever heard of. :)
I've learned my lesson and designed the new script language in HotkeyNet 2 so it resembles C as closely as possible.
But we're stuck with the old script language for now, until HKN2 is ready.
olipcs
09-10-2009, 04:22 AM
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 (http://www.dual-boxing.com/showthread.php?t=16177) 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:
<Template blubb>
<Sendlabel w1>
<Key %trigger%>
<Sendlabel w2>
<Key w>
<EndTemplate>
and calling it like:
<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:
<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
<Template sendkey>
<Hotkey %1%>
<SendLabel %2%>
<Key %3%>
<EndTemplate>
<ApplyTemplate 1 w1 u>
would create the following Hotkey:
<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 ;)
Freddie
09-10-2009, 04:29 AM
That's a great explanation of templates, Olipcs. It would be nice to reprint that in a reference section somewhere, either here or on HKN's site.
olipcs
09-10-2009, 04:31 AM
Thanks, that you like it.
How about I add it to the HKN-Guide here, and if you want you add it to the reference/whatever-section on HKN.com ?
Freddie
09-10-2009, 04:32 AM
Sounds good! :)
Yeah that helped a lot and will for others I know because first looking at the template instructions I couldn't seem to grasp that %#% was what you wanted sent. but thanks again guys.
Freddie
09-10-2009, 03:39 PM
When HotkeyNet sees "ApplyTemplate" it copies the template.
As it copies the template, it replaces %#% with the piece of text that you specified.
The piece of text can be anything. It doesn't have to be something that gets sent.
http://hotkeynet.com/p/templates.html
vBulletin® v4.2.2, Copyright ©2000-2025, Jelsoft Enterprises Ltd.