Skip to content

Instantly share code, notes, and snippets.

@gingerhendrix
Created March 7, 2011 22:51
Show Gist options
  • Save gingerhendrix/859434 to your computer and use it in GitHub Desktop.
Save gingerhendrix/859434 to your computer and use it in GitHub Desktop.
Applescript to get the name of the foreground App
set AppleScript's text item delimiters to ":"
set front_app to front_app's text items
set AppleScript's text item delimiters to {""} --> restore delimiters to default value
set item_num to (count of front_app) - 1
--display dialog item_num
--display dialog item item_num of front_app
set app_name to item item_num of front_app
set AppleScript's text item delimiters to "."
set app_name to app_name's text items
set AppleScript's text item delimiters to {""} --> restore delimiters to default value
--display dialog item 1 of app_name
set MyApp to item 1 of app_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment