View Full Version : [HotKeyNet] Advanced HotKeyNet configuration file
papounet
12-04-2009, 12:11 PM
Hi,
Reading those forums have re-ignited my passion for Wow,
I am now trying to set up a dual-box woth 2 shamans, if successful, I will upgrade most probably to 5 box mixed team.
Current hardware is E2180@2.8, 8Gig Ram, 200M Raid0 partition with wow1 and wow2 symlinked to wow directory, 4870 1G0, 1920*1080, win 7
Most probably, I'll switch in a q6600@3.0 if 5-box.
I have selected HKN for its programmability
I have identified 4 addons I am likely to run : JambaDev, Carbonite, OmniCC, Tourguide
I have currently decided to NOT use an additional macro tool (Macaroon would have been nice, but seems unsupported, Domino would havce been the next choice)
Here is the HotKeyNet script I have written from the sample provided on http://hotkeynet.com/ref/sendwinm.html
plus numerous tidbits from this website, in particular from http://www.dual-boxing.com/showthread.php?t=16177 written by olipc.
Please consider my poor contribution as a tribute to all the macro-coders who have provided the seeds of this work
I have most probably made HKN do much more than its author would have though reasonable
Points of Interest:
1. the PIP code is not the fastest, but is the safest I could get,
2. most keys of an international keyboard are identified (please note that even a normal key such a Z on an international keyboard may have a code sitting between Oem keys, better be long and explicit and list the exact keys)
3. I have used one key BrowseBack present on multmedia keyboard to act as another modifer which is not transmitted to the event chain
4. I am creating panels and buttons to display the internal state of HKN (in particular wether HKN is active or Not)
5. I have found a work around for being able to use If-else-end if from within a command
6. For playing multiple toons with same spells and yet saving mana, I have created a modifier key which toggle a one-by-one casting, should be useful to finish off with one spell instead of wasting 5 , this toggle proved a stateful approach to macro casting
7. I am using the panel option use news SendWinS SendWinM
Bugs:
The HKN button is not always refreshed properly from within WOW, It works from within Windows
there is already a work-around the issue<if hotKeyNetIsOn giving delayed results> issue,
Probable Improvments:
- would liketo speed up the refresh of the panels
- would like to work on getting fancy position like diamond shape (but difficult with 2 toons ;-)
- considering how to speed up targetting 2 mobs (one toon each)
Without further ado, here is the code
Part I
//================================================== ==============
// Adjusted SCRIPT FOR 2 WOW'S ON ONE PC
//
// Load it into HotkeyNet.
//
// Toggle the PAUSE key to turn hotkeys off and on.
//
// Requires HotkeyNet build 181 or higher ???
//
// For more info, go to www.hotkeynet.com
//================================================== ==============
//-----------------------------------------------------------
// SUBROUTINE TO LAUNCH AND RENAME A COPY OF WOW.
//-----------------------------------------------------------
<Command LaunchAndRename>
<SendPC %1%>
<Run %2%>
<RenameTargetWin %3%>
<RemoveWinFrame>
<SetAffinity %4%>
//-----------------------------------------------------------
// SUBROUTINE TO Position Windows for 2 boxing. side by side
//-----------------------------------------------------------
<Command ResizeAndPosition>
<SendPC Local>
<SendWinM %1%>
<SetWinRect 0 0 960 1280>
<RemoveWinFrame>
<SendWinM %2%>
<SetWinRect 960 0 960 1280>
<RemoveWinFrame>
//-----------------------------------------
// PRESS <Alt Ctrl M> TO Position Windows for 2 boxing. side by side
//-----------------------------------------
// <Hotkey Alt Ctrl M>
// <ResizeAndPosition WoW1 WoW2>
//----------------------------------------------------------------
// SET PIP CONFIGURATION
// Usage: <SetPip BigWindowName LittleWindowName>
//----------------------------------------------------------------
<Command SetPip>
<TargetWin %1%>
<SetWinPos 0 0>
<SetWinSize 1920 1080>
<SetWinRegion none>
<SetWinRegion 1475 600 320 180>
<TargetWin %2%>
<HideWin>
<SetWinSize 320 180>
<SetWinPos 1475 600>
// <SetForegroundWin>
<ShowWin>
<UpdateWin>
<TargetWin %1%>
<SetForegroundWin>
//-----------------------------------------
// Press < Printscreen> to TOGGLE PIP
//-----------------------------------------
<Hotkey PrintScreen>
<Toggle>
<SetPip WoW1 WoW2>
<Toggle>
<SetPip WoW2 WoW1>
//-----------------------------------------------------------
// PRESS <Alt Ctrl L> TO LAUNCH AND RENAME YOUR WOW WINDOWS while 2 boxing
// Please configure the Path and processor afinitys correctly
//-----------------------------------------------------------
<Hotkey Alt Ctrl L>
<LaunchAndRename Local "I:\wow1\wow.exe" WoW1 1>
<LaunchAndRename Local "I:\wow2\wow.exe" WoW2 2>
//-----------------------------------------------------------
// PRESS <Alt Ctrl R> TO RENAME WOW'S IF YOU LAUNCH THEM MANUALLY
//-----------------------------------------------------------
<Hotkey Alt Ctrl R>
<SendPC local>
<RenameWin "World of Warcraft" WoW1>
<RenameWin "World of Warcraft" WoW2>
//-----------------------------------------------------------
// DEFINE MAIL LABELS FOR SENDING KEY STROKES
//-----------------------------------------------------------
<Label w1 Local SendWinM WoW1>
<Label w2 Local SendWinM WoW2>
papounet
12-04-2009, 12:12 PM
Part II
//-----------------------------------------------------------
// DEFINE HOTKEYS FOR ALL KEY COMBINATIONS THAT WILL GET
// SENT TO BOTH WOWS. ADD MORE KEY COMBO'S IF YOU WANT.
//-----------------------------------------------------------
<KeyList MyList A-Y, 0-9, Plus, Enter, Oem1, Oem3, Oem4, Oem5, Oem6,Oem8, Oem102, Space, Comma, Period, F1-F12, Backspace, MediaPlayPause, MediaStop, MediaPrevTrack, MediaNextTrack, NumLock, Divide, NumpadEnter, Decimal, Numpad0-Numpad9 except A, Z, E, Q, S, D, W ,M ,G ,C ,P ,N ,I ,U ,K>
//
// Minus NOT present on french Keyboard
//
// Oem1 $£
// Oem3 ù%
// Oem4 )° between 0 and =
// Oem5 *µ
// Oem6 ^¨
// Oem8 !§
// Oem102 <>
//
// Keys used within HKN, ARE NOT PASSED
//
// Pause NOT passed-through = Toggle HotKey active or not
// PrintScreen NOT passed-through = PIP
// Multiply (numpad *) NOT Passed-through = formation
// BrowserBack NOT Passed-through = BROADCAST MOUSE CLICKS
// Oem7 ² (little2 above Tab) NOT passed-Through Used for Toogle casting
// BrowserForward NOT passed-through = Internal processing
//
// Keys left active for WOW for all characters
//
// NumLock Toggle AutoRun
// numpad Divide Toggle Run Walk
//
// Keys left active for WOW on character in active window
//
// Oem2 :/ NOT passed-through /=chat
// VolumeUp NOT passed-through = Master Volume Up
// Volume Down NOT passed-through = Master Volume Down
// Home NOT passed-through = Previous View
// End NOT passed-through = Next View
// PgUp NOT passed-through = previous View
// NumpadMinus NOT passed-through = MiniMap Zoom in
// NumpadPlus NOT passed-through = MiniMap Zoom out
// Escape NOT passed-through = GameMenu
// Tab NOT passed-through = NextTarget
// M NOT passed-through = Map / Minimap
// G NOT passed-through = Target Last Hostile
// C NOT passed-through = Toggle Character Pane
// P NOT passed-through = Toggle SpellBook
// N NOT passed-through = Toggle Talent Pane
// I NOT passed-through = Toggle Pet Pane / Pet Book
// U NOT passed-through = Toggle Reputation Pane
// K NOT passed-through = Toggle Skill Pane
<Hotkey MyList; Shift MyList; Alt MyList; Ctrl MyList>
<SendLabel w1, w2>
<Key %Trigger%>
//--------------------------------------------------
// Work around for if-endif not available in command
// an non-existing key will be triggered with DoHotKey
// The issue, HotKeyNet starts with the hotkeys state
// from when last invoked, so have to test state to
// in the end less needed because problem with ToggleHotKey
//--------------------------------------------------
<Hotkey BrowserForward>
<If HotkeysAreOff>
<SetButtonColors ON 0x00FF00 0x0F0F0F>
<SetButtonText ON HKN>
<Else>
<SetButtonColors ON 0x0F0F0F 0x00FF00 >
<SetButtonText ON off>
<endif>
<TargetWin HKN>
<AlwaysOnTop on>
<UpdateWin>
//---------------------------------------------
// Visual indicator because no scroll lock led
// Display green HKN button if HotkeyNet is forwarding keys
// Visual indicator of next toon to fire if toggle cast is active
// at boot up, state is displayed unknown "???"
//----------------------------------------------
<Command AutoExec>
<CreatePanel HKN 10 950 45 55>
<TargetWin HKN>
<AlwaysOnTop on>
<CreateColoredButton ON 0 0 30 30 0xff0f0f 0x000000 ???>
<AddButtonToPanel ON HKN>
// <DoHotkey Hotkey BrowserForward>
// works OK here but then get de-sync with togglekey
// work-around, use ??? to signal "HKN state unknown
<CreatePanel ACT 65 950 45 55>
<TargetWin ACT>
<HideWin>
<AlwaysOnTop ON>
<CreateColoredButton TOGGLE 0 0 30 30 0x00FF00 0x0F0F0F " 1 ">
<AddButtonToPanel TOGGLE ACT>
<hotkey pause>
<sendpc local>
<ToggleHotkeys>
<DoHotkey Hotkey BrowserForward>
//-----------------------------------------------------------
// General spell Toggle. HOLD DOWN OEM7
// (ON French KEYBOARDS, THAT'S THE little 2 KEY IN UPPPER LEFT CORNER)
// WHEN YOU WANT TO CAST alternatively
// fist sequence start with window2, then window1...
// should be useful for team of equal ability, like 5*warlock
// to conserve mana
//-----------------------------------------------------------
<UseKeyAsModifier Oem7>
<Hotkey Oem7 0-9, Oem4, Plus, F1-F12>
<Toggle>
<SendLabel w2>
<Key %TriggerMainKey%>
<SetButtonText TOGGLE " 1 ">
<TargetWin ACT>
<AlwaysOnTop on>
<ShowWin>
<Toggle>
<SendLabel w1>
<Key %TriggerMainKey%>
<SetButtonText TOGGLE " 2 ">
<TargetWin ACT>
<AlwaysOnTop on>
<ShowWin>
//-----------------------------------------------------------
// General Toggle spell reset . HOLD DOWN OEM7 and Backspace
// (ON French KEYBOARDS, THAT'S THE little 2 KEY IN UPPPER LEFT CORNER)
// WHEN YOU WANT TO CAST toggle starting at toon 2 again
//-----------------------------------------------------------
<Hotkey Oem7 Backspace>
<SendPC local>
<ResetToggles>
<TargetWin ACT>
<HideWin>
//-----------------------------------------------------------
// DEFINE MOVEMENT KEYS THAT WILL GET SENT TO BOTH WOW'S.
// ADD MORE KEYS IF YOU WANT.
//-----------------------------------------------------------
<MovementHotkey up, down, left, right>
<SendLabel w1, w2>
<Key %Trigger%>
//-----------------------------------------------------------
// BROADCAST MOUSE CLICKS. HOLD DOWN BrowserBack
// (ON Multimedia KEYBOARDS,THAT'S THE little right arrow key )
// WHEN YOU WANT TO BROADCAST.
//-----------------------------------------------------------
<UseKeyAsModifier BrowserBack>
<Hotkey BrowserBack shift LButton, MButton, RButton, Button4, Button5>
<TargetWin MOUSE>
<ShowWin>
<SendLabel w1, w2>
<KeyDown shift>
<ClickMouse %TriggerMainKey%>
<KeyUp shift>
<TargetWin Mouse>
<HideWin>
//----------------------------------------------------------------
// DEFINE A MOVEMENT HOTKEY FOR FORMATION
// Press NumPad Multiply to see toons spred apart
//----------------------------------------------------------------
<MovementHotkey Multiply>
<If ActiveWinIs wow1>
<SendLabel w1> <Key Left>
<SendLabel w2> <Key Right>
<Else If ActiveWinIs wow2>
<SendLabel w1> <Key Right>
<SendLabel w2> <Key Left>
Freddie
12-04-2009, 01:14 PM
I have most probably made HKN do much more than its author would have though reasonable.
I know you're joking but I'll take the opportunity to say something serious. It became obvious two years ago, when HotkeyNet's beta began, that it needed a real programming language. People kept writing complicated things and bumping into walls. But instead of replacing the language, which would have been a lot of work, I kept adding kludges to the existing language. Finally, with HotkeyNet 2, I wrote a new language. That new language will eventually be in Mojo.
http://hotkeynet.com/hkn2/ref/LanguageOverview.html
Points of Interest:
1. the PIP code is not the fastest, but is the safest I could get,
You may be able to PIP faster by setting the small windows to <AlwaysOnTop> instead of using <SetWinRegion>.
The HKN button is not always refreshed properly from within WOW, It works from within Windows
there is already a work-around the issue<if hotKeyNetIsOn giving delayed results> issue,
Is this a bug in the script or HotkeyNet? If it's HotkeyNet, which button?
papounet
12-04-2009, 03:18 PM
Indeed, I meant
I have most probably made HKN do much more than its author would have though reasonable. as a joke whereas I should have been a compliment.
I have extensively researched the event handler replacements tools which allow multiboxing. HotKeyNet had the leanest "programming" aspect to it. I am glas I have choosen it. Kudos to you.
Nontheless, I wanted to bring to your attention several small details:
1. you state that there is a restriction regarding if-else-endif not being allowed in command. Using DoHotKey, I was able to call an if-then-else construct from a command.
I am not suggesting you change but you may want to have the work-around documented. I found the ability to execute if-then-else from within an autoexec command worthwhile
2 indeed, I have tried coding PIP with AlwaysOnTop On for the window which is minimized and maximizing the other window below. But I have no control over the panels z-order, so I would have to reset the panels on top of the windows which is already ontop. furthermoer, if the PIP windows is on top, then it is getting the input stream if the mouse is over it. The region mechanism is working very nicely.
I could perhaps do away with <SetWinRegion none> which was when I was adjusting windows coordinates and not refreshing the back window
At one time I had to add a UpdateWin becaus I was not sure ShowWin would eb enough. I could perhaps do away with it.
Please note that I have choosen minimized dimension which are an exact divide by 6 of the fullscreensize
3. It is my ON button in the panel HKN create din the autoexec, and updated by the ToggleHotKeys
Ther is a strange sync bug when I have the HotKeyAreOn call in the autoexec commanbd through the DoHotKey.
The status is properly read by the DoHotKey, and the panel is updated correctly.
But, then the first time thetoggle key is pressed, HotKeyAreOn is on but the panel is not updated
thereafter, everytime the toggle key is presssed the state is updated but the panel is the reverse of what it should be
It looks like this:
Autoexec = status is correct (keys are handled or not depending on the state of HKN when load script is invoked / panel is set correctly
toggle key = status change correctly but panel button does not change
toggle key = status change correctly, panel toggle (so it is desync)
toggle Key = status change correctly, panel toggle .....
A few quick PIP change may bring it back in sync
Even in window, I can reproduce the desync by hammering at the togglekey for a few seconds, at one point, the panel will display that HKN is active whereas it is not (or viceversa).
I have tried the Toggle code with the test inlined, and still same desync
<hotkey pause>
<sendpc local>
<ToggleHotkeys>
// <DoHotkey Hotkey BrowserForward>
<If HotkeysAreOff>
<SetButtonColors ON 0x00FF00 0x0F0F0F>
<SetButtonText ON HKN>
<Else>
<SetButtonColors ON 0x0F0F0F 0x00FF00 >
<SetButtonText ON off>
<endif>
<TargetWin HKN>
<AlwaysOnTop on>
<UpdateWin>
4. I lost a few hours debuggin the Z code which on my french Logitech keyboard seems to belong to oem-7 key, I had in my keylist a oem2-8 except Z construct and yet, Z and CTRL-Z, where generated and shown in the loaded HotKeyList
5. WOW keyboard handling is bizarre to say the least, It took me a while to get that / is CTRL-: . I would have bet that without HKN, / was recognised
Again, it took more time I would have tought but it is working quite nicely
papounet
12-04-2009, 03:45 PM
To further describe the issue I had with Z and oem-7:
With HKN set up as follow roughly as follow:
<KeyList MyList A-Z, Oem2-8 except Z,
Pressing the oem-7 (which is marked "Z" on my Logitech keyboard would get me a "z" in a chat window in WOW but not trigger the "forward" command (as arrow-up would do) or any macro connected to
But ALT + oem-7 Would trigger the macro or move forward !!!
<KeyList MyList A-Y, Oem2-6,oem8 thus works
Freddie
12-04-2009, 08:26 PM
1. you state that there is a restriction regarding if-else-endif not being allowed in command. Using DoHotKey, I was able to call an if-then-else construct from a command.
I am not suggesting you change but you may want to have the work-around documented. I found the ability to execute if-then-else from within an autoexec command worthwhile
This is a well known workaround. Many people do this, and I've been recommending it for a long time. Thanks for suggesting that it should be documented.. I just added it to five or six pages on the website.
Here's a useful, related trick. Both the operating system and HotkeyNet recognize dozens of keys that don't exist on Western keyboards. People can use these keys as triggers when they define hotkeys that will be used as subroutines with DoHotkey. That way they don't "lose" any real key combinations that they might want to press with their fingers. Here are some keys that can be used this way. If people define some of these "non-existent" keys as modfiers, they can make millions of hotkey triggers. (Triggers can contain up to sixteen modifiers.)
OemAX
Oem102
IcoHelp
Ico00
ProcessKey
IcoClear
Packet
OemReset
OemJump
OemPa1
OemPa2
OemPa3
OemWsCtrl
OemCuSel
OemFinish
OemCopy
OemAuto
OemEnlw
OemBackTab
Attn
CrSel
ExSel
EREOF
Freddie
12-04-2009, 08:34 PM
3. It is my ON button in the panel HKN create din the autoexec, and updated by the ToggleHotKeys
Ther is a strange sync bug when I have the HotKeyAreOn call in the autoexec commanbd through the DoHotKey.
The status is properly read by the DoHotKey, and the panel is updated correctly.
I don't remember exactly how I wrote this but I think the code that turns hotkeys off and on, runs asynchronously to the rest of the hotkey. I would have to watch the code execute in the debugger to refresh my memory. I'm probably not going to work any further on HotkeyNet (I've moved on to Mojo) so I can only say I'm sorry for the problem.
Freddie
12-04-2009, 08:45 PM
To further describe the issue I had with Z and oem-7
Whenever you want to trigger a hotkey with a particular key, all you need to do is press the key with your finger while you look at "Last key pressed" on HotkeyNet's screen.
HotkeyNet will show you the name of the key (i.e. the virtual key code) that is being received by HotkeyNet from that key.
Whatever name HotkeyNet shows for that key, use that name as the trigger of a hotkey. That hotkey will get triggered when you press the key with your finger.
lorddread
03-03-2010, 11:55 PM
I know this is a bit old but was looking at this and i am new so i could be wrong but
//---------------------------------------------
// Visual indicator because no scroll lock led
// Display green HKN button if HotkeyNet is forwarding keys
// Visual indicator of next toon to fire if toggle cast is active
// at boot up, state is displayed unknown "???"
//----------------------------------------------
<Command AutoExec>
<CreatePanel HKN 10 950 45 55>
<TargetWin HKN>
<AlwaysOnTop on>
<CreateColoredButton ON 0 0 30 30 0xff0f0f 0x000000 ???>
<AddButtonToPanel ON HKN>
// <DoHotkey Hotkey BrowserForward>
// works OK here but then get de-sync with togglekey
// work-around, use ??? to signal "HKN state unknown
<CreatePanel ACT 65 950 45 55>
<TargetWin ACT>
<HideWin>
<AlwaysOnTop ON>
<CreateColoredButton TOGGLE 0 0 30 30 0x00FF00 0x0F0F0F " 1 ">
<AddButtonToPanel TOGGLE ACT>
by changing it to
<Command AutoExec>
<CreatePanel HKN 10 950 45 55>
<TargetWin HKN>
<AlwaysOnTop on>
<CreateColoredButton ON 0 0 30 30 0xff0f0f 0x000000 ???>
<AddButtonToPanel ON HKN>
// <DoHotkey Hotkey BrowserForward>
// works OK here but then get de-sync with togglekey
// work-around, use ??? to signal "HKN state unknown
<If HotkeysAreOff>
<SetButtonColors ON 0x00FF00 0x0F0F0F>
<SetButtonText ON HKN>
<Else>
<SetButtonColors ON 0x0F0F0F 0x00FF00 >
<SetButtonText ON off>
<endif>
<TargetWin HKN>
<AlwaysOnTop on>
<UpdateWin>
So that it sets it to right color and shows on or off from the start instead of having to do the dohotkey in the autoexec?
Freddie
03-04-2010, 12:31 AM
You can't use <If> in a command. It can only go in a hotkey. You can call a hotkey from a command with <DoHotkey> .
lorddread
03-04-2010, 03:20 AM
You can't use <If> in a command. It can only go in a hotkey. You can call a hotkey from a command with <DoHotkey> .
Yeah I found that out right after i posted that sorry. What i did instead was just do
<Command AutoExec>
<CreatePanel HKN 0 35 45 55>
<TargetWin HKN>
<AlwaysOnTop on>
<CreateColoredButton ON 0 0 30 30 0xff0f0f 0x000000 ???>
<AddButtonToPanel ON HKN>
// i added below
<TurnHotkeysOn>
<SetButtonColors ON 0x00FF00 0x0F0F0F>
<SetButtonText ON HKN>
<TargetWin HKN>
<AlwaysOnTop on>
<UpdateWin>
<hotkey pause>
<sendpc local>
<If HotkeysAreOff>
<TurnHotkeysOn>
<SetButtonColors ON 0x00FF00 0x0F0F0F>
<SetButtonText ON HKN>
<Else>
<TurnHotkeysOff>
<SetButtonColors ON 0x0F0F0F 0x00FF00 >
<SetButtonText ON off>
<endif>
<TargetWin HKN>
<AlwaysOnTop on>
<UpdateWin>
So that it turns them on if there off which if i am loading script i want them enabled anyway so. Course it gives error if there already on but no biggy. Also changed pause hoykey to not need the dohotkey.
Thanks for the help
Bloodcloud
03-08-2010, 01:00 PM
This is a well known workaround. Many people do this, and I've been recommending it for a long time. Thanks for suggesting that it should be documented.. I just added it to five or six pages on the website.
Here's a useful, related trick. Both the operating system and HotkeyNet recognize dozens of keys that don't exist on Western keyboards. People can use these keys as triggers when they define hotkeys that will be used as subroutines with DoHotkey. That way they don't "lose" any real key combinations that they might want to press with their fingers. Here are some keys that can be used this way. If people define some of these "non-existent" keys as modfiers, they can make millions of hotkey triggers. (Triggers can contain up to sixteen modifiers.)
OemAX
Oem102
IcoHelp
Ico00
ProcessKey
IcoClear
Packet
OemReset
OemJump
OemPa1
OemPa2
OemPa3
OemWsCtrl
OemCuSel
OemFinish
OemCopy
OemAuto
OemEnlw
OemBackTab
Attn
CrSel
ExSel
EREOF
WOOT!!
Cool, there is a good solution for my nested If-Cases :)
I haven't found this info on hotkeynet.com.
vBulletin® v4.2.2, Copyright ©2000-2025, Jelsoft Enterprises Ltd.