PDA

View Full Version : AutoHotKey Guide


Blank101
03-08-2007, 07:16 PM
=======================
IAAW's AutoHotKey Guide
=======================

Using Autohotkey, you CAN set guns to keys you wish to use for it. This guide will teach you how.

========
Contents
========
1] About Autohotkey
2] Using Autohotkey
3] The Keys List
4] Setting Autohotkey Scripts
5] Closing/Suspending Autohotkey Scripts
6] Conclusion

~~~~~~~~~~

This is a small guide to teach you how you can use Autohotkey to set guns to any setting that you wish. Well, here we go!

~~~~~~~~~~

================
About Autohotkey
================

Autohotkey is freeware. It's free, and completely spyware free. Trust me, I've used it to play FFR, and it works AWESOME. Especially when I play spread on SM. Anyways, this guide will show you how you can use Autohotkey, how to set the Autohotkey scripts, and how you close/suspend Autohotkey scripts. Enjoy.

================
Using Autohotkey
================

Now, first of all, you need to download Autohotkey. Go to:

<a href="http://www.autohotkey.com">www.autohotkey.com</a>

And download Autohotkey. Do everything you need to do to install it, and get ready for some funness. First, just right click anywhere on your desktop, or in My Documents. Just somewhere. Anyways, right click, and click New. Now, click New Autohotkey Script. This makes a new script. Just name it whatever you want.

Now, you might get an error when editing scripts for the first time. All you need is notepad, and, if you have to, select it from a list of programs if you get the prompt that your computer cannot open the file.

Okay, first of all, you need to know the list of keys that are to be used when you are setting keys.

=============
The Keys List
=============

Here is the complete list of the keys you can change. Of course, you could just go to the Help file for this, but for those who are lazy, here ya go.

~~~~~
Mouse
~~~~~

LButton - the left mouse button
RButton - the right mouse button
MButton - the middle or wheel mouse button

WheelDown - this is equivalent to rotating the mouse wheel down (toward you)
WheelUp - the opposite of the above. When WheelDown/Up are used as hotkeys, A_EventInfo contains the number of turns/notches.

Supported only in Windows 2000/XP or later:
XButton1 - a button that appears only on certain mice
XButton2 - a button that appears only on certain mice

~~~~~~~~
Keyboard
~~~~~~~~

Space - the spacebar
Tab
Enter (or Return)
Escape (or Esc)
Backspace (or BS)

Delete (or Del)
Insert (or Ins)
Home
End
PgUp
PgDn
Up
Down
Left
Right

ScrollLock
CapsLock
NumLock

NumpadDiv - the slash key
NumpadMult - the asterisk key
NumpadAdd - the plus key
NumpadSub - the minus key
NumpadEnter - the Enter key

The following keys are used when Numlock is OFF:
NumpadDel
NumpadIns
NumpadClear - same physical key as Numpad5 on most keyboards
NumpadUp
NumpadDown
NumpadLeft
NumpadRight
NumpadHome
NumpadEnd
NumpadPgUp
NumpadPgDn

The following keys are used when Numlock is ON:
Numpad0
Numpad1
Numpad2
Numpad3
Numpad4
Numpad5
Numpad6
Numpad7
Numpad8
Numpad9
NumpadDot - the decimal point (period) key

F1 through F24 - The 12 or more function keys at the top of most keyboards.

AppsKey - this is the key that invokes the right-click context menu.

LWin - the left windows key
RWin - the right windows key. Note: unlike Control/Alt/Shift, there is no generic/neutral "Win" key because the OS does not support it.
Control (or Ctrl)
Alt
Shift
Note: The hotkeys Shift::, Alt::, and Control:: fire upon release of the key unless they have the tilde prefix such as ~Alt::. By contrast, a specific left or right hotkey such as LAlt:: fires upon press-down.

Note: For the most part, these next 6 keys are not supported by Windows 95/98/Me. Use the above instead:
LControl (or LCtrl) - the left control key
RControl (or RCtrl) - the right control key
LShift
RShift
LAlt - the left Alt key
RAlt - Note: If your keyboard layout has AltGr instead of RAlt, you can probably use it as a hotkey prefix via &lt;^&gt;! as described here. In addition, "LControl & RAlt::" would make AltGr itself into a hotkey.

PrintScreen
CtrlBreak
Pause
Break -- Since this is synonymous with Pause, use ^CtrlBreak in hotkeys instead of ^Pause or ^Break.

Help - this probably doesn't exist on most keyboards. It's usually not the same as F1.
Sleep - note that the sleep key on some keyboards might not work with this.

The following exist only on Multimedia or Internet keyboards that have extra buttons or keys:
Browser_Back
Browser_Forward
Browser_Refresh
Browser_Stop
Browser_Search
Browser_Favorites
Browser_Home
Volume_Mute
Volume_Down
Volume_Up
Media_Next
Media_Prev
Media_Stop
Media_Play_Pause
Launch_Mail
Launch_Media
Launch_App1
Launch_App2

