Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
Created July 31, 2019 22:41
Show Gist options
  • Select an option

  • Save talkingmoose/741dfb077353191b35296135759eb4d1 to your computer and use it in GitHub Desktop.

Select an option

Save talkingmoose/741dfb077353191b35296135759eb4d1 to your computer and use it in GitHub Desktop.
Method for returning both text and button from osascript dialog
#!/bin/bash
results=$( /usr/bin/osascript -e "display dialog \"Text and Buttons!\" default answer \"Some text...\" buttons {\"Cancel\",\"OK\"} default button {\"OK\"}" )
theButton=$( echo "$results" | /usr/bin/awk -F "button returned:|," '{print $2}' )
theText=$( echo "$results" | /usr/bin/awk -F "text returned:" '{print $2}' )
echo $theButton
echo $theText
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment