Create a login script on a single machine to create a file in library

Hi,

I am new to this, please be kind.

What I want to do is, have a script run when a user logs into their account. I would like the script to remove or delete a particular file in their /User/Library/Preferences folder.

I don’t understand scripting and I have just started to read some info about it. I would like to learn more and I think this is a great place to start, the problem is that I need this to be able to work now. I doesn’t seem to me that this is very difficult to do. So some help would be greatly appreciated.

The script would run on tiger machines (intel and PPC)

thanks

Here’s the code that should work, just uncomment the deletion method you would like to use.

set prefPath to path to preferences folder as Unicode text
set filePath to prefPath & "your filename here"

-- This block to move to trash
-- tell application "Finder" to move file filePath to trash

-- This block to delete and bypass trash
-- do shell script "/bin/rm " & quoted form of (POSIX path of filePath)

James,

Thanks so much for this.

I am a newbie to this so I hope that you understand.

How do I go about executing this on the machine? Do I add the path information for the file and then compile the script and then place the script into a folder? Or is there some exact place that it needs to go? I am also not sure what you mean by “uncomment the deletion method you would like to use”?

Sorry for the what I am sure are elementary questions, but I am hoping at the same time this will help further to understand how scripting works.

thanks

I realized the header on this subject should read:

Create a login script on a single machine to delete a file in Library.

Sorry about that.

So in my above script assuming that the file you wish to delete is not in a folder inside the Preferences folder than just replace the portion “your filename here” with your file name. Then compile the script and save it somewhere on the machine. I, as a mac SysAdmin, like putting all scripts and what not in /Library/Management on my end users machines. Anyways once you have the file there drag it into startup items for the account in question in System Preferences.

Hope that helps.

James,

Thank you very much.

Where would you suggest I start to get to know how to learn scripting?

Thanks again for your help, it is greatly appreciated.

Well there are a few good books on the AppleScript: The Definitive Guide and Sal is coming out with a book soon to. Aside from that there are a series of excellent tutorials on this website and I learned most of what I know from reading the forums here.