Skip to content

Instantly share code, notes, and snippets.

@drewdiver
Created August 14, 2018 14:11
Show Gist options
  • Save drewdiver/c70330a5162f5c137e62f9bdb594468e to your computer and use it in GitHub Desktop.
Save drewdiver/c70330a5162f5c137e62f9bdb594468e to your computer and use it in GitHub Desktop.
set processName to text returned of ¬
(display dialog ¬
"Enter process name" default answer ¬
"Preview" buttons {"OK", "Cancel"} default button 1)
tell application "System Events"
if exists (window 1 of process processName) then
tell process processName
set visible to true
return every UI element of front window
return name of every UI element of front window
end tell
else
display dialog "Process \"" & processName & "\" not found! Is the application running?"
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment