It appears that no one has a clue how to pull this one off, so here's
a temporary hack I came up with until a better solution pops:

1. Create a new HotKey trigger in QS.
2. When the trigger windows opens, type . (period) to switch to text
mode and paste the code below:

Code:

-- `click_n_back`, by Micha Kaufman, December 2008
--
-- Find which application is currently in focus

set front_app to (path to frontmost application as Unicode text)

-- Send keystoke to different application

tell application "Last.fm" to activate
delay 0.5
tell application "System Events"
        key code 124 using command down
end tell

-- Return to previous application

tell application front_app
        activate
end tell



3. Then hit 'tab' to move to 'action' and choose 'Run as AppleScript'.
You are almost done.
4. Choose a shortcut for your new trigger, for example: ^⌥⌘0 (Ctrl+Opt
+Cmd+0)

In this example the code sends Command+Right-Arrow to Last.fm player,
which is the shortcut for song skip. Note that sometimes you can do
without the delay part of the code, but some apps require a little
time in focus in order to receive keystrokes

That's it. No matter what you are working on, whenever you click your
key combination (^⌥⌘0) the Last.fm player will skip to the next song.
The code causes a brief switch to the Last.fm player, but then returns
to what you were working on before automatically.

You can find key codes for your keyboard using a free app called
"Ukelele". You can also use 'keystroke' instead of 'key code' to avoid
finding out the key codes. I will be happy to explain how if anyone
wants to know.

Of course this script applies to other apps as well - Last.fm was just
used for this example.

Enjoy

Reply via email to