It is a Google search shortcut. Activate it, and you have a text field ready to search Google. I'm planning to use Spark to run the script.
The first part was easy, getting "Google" selected in LaunchBar. Seemed to work fine.
I couldn't figure out how to get LaunchBar to focus the text field, though. I tried a manual keypress through System Events, but for some reason that activates the Edit Text action with "Google" entered in the field.
Here's my initial script:
Code: Select all
tell application "LaunchBar"
activate
set selection as text to "Google"
tell application "System Events"
keystroke space
end tell
end tell
A second attempt that works OK, but relies way too much on UI scripting. Definitely the hit-it-with-a-hammer solution, and I'm not pleased with it.
Code: Select all
tell application "LaunchBar"
activate
--delay so we don't mix the keyboard input of
--launching this script with the keystrokes
--below. what a mess :)
delay 0.2
if has keyboard focus then
tell application "System Events"
keystroke "g"
keystroke "o"
keystroke "o"
keystroke "g"
keystroke "l"
keystroke "e"
keystroke space
end tell
end if
end tell
I'm hoping there's something I can pass to LaunchBar to activate that text field so it's ready for text entry.
Any experts out there?