SCnnn (where nnn is the scan code of a key) - Recognizes unusual keys not mentioned above. See Special Keys for details.

VKnn (where nn is the hexadecimal virtual key code of a key) - Although this rarely-used method is supported in all versions, only in v1.0.38.02+ does it prevent certain types of hotkeys from requiring the keyboard hook. For example, the following hotkey does not use the keyboard hook, but as a side-effect it is triggered by pressing either Home or NumpadHome: ^VK24::MsgBox You pressed Home or NumpadHome while holding down Control.

~~~~~~~~
Joystick
~~~~~~~~

Joy1 through Joy32: The buttons of the joystick. To help determine the button numbers for your joystick, use this test script. Note that hotkey prefix symbols such as ^ (control) and + (shift) are not supported (though GetKeyState can be used as a substitute). Also note that the pressing of joystick buttons always "passes through" to the active window if that window is designed to detect the pressing of joystick buttons.

Although the following Joystick control names cannot be used as hotkeys, they can be used with GetKeyState:
JoyX, JoyY, and JoyZ: The X (horizontal), Y (vertical), and Z (altitude/depth) axes of the joystick.
JoyR: The rudder or 4th axis of the joystick.
JoyU and JoyV: The 5th and 6th axes of the joystick.
JoyPOV: The point-of-view (hat) control.
JoyName: The name of the joystick or its driver.
JoyButtons: The number of buttons supported by the joystick (not always accurate).
JoyAxes: The number of axes supported by the joystick.
JoyInfo: Provides a string consisting of zero or more of the following letters to indicate the joystick's capabilities: Z (has Z axis), R (has R axis), U (has U axis), V (has V axis), P (has POV control), D (the POV control has a limited number of discrete/distinct settings), C (the POV control is continous/fine). Example string: ZRUVPD

Multiple Joysticks: If the computer has more than one and you want to use one beyond the first, include the joystick number in front of the control name. For example, 2joy1 is the second joystick's first button.

Note: If you have trouble getting a script to recognize your joystick, one person reported needing to specify a joystick number other than 1 even though only a single joystick was present. It is unclear how this situation arises or whether it is normal, but experimenting with the joystick number in the joystick test script can help determine if this applies to your system.

See Also:
Joystick remapping: methods of sending keystrokes and mouse clicks with a joystick.
Joystick-To-Mouse script: using a joystick as a mouse.

That's the complete list, ripped from the help file. Go to the help file if you need EXTRA help. Anyways, now, you can learn how to set up your autohotkey script. YAY!

==========================
Setting Autohotkey Scripts
==========================

Okay, now you will learn how to set up your keys. Anyways, find your autohotkey script. Right click it, and click Edit Script. This should open the script in Notepad. Now, here's what you shall see:

Code:
<table border=1><tr><td>;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other &lt;myemail@nowhere.com&gt;
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.</td></tr></table>


Now, you are placing your script parts between the last ; and #NoEnv. Now, you wanna set your keys to the the numbers 1 - 0 on the keyboard. Here's an example of what you can do. This is my setup for swapping between the MAC-11, MAC-11 Silenced, MP5, and L85A1.

Code:
<table border=1><tr><td>;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other &lt;myemail@nowhere.com&gt;
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

z::Send {3}
x::Send {4}
c::Send {5}
v::Send {7}

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.</td></tr></table>


That's how you set the keys up. Always make sure that your setup follows this syntax:

Code:
<table border=1><tr><td>KEY::Send {KEY}</td></tr></table>


Say you wanted the key q to send the number 0, which is for the protogun. Then you would wanna do this:

Code:
<table border=1><tr><td>q::Send {0}</td></tr></table>


Now you can press q to swap to the protogun, instead of having to reach all the way to 0. Now, you can't just go playing without starting the script, can you? Now, first, save the script changes. This is so that changes can take effect. Now, you can right click the autohotkey script, and click Run Script. This will start the script, making all the keys that you set to link to other keys.

Now, what if you need to type? Well, you can do that too. Read thy next section.

=====================================
Closing/Suspending Autohotkey Scripts
=====================================

Sometimes you have to type. And you can't type without having to close Autohotkey. Now, here's how you close Autohotkey. When you run a script, a little green H should appear in your Navbar, over in the lower right corner. Right click that.

You should get a small menu. But, since you want to close Autohotkey, just go and click Close Autohotkey. This will automatically end the script, and close Autohotkey. But wait. What if you DON'T want to close Autohotkey? Well, you can also suspend hotkeys.

Simply right click the H, and click Suspend Hotkeys. This will suspend everything, so that you can type normally as needed. Now, when you're done typing, be sure to un-suspend your hotkeys so that they are usable.

==========
Conclusion
==========

Well, from reading this guide, you should now know how to set your keys with Autohotkey. Of course, I'm pretty sure blank will set up a customize key option, but, for now, Autohotkey can do!

Try it out for yourself! And, if you need some help, just post in this thread, and I'll help you out when I can.

- END OF GUIDE -