Need help with troubleshooting startup desktop clean-up/remove script

Discussion in 'Mac Programming' started by Dark09, Jan 14, 2014.

  1. Dark09 macrumors newbie

    Joined:
    Oct 23, 2012
    #1
    I've been working on this script all day (first real apple script) and I've been able to get this to run from the root of the volume, but not under /usr/bin, so I tried creating a separate folder and used chown, but so far i'm still not able to clear out my desktop...

    The purpose of this script is for this to be part of the net restore deployment image and for this apple script to generate the files to be used to create a startup/login item to clear the users desktop.

    Any help on getting this script to work would be epic!

    Here's what i've build thus far:

    Code:
    do shell script "mkdir /usr/bin/cleardesktop" with administrator privileges
    do shell script "chown root:staff /usr/bin/cleardesktop" with administrator privileges
    do shell script "touch /usr/bin/cleardesktop/cleardesktop.command" with administrator privileges
    do shell script "echo \"#!/bin/bash\" > /usr/bin/cleardesktop/cleardesktop.command" with administrator privileges
    do shell script "echo \"rm -rf ~/Desktop/\" >> /usr/bin/cleardesktop/cleardesktop.command" with administrator privileges
    do shell script "chmod +x /usr/bin/cleardesktop/cleardesktop.command" with administrator privileges
    do shell script "chmod 777 /usr/bin/cleardesktop/cleardesktop.command" with administrator privileges
    #####do shell script "chown root:staff /usr/bin/cleardesktop/cleardesktop.command" with administrator privileges
    do shell script "mkdir /System/Library/StartupItems/cleardesktop.command" with administrator privileges
    do shell script "ln -s /usr/bin/cleardesktop/cleardesktop.command /System/Library/StartupItems/cleardesktop.command/cleardesktop.command" with administrator privileges
    
     
  2. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #2

Share This Page