HotKeyNet A New Boxer's Guide

From Dual-Boxing.com

Jump to: navigation, search

Contents

What is HotKeyNet

HotKeyNet, or HKN, is a free multiboxing software that allows the passing of keys to mulitple instances of a game. It can be used on one or multiple computers running a Windows operating system.


What to Expect with HKN

HKN is highly configurable and very powerful, however, it does not have a GUI or a Wizard. All configuration will be done manually through scripts. An intimate knowledge with coding isn't required to start, but becoming familiar with HKN's scripting language will allow you to do far more than simply pass keys.


Understand that HKN is only a means of sending the keys you press to multiple instances of a game. Sending keys is only a part of what multiboxing is. You will still need to set up macros to fully coordinate your entire team.




Where to Start

The first thing you will need is HotKeyNet itself. This can be found at the HotKeyNet website, here. If you intend to use multiple computers, you will need to download a copy to each computer you will use.


Unzip the file to install it to an appropriate location and launch HotKeyNet from hotkeynet.exe.


Stumbling Block #1

To avoid potential issues, you can run as Admin. Please note, running as admin should only be done with programs you trust, as allowing a program to have admin rights can be a security risk. If you do not need to run as admin, then don't. If you have problems getting HotKeyNet to run properly, running as admin should be your first troubleshooting step.


Do this by going to the hotkeynet.exe, rightclicking and Run As Admin whenever you launch. Alternately, you can have HotKeyNet always run as admin by setting it in the compatibility menu. Right-click on hotkeynet.exe, select Properties, go to the Compatibility Tab and under Privilege Level, check the box for "Run this program as an administrator." Apply the changes.


You can also use a shortcut on your Desktop or Taskbar. Right-click hotkeynet.exe and select either "Pin to Taskbar" or "Send To > Desktop (create shortcut)". Again, you can right-click the newly created shortcut or pinned item and select Run as Admin or Properties > Compatibility > Privilege Level > Run this program as an administrator and Apply.

First time Running

The first time you run HotKeyNet, you will see a Welcome Window. It's pretty self-explanitory, detailing recent changes. If you don't want to see it anymore, you can check the box on the bottom. Close the window.


Now you need to tell HotKeyNet how many computers you are using. go to Options and select Connection Settings. If you are only using one computer, leave everything as it is.

If you are using multiple computers, I'll just send you directly to the walkthrough here rather than expending post space rehashing.


Scripts

The program itself is only half what what you need. The other half is a script. Go here and pick an appropriate starter script. I'll go through customizing the script, so don't worry if you need a different number of instances and/or computers.


For now, just copy all of the blue text. Open a text editor such as NotePad and paste the copied text into it. Save the file someplace you can remember using a name such as hotkeys.txt {plain text}.



From The Top

Now, let's take a look at the script. I'm going to use Sample Script for Two WoW's on One PC.


Section 1 - Using Comments

//===============
// 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 
//============

