Skip to content

Instantly share code, notes, and snippets.

@hovsater
Created November 14, 2012 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hovsater/4072890 to your computer and use it in GitHub Desktop.
Save hovsater/4072890 to your computer and use it in GitHub Desktop.
Populate/Repopulate Alfreds text field
# I have seen several requests from developers trying to populate/repopulate
# Alfreds text field with another value. While this is not a native solution,
# it's still suffice quite well.
#
# Explaination
#
# In order to get access to Alfreds windows, it must be toggled. We can achieve
# that by triggering the hotkey specified for Alfred. When toggled, it's as easy
# as just setting a new value for the first text field of window 1.
#
#
# This snippet will populate Alfred with a IMDB search for the movie
# The Green Mile. It assumes the hotkey is COMMAND + SPACE.
tell application "System Events"
keystroke " " using command down
tell process "Alfred" to set value of text field 1 of window 1 to "imdb The Green Mile"
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment