Get keyboard input without using dialog or textbox

Hi,

I’m writing a script that searches for and plays tracks in iTunes. Right now I display a dialog with a textbox, and that’s how the search string is input.

I’d like to replicate something I did a long with ago on AutoHotKey on Windows, which was to get input from the keyboard straight away once the script was running, without displaying any dialog at all - so I’d start typing and then just press enter once finished.

Does anyone know if this is possible?

PS: I’d also like to define a system-wide shortcut to the script, but I can’t seem to get this to work.

Welcome.

This is not possible with plain AppleScript

You need a third party tool like Quicksilver, QuicKeys, FastScripts (I guess there are a few more)