Noah Coad
Open Clipboard Contents Hotkey



I find it particularly useful to be able to copy a file, folder, URL, or search term to the clipboard and then with one hotkey, open it up.  Here is the script I use with AutoHotkey to assign Win+O to open whatever’s in the clipboard.

First it checks to see if the clipboard contains a file, folder, or program that exists on disk.  If not, is it appear to be a URL?  And if not, just Google the clipboard contents.

; Execute the contents of the clipboard, Win+O
#o::
  contents = %clipboard%
  StringSplit, SplitArray, contents, `n
  Loop, %SplitArray0%
  {
    _line := SplitArray%a_index%
    
    ; First attempt a shell execute
    Run, %_line%,, UseErrorLevel

    ; If that didn't work, try something else
    if (ErrorLevel = "ERROR")
    {
      ; Does the clipboard contain a URL?
      FoundPos := RegExMatch(_line, "A)\w[^\s]*\.(?:com|co|uk|gov|edu|tv|net|org|tel|me|us|mobi|es)(?:\z|/.*)\z")
      if FoundPos 
        Run "%UserProfile%\AppData\Local\Google\Chrome\Application\chrome.exe" %_line%
      else 
        Run http://google.com/search?q=%_line%
    }
  }
return

It is also designed to open multiple items if separated by a carriage return, for example:

http://coad.net
http://facebook.com
http://noahcoad.com
Hotkey to Instantly Play Music in iTunes

I’m usually too distracted by other work to remember to kick-off some music in the background.  Usually because it’d mean launching iTunes, waiting for it to load, finding a playlist to start, and kicking it off.  So I’ve created a single global hotkey to instantly load iTunes and start playing music.  Here’s how:

  1. Get the Tools
    Have a master AutoHotKey hotkey file and set PowerShell to autoload my little iTunes.ps1 library on PowerShell startup.  With these two it makes it real easy to assign hotkeys to various iTunes commands.
  2. Create a “PlayHotkey” Playlist in iTunes
    Just a playlist to be kicked off when the hotkey is pressed.  I’ve got mine set to shuffle unplayed tracks.
  3. Add AutoHotkey Line
    What enables this line to be so simple is that there is a itPlaylist function in the above iTunes.ps1 file that gets auto loaded as part of step 1.
    ; Play Music NOW with Win+Alt+P
    #!p:: Run powershell -command (itPlaylist('PlayHotkey')).PlayFirstTrack(),,Hide

My full script: MediaKeys.ahk
Related posts: Hotkey to Play/Pause/Next iTunes TracksHotkey to Rate an iTunes Track 

p.s. Another option is to just launch Pandora with a hotkey.
#!p:: Run http://pandora.com

Hotkey to Play/Pause/Next iTunes Tracks

If your keyboard doesn’t have media keys (like my MacBook or fav Dell keyboard), then its nice to have simple global hotkeys to play/pause a track, move to the next track, and maybe even increase/decrease volume.

Below is the script that will assign these keys:

  • Play/Pause: Win+Alt+Space or Win+Alt+Left
  • Next Track: Win+Alt+Right
  • Volume Up: Win+Alt+Up
  • Volume Down: Win+Alt+Down

AutoHotkey makes this real easy! Just add this to your .ahk AutoHotkey file:

; Media Keys AutoHotkey Script by Noah Coad, started in 2008, http://coad.net

; #=Win ^=Ctrl +=Shift !=Alt

; Volume Up & Down, Win+Alt+Up & Win+Alt+Down
#!Up::  send {Volume_Up}
#!Down::  send {Volume_Down}

; Media Pause/Play, Win+Alt+Space or Win+Alt+Left
#!Space::
#!Left::
Media_Play_Pause:: IfWinExist, iTunes ahk_class ITWindow { ControlSend ahk_parent, {shift} sleep 100 ControlSend ahk_parent, ^{space} } else { Suspend On SendPlay {Media_Play_Pause} Suspend Off } return ; Media Next, Win+Alt+Right #!Right:: Media_Next:: IfWinExist, iTunes ahk_class ITWindow { ControlSend ahk_parent, {shift} sleep 100 ControlSend ahk_parent, ^{right} } else { Suspend On SendInput {Media_Next} Suspend Off } return

Here is my full script: MediaKeys.ahk
Related posts: Hotkey to Rate an iTunes TrackHotkey to Instantly Play Music in iTunes

Hotkey to Rate an iTunes Track

Do you rate your tracks in iTunes?  Ever find it a slight pain to swap back over to iTunes while working on something important just to rate a playing track?  Here’s how to set up global hotkeys to rate a track from anywhere (Windows XP or newer).  Like Win+Alt+1 for one star, Win+Alt+2 for two, etc.

  1. Get the Tools
    Have a master AutoHotKey hotkey file and set PowerShell to autoload my little iTunes.ps1 library on PowerShell startup.  With these two it makes it real easy to assign hotkeys to various iTunes commands.
  2. Add the AutoHotkey Lines
    What enables this line to be so simple is that there is a itPlaylist function in the above iTunes.ps1 file that gets auto loaded as part of step 1.
    ; Rate the currently playing song 1 to 5 stars with Win+Alt+#
    #!1:: Run powershell -command (itunes).CurrentTrack.Rating = 20,,Hide
    #!2:: Run powershell -command (itunes).CurrentTrack.Rating = 40,,Hide
    #!3:: Run powershell -command (itunes).CurrentTrack.Rating = 60,,Hide
    #!4:: Run powershell -command (itunes).CurrentTrack.Rating = 80,,Hide
    #!5:: Run powershell -command (itunes).CurrentTrack.Rating = 100,,Hide

That’s it!  Then with just one keystroke you can rate the current song from any app without switching over to iTunes.

My full script: MediaKeys.ahk 
Related posts: Hotkey to Instantly Play Music in iTunesHotkey to Play/Pause/Next iTunes Tracks 

Hotkeys to OneNote Pages

If you like using Microsoft OneNote (which rocks!), you’ve got some favorite pages, and you like hotkeys, then this is for you!  Here’s how to create PC global hotkeys to open OneNote and jump to specific pages, sections, notebooks, or paragraphs.

I’ve got about a dozen main pages that I rapidly switch between, like my work TO DO list, personal TO DO, my list of topics to cover with people when I talk to them, blog topics list, my Stream of Conciousness pages, etc.  With this tip it’s just one hotkey to any of those pages at anytime (not just within OneNote).

The magic lies with the fact that OneNote rocks when it comes to being able to link to tabs, pages, or paragraphs.  Just right-click on any of these to “Copy Link to _____”.  Then use AutoHotKey (open source, my review) to assign a hotkey to that link.  As an example, here are two of my links in my hotkeys.ahk file that runs at Windows startup/login.  I use Win+Shift+<letter> for my OneNote pages.  Like Win+Shift+T for my TO DO list.  

; ==========================================================================================
; == OneNote Pages
; ==========================================================================================

; ^=Ctrl #=Win +=Shift !=Alt

; Open OneNote 'Projects', Win+Shift+P
#+p::  Run `onenote:///\\MACKIE\Noah\Data\OneNote\General\General.one§ion-id={1DB1BA6E-8FC5-46FC-8754-0CE815E0CA65}&page-id={5FE75ECE-8A80-487F-8B8C-566985366839}&end`

; Open OneNote 'LifeNexust Meeting Stream', Win+Shift+M
#+m::  Run `onenote:///C:\Noah\Data\OneNote\LifeNexus\Meetings.one#Meeting Stream§ion-id={849D7425-454F-4C0E-9F72-D09DA589147D}&page-id={4346888C-E602-4AC3-A637-AA0033AB092C}&end`

So if you use OneNote much and like hotkeys, give this a try.  I use these hotkeys many dozens of times a day.  Also don’t forget to check out the OneNote iOS app and the ability to share OneNote notebooks with others.

Update (7/20/2011): If there are spaces in the path to your notebook, AutoHotKey won’t like the %20 used to represent a space.  So just replace %20 with a space, for example “…OneNote%20Notebooks…” would be “…OneNote Notebooks…”.