I want to automate printer installation with a variable. I've used an old script that pops up a window where the user can type his or her username to be inserted in printer adress.
This works for most scenarios, but I want make a .pkg file with the Printerdriver included. There is alot of guides out there on how to add a printer from the command line etc. Also I tried Packages, but can't figure out how to create the variable for user input during installation.
Thanks!
Code:
name="$(osascript -e 'Tell application "System Events" to display dialog "Skriv in ditt användarnamn:" default answer ""' -e 'text returned of result' 2>/dev/null)" if [ $? -ne 0 ]; then # The user pressed Cancel exit 1 # exit with an error status elif [ -z "$name" ]; then # The user left the project name blank osascript -e 'Tell application "System Events" to display alert "Du måste ange ditt användarnamn; cancelling..." as warning' exit 1 # exit with an error status fi /usr/sbin/lpadmin -p "SmartPrint" -E -v http://192.168.10.5:8701/ipp/SmartPrint/$name -o cupsIPPSupplies=false -P "/Library/Printers/PPDs/Contents/Resources/KONICAMINOLTAC308.gz"
Thanks!