mirror of
https://github.com/mtan93/dialog-scripts.git
synced 2026-03-08 05:31:54 +00:00
Rename displayAppleScriptFunction.sh to dialogAppleScriptFunction.sh
This commit is contained in:
15
dialogAppleScriptFunction.sh
Normal file
15
dialogAppleScriptFunction.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
# this function is Bash compatible, insert the function in your script and then place displayAppleScript where you want it to be executed
|
||||
|
||||
displayAppleScript(){
|
||||
message="A problem was encountered setting up this Mac. Please contact IT."
|
||||
currentUser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ { print $3 }')
|
||||
if [[ "$currentUser" != "" ]]; then
|
||||
currentUserID=$(id -u "$currentUser")
|
||||
launchctl asuser "$currentUserID" /usr/bin/osascript <<-EndOfScript
|
||||
button returned of ¬
|
||||
(display dialog "$message" ¬
|
||||
buttons {"OK"} ¬
|
||||
default button "OK")
|
||||
EndOfScript # this line *must* use tabs and not spaces. Ensure your text editor does not change them.
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user