Alfred 5.5 is here - Find out what's new

Script Environment Variables

In the script environment data you'll find useful alfred_ variables to get commonly required Alfred information from the user's settings.

These are accessed like other variables, with one difference: in Alfred objects, the format is {const:myvariable}.

Below is a list of the variables with examples of what you can expect this data to look like.


The location of Alfred.alfredpreferences. If a user has synced their settings, this will allow you to find out where their settings are regardless of sync state.


Local (Mac-specific) preferences are stored within Alfred.alfredpreferences under …/preferences/local/[alfred_preferences_localhash]


Current theme used.


If you're creating icons on the fly, this allows you to find out the colour of the theme background.


The colour of the selected result.


The subtext mode the user has selected in the Appearance preferences.

Usability note: This is available so developers can tweak the result text based on the user's selected mode, but a workflow's result text should not be bloated unnecessarily based on this, as the main reason users generally hide the subtext is to make Alfred look cleaner.

alfred_version and alfred_version_build

Find out which version and build the user is running. This may be useful if your workflow depends on a particular Alfred version's features.


Bundle Identifier of the running workflow.

alfred_workflow_cache and alfred_workflow_data

These are the recommended locations for volatile and non-volatile workflow data:

  • Cache: ~/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/[bundle id]
  • Data: ~/Library/Application Support/Alfred/Workflow Data/[bundle id]

Note that these two will only be populated if your workflow has a bundle id set.


Name of the running workflow.


Description of the running workflow.


Unique ID of the running workflow.


Version of the running workflow.


If the user currently has the debug panel open for this workflow. This variable is only set if the user is debugging, and is set to value 1.


The keyword text used to start an action. Exclusive to the Script Filter Input.

Script Environment Variables Example

Example of what you can expect from the data:

"alfred_preferences" = "/Users/Crayons/Dropbox/Alfred/Alfred.alfredpreferences";
"alfred_preferences_localhash" = adbd4f66bc3ae8493832af61a41ee609b20d8705;
"alfred_theme" = "alfred.theme.yosemite";
"alfred_theme_background" = "rgba(255,255,255,0.98)";
"alfred_theme_subtext" = "3";
"alfred_version" = "5.0";
"alfred_version_build" = "2058";
"alfred_workflow_bundleid" = "com.alfredapp.googlesuggest";
"alfred_workflow_cache" = "/Users/Crayons/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.alfredapp.googlesuggest";
"alfred_workflow_data" = "/Users/Crayons/Library/Application Support/Alfred/Workflow Data/com.alfredapp.googlesuggest";
"alfred_workflow_name" = "Google Suggest";
"alfred_workflow_version" = "1.7";
"alfred_workflow_uid" = "user.workflow.B0AC54EC-601C-479A-9428-01F9FD732959";
"alfred_debug" = 1;

Latest Blog Post:

Watch Alfred Videos on YouTube

CacheFly Campaign Monitor

"Alfred" is a registered trademark of Running with Crayons Ltd. ©2024 Running with Crayons Ltd. All rights reserved.

Terms & Conditions, Privacy Policy, Cookies.