Skip to content

Instantly share code, notes, and snippets.

@jazzychad
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save jazzychad/57938bc656abec5da374 to your computer and use it in GitHub Desktop.

Select an option

Save jazzychad/57938bc656abec5da374 to your computer and use it in GitHub Desktop.
user input prompt
# if you want to capture some kind of user input during a script (e.g. Xcode Run Script Phase) you can use this neato trick
#
# it will give up after 20 seconds of no input and return an empty string, in the case you you hit Build and just walk away
#
# note: only works on macs b/c it uses AppleScript
echo -n $(osascript -e 'set notes to the text returned of (display dialog "Build Notes" default answer "" buttons {"OK"} giving up after 20)')
# e.g.
BUILD_NOTES=`echo -n $(osascript -e 'set notes to the text returned of (display dialog "Build Notes" default answer "" buttons {"OK"} giving up after 20)')`
# then use $BUILD_NOTES elsewhere to store the input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment