dock problem...

jmclaughlin
New Contributor

Okay, so this is the latest status on my dock problem. I have this script
which I can run locally on any given user and it will create a dock item
for any of these programs that are present on the system. However, it
will not work if I launch it through Casper. As you can see, I've tried
many different methods to get defaults to work for the logged in user but
all I see is the dock relaunching. Does anyone have any ideas? Has
anyone done anything like this?

#!/bin/sh

# Applications
user=ls -l /dev/console | cut -d " " -f 4
username=/usr/bin/w | grep console | awk '{print $1}'
current_user=/usr/bin/finger -s -l | grep Login | awk '{print $2}'
kid_pix="/Applications/Kid Pix Deluxe 4"
ttl="/Applications/Type To Learn 3"
kidspiration="/Applications/Kidspiration 2" inspiration="/Applications/Inspiration 8"

echo "3=$3"
echo "user=$user"
echo "username=$username"
echo "current_user=$current_user"
#sleep 20

if [[ -e "$kid_pix" ]]; then
su $user defaults write /Users/macuser/Library/Preferences/com.apple.dock
persistent-apps -array-add
"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Kid
Pix Deluxe 4/Kid Pix Deluxe
4/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
fi

if [[ -e "$kidspiration" ]]; then
su "$user" defaults write /Users/$user/Library/Preferences/com.apple.dock
persistent-apps -array-add
"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Kidspiration
2/Kidspiration
2.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
fi

if [[ -e "$inspiration" ]]; then
defaults write /Users/"$user"/Library/Preferences/com.apple.dock
persistent-apps -array-add
"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Inspiration
8/Inspiration
8.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
fi

if [[ -e "$ttl" ]]; then
defaults write /Users/$current_user/Library/Preferences/com.apple.dock
persistent-apps -array-add
"<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Type
To Learn 3/Type To Learn
3/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
fi

killall Dock

exit 0

John McLaughlin
Technical Support Specialist
Newton Public Schools

0 REPLIES 0