Wednesday, March 12, 2008

Taking Hotkeys a Step Further

·

Now that you've got an idea of how to create hotkeys the simple way, we'll move on to slightly more advanced hotkey creation. First, we'll create a simple hotkey that will open Lifehacker when we press Windows-l (who wouldn't rather read Lifehacker than lock their desktop?). Quite simply, it looks like this:

#l::Run, http://lifehacker.com/

In this example, we're using the Run command, which can take any target—from web URLs to files on your hard drive—and, quite simply, open them.

As a result, creating a keyboard shortcut to launch anything at all is a breeze. You can launch any program, document, or web page with a simple shortcut of your choosing. If you were creating an iTunes shortcut with Windows-i (where the Windows key equals the pound sign [#]), for example, it might look something like this:

#i::Run,%A_ProgramFiles%\iTunes\iTunes.exe

You'll noticed I introduced another concept here: variables. The variable %A_ProgramFiles% tells AutoHotkey to look in my default Program Files directory—in my case, "C:\Program Files". I could have just made the command Run, C:\Program Files\iTunes\iTunes.exe, but using the variable means that—assuming I've got iTunes installed—the same shortcut will work on other computers that have iTunes installed to the default directory, even if their home drive is D:\ or F:\. For more on variables, check out AutoHotkey's introduction to variables, along with their list of built-in variables (like %A_ProgramFiles%).

0 comments:

Post a Comment

Related Articles


Related Article Widget by Hoctro

About Me


嗨,我是花,居住在印度兴奋的Windows,Linux中国的外籍人士和所有高科技的东西

Hi, I am Hua, a chinese expat residing in India excited about windows, linux and all things tech

Receive updates for free

Enter your email address:

Delivered by FeedBurner

Mobile Version

Bookmark

Bookmark and Share

Blog Archive