Introduction: More Key Binds With Autohotkey
well, as you may know key binds are shortcuts that a user may use from there keyboard, well not so long ago a friend of mine, whom is currently working on a phd. in physics, and knows a few things in coding, keyed me in on a very useful program, Auto hotkey
if you don't know what auto Hotkey is it's a program that let's you basically code actions that your computer will take at the press of one or more keys, you can use it to do anything from putting semicolons in code after you press enter and then return, to controlling your mouse with your numpad,
you can find it here
your computer may think it's a malware because of the control it can exert on your system, but I assure you it's not, it will not control anything until it detects the command that you program in, if you run into this problem just allow it through your computers firewall.
Step 1: Make an AutoHotkey Script Folder
now it's technically, not a folder but a file, but in truth it's a word script, like in notepad, or notepad ++, which is what I prefer. if you wish to download n++ here's a link, all you have to do is
- right click on your desktop
- go to "new"
- and click on AutoHotkey Script
Step 2: Rename Your Script
this is done exactly how you would expect, right click rename...
make sure that the name you put ends in .ahk otherwise it wont read and your script wont work
you should rename it something that tells you exactly what it does but in a short way, like in my script semicoloninsert.ahk
which depending if my Programming compiler is open will return a ; then continue to the next line, I did this because I tend to forget to put ;'s at the end of my statements, but more on this aspect later
Step 3: Learning Symbols
now writing a .ahk script file is simple, if you know a few things first.
- auto hot key comes with it's own really decent non web based tutorial
- you don't have to remember a whole bunch of new coding language.
now I say that the tutorial is decent, because it has a lot of really useful information, and even a few pre written scripts in it, like the numpad to mouse one I mentioned earlier, but it does a very over complicated job of explaining this information.
so that's why I'm writing this, and to let people know that this absolutely amazing program is out there,
so a few thing's first, every key on a keyboard can be used as a hot key, second, shift, ctrl, and alt are used by symbols not wrighting out shift, ctrl, or alt, but other than that lets get to the fun stuff like the basic symbols for these three things
symbol description of function
# Windows logo key
^ control, or ctrl
& stands for the + in this any keybind like ctrl+shift+n--> this is a real key bind on a windows computer it creates a new folder
:: before a keybind set this means replace this [txt speak, or sim] with this [thing you really mean]
after a keybind set it means that you stated your keybind, so a replace function would be like ::ftw::free the whales
that's about it for the symbols and what they mean, if you have further questions, just ask in the comments
now off to what the "edit script" thing does in the dropdown menu.
Step 4: Understanding New Scripts
when you first open the edit script under the right click menu you will be presented with this wall of text that untill you look at it can look very intimidating, it will look like this.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
now this is just telling you what a few of the different commands that every script should start with and what they do, or at least why there there, they do this by declaring to the computer, Hey this part right here don't worry about it, this is done with the ; everything after that ; is just a person telling you the reader something, I like to open random .dll files and see if developers hid cool things in this script, but in a .dll file it would be a /*[ text area]*\, or a // [text area] instead of the ; but it depends on the coding language in this one it's just ;, this basically just means that either this block of text or just this line is unimportant garble.
the first thing you should do when opening a new script to edit is delete the ; before the #warn, I believe this to be a mistake in the coding but it's not major, and takes two seconds to fix this will allow your computer to tell you whats wrong with a script and maybe tell you how to fix it.
now depending on what you want your script to do, you must decide something, do you want this script to do it's thing all the time or in a hand full of applications, there a third option but I don't know how it works so moving on,
/* I'll probably edit this instructable in the future and include this toggle script option, if any of you know how this works feel free to put a comment to help me out to edit the instructable. *\
the choice you must make
1. window specific scripts, if you chose this first thing you must do is declare the window you wish it to be in with #IfWindowActive [window you wish as known by the bar at the top of window]
2. script all of the time, if you chose this don't worry just continue reading
so after you've made that choice declaring keybinds and functions of said keybinds is really easy and at first your going to think your doing something wrong, so lets get into the structure of these scripts,
Step 5: Writing Your First Script
now these two codes that I have provided snipits from, are very different, the one on the left is very simple, in fact all it does is replace hi with hello, I actually had to pause the script to wright this sentence,(PS. I only wrote it for the purposes of this instructable, I'm not a poser [error not capable of writing that word])
and the second script, on the right, as you can see looks very reminiscent of other programming languages, with it's declarations of variables and other jazz, now as you may have guessed, I didn't wright the script on the right, I am by far not versed well enough in writing these scripts to tell it to use my numpad as a mouse.
these pictures are just a few examples of how easily things in coding can get complicated, or how doing something complicated can be easy,
so I ask you what will you do with this powerful program,
something I would like to do is create a script to auto correct a lot of the words I commonly misspell, this would be as simple as the first picture, I also want to make a script for gaming, having keybinds for specific actions can be really easy, especially if it's one that requires timing, like the jump criting in minecraft, not exactly cheating if you only use it in one player non-lan worlds, just making it easier, or quicker.
and this second would be really simple, not as simple as the first picture but pretty simple.
for example to accomplish it I would have to do
#IfWinActive Starbound - Beta
this should do a double jump and on the apex of the leap release a blow from my hammer, or not it could just not work... that's always an option.