This is a comment section. Any line preceeded by two slashes {//} is not used by HotKeyNet to process commands. These are used so that you can make little notes within the script for yourself. This is very useful so that you can break up your code with plain old English descriptions of what the commands are meant to do. The comment ends at the end of a line.


Here we see the basic instructions for loading and using your script. The section I have bolded gives you the specific instructions to use the Scroll Lock key to turn your hotkeys on or off. It also states that you can change this key, but as we haven't gotten to the actual script yet, we'll hold off on that.


Section 2 - Renaming Windows

//-----------
// 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> 

Again, the comment section describes what the command is meant for. This section states that if you launch your copies of World of Warcraft by hand instead of via HKN, you should press CTRL+R while your Scroll Lock key is on. This will rename your WoW windows so that they are now called WoW1 and WoW2.


It is important to rename the windows so that HKN knows where to send the keys you press. You can add as many windows as you like by simply adding more RenameWin commands.


This means that you will load HotKeyNet, ensuring that your script is loaded and your Scroll Lock is ON. Then you will go to your WoW launcher and open as many copies as you want. Finally, once they are all loaded, you will press CTRL+R and HotKeyNet will rename your windows.


Expanding Section 2 - More Windows

<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> 

Section 3 - Subroutines - Launch and Rename

//------------
// SUBROUTINE TO LAUNCH AND RENAME A COPY OF WOW.
//------------
<Command LaunchAndRename>
   <SendPC %1%> 
      <Run "c:\Program Files\World of Warcraft\WoW.exe">
        <RenameTargetWin %2%>

As the comment says, this is a subroutine. A subroutine is a sort of shorthand way to repeat a series of commands.


  • Line 1 - Here we are defining a subroutine that processes whenever we use the command "LaunchAndRename".
  • Line 2 - Here you see %1% This is called an argument. An argument is a specific bit of information that should be found within the code we use with "LaunchAndRename". Don't worry too much about this just yet, it'll make sense with the next bit of code.
  • Line 3 - This simply says that HotKeyNet should launch a copy of World of Warcraft. Your location may vary, so you may need to change this line to point to the location where YOU have World of Warcraft installed.
  • Line 4 - Another argument.


Section 4 Launch and Rename via Hotkey

//------------
// HOTKEY TO LAUNCH AND RENAME BOTH WOW'S.
//------------
<Hotkey ScrollLockOn Alt Ctrl L>
    <LaunchAndRename Local WoW1>
    <LaunchAndRename Local WoW2>

This is where the rest of the pieces of the subroutine come in. But we'll start at the top. This defines a key combination that allows you to automatically open multiple copies of WoW and then renames them for you. This means you do not have to open copies of WoW yourself, and that you also don't need to rename them yourself using CTRL+R {section 2}.


Instead, you will load HotKeyNet, make sure your script it loaded and your Scroll Lock is on. Then you will press ALT+CTRL+L {as defined here in Line 1}. HotKeyNet will open all the WoWs you need and then rename them for you.


Line 2 + 3 - Here we see our pre-defined LaunchAndRename commands. What follows that command is our Arguments. The first word, term or string following our LaunchAndRename command is argument 1, referenced in our subroutine as %1%. The second is arguement 2, or %2% in our subroutine.


Basically, the subroutine allows you to do the same basic thing over and over, with minor changes dictated by the arguments. In this case, it will tell your computer {SendPC} %1% {Local} the command to launch WoW {Run "c:\Program Files\World of Warcraft\WoW.exe"} and then rename that window {RenameTargetWin} to %2% {WoW1}. And then it will do it again using the arguments in Line 3 {%1% Local and %2% WoW2}. See how that fits together now?


Again, you can add as many copies of WoW as you like by repeating the lines and adjusting the arguements -

<Hotkey ScrollLockOn Alt Ctrl L>
    <LaunchAndRename Local WoW1>
    <LaunchAndRename Local WoW2>
    <LaunchAndRename Local WoW3>
    <LaunchAndRename Local WoW4>
    <LaunchAndRename Local WoW5>


Section 5 - Mail Labels

//----------------
// DEFINE MAIL LABELS FOR SENDING KEY STROKES 
//-----------------
<Label w1 Local SendWinM WoW1>
<Label w2 Local SendWinM WoW2>

Labels define where keys get sent. Again, add more if you're running more copies.

<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>


Section 6 - Defining Hotkeys

//------------------
// 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, Plus, Minus, F1-F12 except W, A, S, D, Q, E>
<SendLabel w1, w2>
<Key %Trigger%>

As the comment states, this is where you tell HotKeyNet what keys it should send and where. This is only for keys you will use for casting and such. Movement keys are defined later.


SendLabel says those keys go to w1 and w2, which we defined previously as WoW1 and WoW2. Again, you can add more labels if you're running more copies

<SendLabel w1, w2, w3, w4, w5>

The final line here simply states that the key you press is the key to be sent.


Changing the sent keys

The default script we are using sends only a limited number of hotkeys. As you can see, these keys are A-Z {but not the standard movement keys wasdqe}, 1-0, +, - {the top row numberbank} and the Function keys F1-F12.


This means keys such as the number pad keys, Tab, the arrow keys and so on are not sent. You may find that the default keys are enough, but if not, you can add or remove any keys you like.


To ADD keys, open up HotKeyNet. Look at the box in the upper right that says "Last key press". Make sure "Show" is checked and press the key you want to add. Next to key name, it will give you the actual name of the key. Simply add the key name in the Hotkey section {keys must be separated by a comma}.


Finding Key Names


You can also add ranges of keys. For example, if you want to be able to use the number pad keys, press a number pad key to get the proper format for the name. For the number pad, it is Numpad1, so add Numpad0-Numpad9, like so


<Hotkey ScrollLockOn A-Z, 0-9, Plus, Minus, F1-F12, Numpad0-Numpad9 except W, A, S, D, Q, E>


To REMOVE keys, simply delete them from the line. Suppose you don't want to pass any letter keys at all. Simply delete A-Z. If you only want to pass a certain few letter keys, you can delete A-Z and just add the few letters you would like to pass.

Section 7 - Movement Keys

//--------------
// 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>
<Key %Trigger%>

This defines your movement keys. MovementHotkey is different from a normal hotkey because they sustain an action. These keys are often used to move master and slaves all at the same time. The default script uses only the arrow keys. You will probably want to add the Space bar and potentially strafe keys here. Do not add W, A, S, D expecting to be able to have slaves follow the master. Slaves should simply follow the master via an ingame macro. Movement keys to slaves should only be used for minor movements, as the smallest variation in facing will soon send all your toons off in different directions.


As always, you are free to add more copies to the SendLabel command.



Section 8 - Broadcasting Mouse Clicks

//-------------
// 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> 
      <ClickMouse %TriggerMainKey%>

This allows you to pass your mouse clicks from the main screen to your slave screens. To use it, you need to hold down the ` key, then click your mouse. The mouse will then rapidly repeat that click across all your windows. Yet again, add more labels as appropriate.


Now, if you like, you can go ahead and change any of the hotkeys. For example, if you don't want to have to use "Alt Ctrl L" to launch and rename, you can change it to whatever you like. Just make sure it's not something that you're going to use in game. For example, W might be easy to remember for launching WoW, but you use W in game to move forward, so it's probably not such a good idea as a launch Key.


Once you've made any changes you need to make, save the script again.


Now, open HotKeyNet and look in the bottom lefthand corner. Click "Load Script" and browse to the location where you saved your script. Select your script and doubleclick to load it into HKN.


Next, be sure HKN is broadcasting by looking at the "Pressed Hotkeys" window. If there's a big red X through it, you're not broadcasting. Check "Turn on" and you're good to go. Just hit the appropriate hotkey to launch your games.


Stumbling Block #2

"It doesn't work," is not helpful. If you're having a problem with your script, look at the "Actions on this PC" window in HotKeyNet. Errors will show in Red. If you can't figure out what the errors you are seeing mean, copy and paste them into your request for help, along with your script so people can help troubleshoot the issues.



Refining your script

Now that you understand the basics of the example script, you can work on making changes to better suit your needs.


Starting at the startup, I like to have my games run from different folders. This simply allows me to have my master and slaves use different configurations. I also like to have HotKeyNet not only launch and rename my games, I like to have it resize the game windows, remove the window borders and position them in set locations. Finally, I like to have it input my passwords for me, which I do NOT advise for most users, but I'll show you how to do it anyway. HKN scripts are PLAIN TEXT FILES, which means anyone can read them on your computer. HKN doesn't protect you from keyloggers or anything else. Obligatory get an authenticator, keep your programs updated, patch security holes blah blah blah here.


Anyway...here is my code.

//----------
// 	SUBROUTINE TO LAUNCH AND RENAME A COPY OF WOW.
//-------------
<Command LaunchAndRename>
<SendPC %1%>
<Run %2%>
<RenameTargetWin %3%>
<RemoveWinFrame>
<wait 1000>
<text %4%>
<wait 1000>
<Key tab>

First, we establish the LaunchAndRename subroutine. Because I use different folders, I have an additional Argument for my game path instead of the Run command in the default script's LaunchAndRename. I also have an argument for "text", which will be my password. We'll see those later.


RemoveWinFrame simply removes the border around my WoW windows.


You'll see that I insert some delays here. Be careful. You do not want to use wait commands in anything you do in game. That becomes automation and will get you banned from many games. These delays are only for use in setting up my input fields for logging in.


Next HKN inputs my password for %4%, makes a short pause and hits tab to put my cursor in the input field for the authenticator. Did I mention get an Authenticator?

//----------
// 	SUBROUTINE TO Position Windows for 5 boxing.
//-------------
<Command ResizeAndPosition>
	<SendPC Local>
		<SendWinM %1%>
			<SetWinRect 0 0 1680 1022>              
		<SendWinM %2%>
			<SetWinRect 1680 0 840 525>  
		<SendWinM %3%>
			<SetWinRect 1680 525 840 525>     
		<SendWinM %4%>
			<SetWinRect 2520 0 840 525>
		<SendWinM %5%>
			<SetWinRect 2520 525 840 525>

This is my subroutine to resize my windows and put them in a specific location.


To do this I take a screenshot of my desktop {PrtScn in Windows} and paste it {ctrl+v} into a paint program like Paint.NET, then use a draw rectangle tool to visualize how I want it set up. Here's an example of setting up a large main window and a small slave window on one monitor.


Setting up Windows


The pink rectangle would be your main window, the blue would be the slave.


The first set of numbers you need for SetWinRect are the x,y coordinates for the upper left corner of the windows {0 0 for the main and 1290 0 for the slave using my example}. Paint.NET shows this in the lower right corner of the program. Alternately, you can get these coordinates by opening HotKeyNet and clicking your mouse anywhere on your screen where you want the window to be placed. In the Last Key Press Window you will see "scrn position: x = 0 y = 0", but this only works if you have a script loaded that has a Clickmouse command in it {the example script includes this command}.


The second set of numbers for SetWinRect are the dimensions of the windows {1288 1020 for the master and 390 356 for the slave in my example}. This is shown in the bottom left corner in Paint.NET and states how many pixels wide {1288, 390} by how many pixels high {1020, 356} the specific window should be.


This is what that code would look like

<Command ResizeAndPosition>
	<SendPC Local>
		<SendWinM %1%>
			<SetWinRect 0 0 1288 1020>              
		<SendWinM %2%>
			<SetWinRect 1290 0 390 356>

Finally, I set up the hotkey.

//------------
// 	HOTKEY TO LAUNCH AND RENAME 
//-------------

<Hotkey LCtrl  LAlt w>
		<if WinDoesNotExist WoW1>
			<LaunchAndRename Local "D:\World of Warcraft\WoW.exe" WoW1 PASSWORD>
	<endif>
		<if WinDoesNotExist WoW2>
			<LaunchAndRename Local "E:\World of Warcraft\Wow.exe" WoW2 PASSWORD>
	<endif>
		<if WinDoesNotExist WoW3>
			<LaunchAndRename Local "E:\World of Warcraft\Wow.exe" WoW3 PASSWORD>
	<endif>
		<if WinDoesNotExist WoW4>
			<LaunchAndRename Local "E:\World of Warcraft\Wow.exe" WoW4 PASSWORD>
	<endif>
		<if WinDoesNotExist WoW5>
			<LaunchAndRename Local "E:\World of Warcraft\Wow.exe" WoW5 PASSWORD>
	<endif>
<ResizeAndPosition WoW1 WoW2 WoW3 WoW4 WoW5>

You'll see I use a different key combination {LCtrl LAlt w} than what is used in the example script {ScrollLockOn Alt Ctrl L}. I simply find that easier to use.


You'll also notice I have the lines <if WinDoesNotExist> and <endif> in there. What this does is allows HKN to check if I already have such a window open, which is very useful if one of my instances happens to crash or I close it for any reason. This way I can hit my hotkey and it will only relaunch, rename, resize and reposition missing windows.


Next you see all my arguments that I set up in LaunchAndRename. These being %1% = Local, %2% = Path to Wow.exe, %3% = Window Name and %4% = my password. Let's add an imaginary %5% here where %5% = GET AN AUTHENTICATOR.


Finally, we have the call for ResizeAndPosition, which takes all my windows, and resizes them and positions them in a set place on my screen.


These 3 sections of code replace sections 2, 3 and 4 from the example script.


I also use a Keylist in defining my hotkeys. This allows me to quickly define modifier keys.

//----------------
//	DEFINE HOTKEYS 
//----------------

<KeyList MyList 0-9, Numpad0-Numpad9, Divide, Multiply, NumpadMinus, Tab, NumpadPlus, Backspace, Insert, Home, PgUp, PgDn, Delete, F1-F12, Esc, Oem1-Oem7, except OEM2, w, a, s, d, q, e, x>
<Keylist All 0-9, A-Z, Space, Esc, Enter, Tab, Oem1-Oem7>

<Hotkey CapsLockOff MyList; CapsLockoff Shift MyList; CapsLockOff Alt MyList; CapsLockOff Ctrl MyList>
	  	 <SendLabel w1, w2, w3, w4, w5>
   	<Key %Trigger%>
<Hotkey CapsLockOn All>
	  	 <SendLabel w1, w2, w3, w4, w5>
   	<Key %Trigger%>

First I define the keys that I want to be able to send to all my game windows in a Keylist called "MyList". I also go ahead and define a Keylist called "All" which contains different keys. "MyList" is keys I'd normally use while fighting, while "All" is a list I use when I want to do something like have all of my toons emote at the same time.


Now that I have a predefined list, I set up the Hotkey. I use CapsLock to toggle my hotkeys instead of Scroll Lock because...scroll lock was messing up something for me a long, long time ago with my NumLock or something. I don't remember, but that's the way I do it.


Using the Lists, I'm able to use any of those keys as they are, or with modifier keys {Shift, CTRL, ALT}. This takes the place of section 6 in the sample script.


Finally, I have a hotkey set to stop HotKeyNet altogether.

//--------------
//	TOGGLE HKN MUTE
//---------------

<hotkey Pause>
	<sendpc local>
	<ToggleHotkeys>


All this does is allow me to hit my Pause key to prevent HotKeyNet from sending keys to any of my game windows. This way I can chat in game on only my main or type outside the game in chat windows or search in my browser.



More Stuff You May Want To Check Out

Personal tools