Posted on 06-25-2019 10:40 AM
I have an osascript I want to wait for input before proceeding to next line, I THINK I need to do a set T in it but It keeps failing...
#!/bin/bash
loggedInUser=$(stat -f%Su /dev/console)
loggedInUID=$(id -u $loggedInUser)
if [[ "$loggedInUser" != "root" ]] && [[ "$loggedInUser" != "_mbsetup" ]]; then
## Create local script
cat << EOD > /private/tmp/computerrenamescript.sh
#!/bin/bash
TT=$(/usr/bin/osascript -e 'tell application "System Events" set T to set MacTYPE to text returned of (display dialog "Please input the machine type - " default answer "" with icon 2)')
BB=$(/usr/bin/osascript -e 'tell application "System Events" to set BRAND to text returned of (display dialog "Please input the brand - "" with icon 2)')
.
.
.
Any help is appreciated!
Posted on 06-25-2019 01:51 PM
Try your osascript lines like this:
TT=$(/usr/bin/osascript -e 'set MacTYPE to text returned of (display dialog "Please input the machine type - " default answer "" with icon 2)')
BB=$(/usr/bin/osascript -e 'set BRAND to text returned of (display dialog "Please input the brand - " default answer "" with icon 2)')
You shouldn't need 'tell application "System Events"' and you were missing the 'default answer ""' part of BB, but ended up with an extra '"'. I assume the '$' has something to do with this being written out to a file, so I left those.