Posted on 08-13-2014 05:10 AM
Okay I am trying what I thought would not be difficult. I see many articles showing how to use shell variable in osascript what I want is the opposite. I want to move a osascript variable out to a shell script.
So lets say I have this.
osascript<<END
display dialog "Are you ready to begin the installer" buttons {"Yes", "No"}
set the answer to the button returned of the result
END
How do I get answer out of the osascript into my shell. I have tried the following
Result=$(/usr/bin/osascript -e 'display dialog "Are you ready to begin the installer" buttons {"Yes", "No"}')
echo “${Results}”
what is echoed back is ""
The assistance of the community is appreciated.
Posted on 08-13-2014 06:45 AM
Not sure about osascript, but you can try using cocoadialog with the "yesno-msgbox" option.
Posted on 08-13-2014 06:55 AM
#!/bin/sh
Result=$(/usr/bin/osascript<<END
tell application "System Events"
activate
set the answer to the button returned of (display dialog "Are you ready to begin the installer" buttons {"Yes", "No"})
end tell
END)
echo "The button clicked was: $Result"
Posted on 08-13-2014 08:15 AM
@ifbell, your echoing out the $Results variable.. But are setting the $Result variable.
So that little "s" may have been it.