Rabu, 28 Juli 2010

The Best Time-Saving AutoHotkey Tricks You Should Be Using

By The How-To Geek

The Best Time-Saving AutoHotkey Tricks You Should Be Using

The Best Time-Saving AutoHotkey Tricks You Should Be UsingIt's no secret that we're huge fans of the simple but powerful AutoHotkey scripting language, and we use it religiously to automate Windows tasks and save time. Here's a handful of useful scripts and tricks to help you become an AutoHotkey expert.

Today's lesson assumes that you're already somewhat familiar with AutoHotkey scripting and automation. If you're new to the world of AutoHotkey, be sure to check out our beginner's guide to turning any action into a keyboard shortcut using AHK.

Note: If you're trying to use an AutoHotkey script that requires Administrator access, you'll probably want to use this registry hack to add Run as Administrator to AutoHotkey scripts.

Make Windows Explorer Easier to Use

The Best Time-Saving AutoHotkey Tricks You Should Be UsingWe spend so much time browsing around in Windows Explorer that just about any enhancement can be a huge help, and there's a couple of ways you can tweak your Windows Explorer to make it easier to use.

Show/Hide Hidden Files and Extensions: If you regularly need to access hidden files, it's a pain to have to dive all the way into the settings dialog to enable them, deal with the file, and then go back and set it to hidden again. Instead, try a simple AutoHotkey script to toggle hidden files with a shortcut key—and as a bonus, you can also toggle file extensions with a shortcut key.

Restore the Backspace Key to XP-Style Navigation: Windows XP used to let you go up in the folder structure when you used the backspace key, but since Vista the backspace key has been changed to go back in the history instead—sure, you can use the alternative Alt+Up hotkey, but if you just can't get used to it, you can use an AutoHotkey script to restore the backspace key to its original purpose.

Quickly Access the Command Prompt: If you're a command-line junkie, you're probably already aware of how easily you can access the command prompt from the context menu, but if you want something even easier, you can use AutoHotkey to create a shortcut key that launches a command prompt already started in the same folder that you're currently browsing in Windows Explorer.

Insert Special Characters with a Keystroke

The Best Time-Saving AutoHotkey Tricks You Should Be UsingIf you need to insert special characters in a document or file that you're working on, you can use Windows' built-in Character Map application to find the character, copy it to the clipboard, and then past it into the document that you're working on.

That's all fine and good for special characters you don't really use that often, but if you find yourself using the same special characters on a regular basis, you can use AutoHotkey to insert any special character with a single keystroke and save yourself loads of time in the process.

The general idea is that you'll use the SendInput function in a hotkey script, and paste in the special character that you're trying to use between the brackets—for instance, if you wanted to assign Alt+O to send the registered trademark symbol, you'd use a script like this:

!o::SendInput {®}

You can modify the hotkey line to send any symbol that you'd like, and simply include multiple lines if there's more than one symbol you'd like to assign to a hotkey.

Manipulate Open Windows with the Keyboard

Activate Favorite Applications with a Keystroke: If you regularly have loads of open applications on your screen, switching between them with Alt+Tab can be a royal pain. The much easier solution is to assign a shortcut key to a particular window so you can instantly restore a specific, commonly-used application with a single keystroke. You'll need to customize the script for your environment, and then learn the shortcut keys, but once you do you will never want to go back to using Alt+Tab again.

Alt+Drag to Move Any Windows, from Anywhere: Long-time Linux users have always had a great feature that lets you hold down the Alt key and then left-click dragging the window anywhere on the screen that you want—instead of trying to grab the title bar every time you want to move it. Since this functionality doesn't exist in Windows anywhere, you can use an AutoHotkey script to get the Alt+Window drag functionality in Windows.

Turn Off the Monitor and Lock the PC in One Keystroke

The Best Time-Saving AutoHotkey Tricks You Should Be UsingWindows includes the very useful Win+L shortcut key that locks your workstation, but it doesn't turn the monitor off at the same time—you'll have to wait until Windows power management kicks in for the screen to go dark. If you're trying to save battery life on your laptop PC, you can use AutoHotkey to create a shortcut that turns off the monitor and locks the workstation in a single keystroke.

If you're using a desktop PC, you could always just hit the power off button on the monitor, but then you'd have to power it back on again every time you sit down—this method uses Windows power management to shut down the monitor, and then you just need to move your mouse or hit the keyboard to force it to come back.

Create a Customized Boss Key to Keep You Out of Trouble

If you're still stuck in the daily grind, you've no doubt been in the situation where you're trying to do something else while you're supposed to be working for the man—and you don't want to get caught while doing it. We aren't actually advocating that you slack off at work or violate your employer's policies, but if you are already slacking off, you can create your own customized boss key to keep you out of trouble.

The general idea is that you probably already know the applications that you aren't supposed to be using, so you can create a shortcut key that hides or kills the windows that you shouldn't be using, and then create another shortcut key that restores them again.

