Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
Last active September 15, 2016 21:54
Show Gist options
  • Select an option

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

Select an option

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