Applescript is really easy to use. Even if you know nothing about it,
you can at the very least write a script to simulate keystrokes for
you so that you can execute a whole series of actions with a single
trigger in QS.
Telling Applescript to simulate keystrokes for you is as simple as
opening Script Editor.app and entering something like this into it:
tell application "System Events" to keystroke "P" using {command down}
This line of code will press ⌘P for you. You can string a series of
keystrokes together using code like this:
tell application "System Events"
keystroke "A" using {command down}
keystroke "S" using {command down, option down}
keystroke "1"
keystroke ";" using {shift down}
keystroke ":"
end tell
The first keystroke is ⌘A, the second is ⌘⌥S, the third is simply 1,
and the fourth and fifth both type a colon, since holding the shift
key makes the semicolon key type a colon.
Now, so far we have only tried typing letters, numbers, and
punctuation. What if you want to press an arrow key, the return key, a
function key, etc.?
Instead of the "keystroke" command, use the "key code" command. That
will allow you to press just about any key on the keyboard. Here is
an example:
tell application "System Events" to key code 35 using {command down}
This line of code also presses ⌘P for you. 35 is the actual numeric
code for the P key. You can learn the key code for any key on your
keyboard by downloading a little app called Full Key Codes from
http://softwares.bajram.com/utilities/. Open this app, press any key,
and it will show you the key code in blue in the lower right corner of
its window. (It will also show you some other information, but you can
ignore the rest.) Use that code number in your Applescript, and you
can simulate just about any series of keyboard commands you want.
As a note of explanation, the reason these commands always start with
'tell application "System Events"' is because only the background
process named System Events can simulate pressing keys on your
keyboard. As you start learning Applescript, you will discover that
many applications can each be told to do many different things.