tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" )
EOF
return 0
;;
toggle|*)
osascript 1>/dev/null 2>&1 <<-EOF
tell application "System Events" to perform action "AXPress" of (button 2 of process "iTunes"'s window "iTunes"'s scroll area 1)
EOF
return 0
;;
esac
;;
""|-h|--help)
""|-h|--help)
echo"Usage: itunes <option>"
echo"Usage: itunes <option>"
echo"option:"
echo"option:"
echo"\tlaunch|play|pause|stop|rewind|resume|quit"
echo"\tlaunch|play|pause|stop|rewind|resume|quit"
echo"\tmute|unmute\tcontrol volume set"
echo"\tmute|unmute\tcontrol volume set"
echo"\tnext|previous\tplay next or previous track"
echo"\tnext|previous\tplay next or previous track"
echo"\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
echo"\tvol\tSet the volume, takes an argument from 0 to 100"
echo"\tvol\tSet the volume, takes an argument from 0 to 100"