For instance, if you wanted to hide VLC media player when you hit the F6 key, and then show it again when you press the F7 key, you'd use a script similar to this one:

F6::
{
WinHide, VLC media player
Return
}
F7::
{
DetectHiddenWindows, On
WinShow, VLC media player
Return
}

You could make a more complicated script that detects the presence of the window and toggles with a single shortcut key, but the problem is that if you accidentally hit the key twice, that application is going to hide and come right back—not what you're trying to accomplish. For more tips and techniques, be sure to read through our guide to creating the perfect boss key.

Disable Your Touchpad While Typing

The Best Time-Saving AutoHotkey Tricks You Should Be UsingThere's nothing more annoying on a cheap laptop than a touchpad that's so close to the keyboard that your thumbs accidentally hit it while you're typing—sending the cursor all over the screen and interrupting your flow. We'll take this moment to recommend that you check your laptop's touchpad driver panel for a sensitivity setting, but if that doesn't do the trick, you can also use an AutoHotkey script to disable the touchpad while you're typing, completely preventing the problem from happening at all.

Combine AutoHotkey and Dropbox to Monitor and Control Your PC Remotely

The Best Time-Saving AutoHotkey Tricks You Should Be Using
If you're a Dropbox user, you've probably already found many clever ways to use Dropbox, but combined with AutoHotkey you can really do some interesting things, like monitoring your PC or launching applications remotely.

To monitor your PC remotely, you can simply create a script that triggers a screenshot utility in the background every few minutes—by simulating pressing the shortcut key that the utility is assigned to. For instance, if you are using the simple Screen Grabber utility, this script would press the Shift+F10 shortcut key every 5 minutes. You can alternatively check out the full guide over at Digitial Inspiration, along with a downloadable version of the script.

Loop {
Send, {SHIFTDOWN}{F10}{SHIFTUP}
Sleep, 300000
}

If all you really want to do is launch an application on the remote PC, you can create an AutoHotkey script that runs, and then reloads itself every 5 minutes—so you can add a line to the beginning of the file, and the next time the script reloads it will run that line. Since the script is sitting in your Dropbox folder, you can edit it from anywhere.

Run, C:\Program Files\LogMeIn\x86\LogMeIn.exe
Loop
{
Sleep, 300000
Reload
}

In the example script, the top line wouldn't be there normally—that's the line that you can add from anywhere to launch the application. Once it's been launched, you can remove the line from the script so it won't launch again. Check out the rest of the instructions in our guide to launching applications remotely with Dropbox and AutoHotkey.

Search Google from Any Application

If you're tired of copying and pasting from one application into your browser's search box, there's a much simpler way to go about this that works no matter what application you're in—just create a simple AutoHotkey script to map the Ctrl+Shift+C shortcut key to automate copying the text to the clipboard, and then open your default web browser with a Google search for the selected text.

^+c::
{
Send, ^c
Sleep 50
Run, http://www.google.com/search?q=%clipboard%
Return
}

Shorten URLs with a Shortcut Key

The Best Time-Saving AutoHotkey Tricks You Should Be Using
If you spend a lot of time on the social web, you'll probably need to shorten links on a fairly regular basis, and while most Twitter clients support short URLs natively, if you aren't using a client, or just want to shorten a URL to use somewhere else, you can easily setup an AutoHotkey script to generate a short URL with a shortcut key. The script essentially automates the process of creating a short URL using bit.ly by taking the URL off the clipboard, creating a new tab in your browser that generates the short URL and copies it to your clipboard.

Make Your Caps Lock Key More Useful

The Best Time-Saving AutoHotkey Tricks You Should Be UsingFor most of us, the caps lock key is one of the most useless keys on the keyboard—unless you're a screaming forum brat or doing data entry work, it's something that most of us probably never use, and accidentally trigger far too often. It's easy enough to disable the caps lock key with a registry hack or kill it with an AutoHotkey script, but why not put it to good use instead?

Use Your Caps Lock Key as a Navigation Tool: You've got numerous options, but perhaps the most interesting one is to turn the caps lock key into a hand-friendly text navigation tool—essentially, you hold down the caps lock key while using other keys like J, K, or L to move the cursor left, right, up, or down—there's a whole slew of different keys in the script, and you can customize it as much as you want.

Minimize Active Windows with Caps Lock: If that's a little more than you want to deal with, you can turn your Caps lock key into a dedicated minimize button with this simple script, which minimizes the active window whenever you hit the Caps lock key:

Capslock::WinMinimize,A

Want to do something else with it? You can use the TabsLock script to put your browser a keystroke away, or re-assign Caps lock to mute the Windows sounds instead.


What are your favorite AutoHotkey scripts and techniques? Share your expertise with your fellow readers in the comments.


The How-To Geek loves automating his PC with AutoHotkey. His geeky articles can be found daily here on Lifehacker, How-To Geek, and Twitter.

Number of comments
  • Share this:

Tidak ada komentar:

Posting Komentar