AppleScript (OS 9)
I need an AppleScript that deletes every file in a certain folder on my harddisk!
I have tried but no success this far...
Ok! So I solved it, not to hard even for a newbie.
Now here comes the real problem. I would want to execute the script on system shutdown.
I have links to servers on my network in my system folder:servers. They causes severe damage to my computer when starting up without network plugged in.
Tell application "Finder"
Delete contents of folder "blah" of startup disk
etc... but you've already got that.
Save it as an applet, don't show startup screen, etc, etc, and put it in /System Folder/Shutdown Items. If the folder doesn't exist, create it.
--Save it as an applet, don't show startup screen, etc, etc, and put --it in /System Folder/Shutdown Items.
The script works in the sense that it deletes the files but it does not shutdown the computer! And it would also be good if i was not asked if I want to execute the script.
Thanx for your help!
Yeah, as I said, set it to 'don't show startup screen' and it won't ask you to run it.
When you shut down, it'll execute, and then the computer will finish shutting down. If not, add the line "shut down" to the script, before 'end tell'.
Sorry, you were right!
One weird thing still though. If I have an application running when i shut down the computer it works perfect. But if it is no application running it empties the folder but it does not turn off the computer. Anyway IŽll fix that by cheating in some way.
While we are into applescript IŽll ask another question. I would want another script to create a folder with todays date, everytime I run it.
Do you have any suggestions`?
It won't work if there's nothing running? That's very odd... which script are you using? The one with 'shutdown' appended, or the one without it?
tell application "Finder"
Not sure if 'end try' needs to be there - I don't think it does. I can't check right now, not on a Mac.
I can't really help with the other question at the moment. When I'm back on the OS9 machine I'll make the script for you.
|All times are GMT -4. The time now is 08:26 AM.||
Copyright © 2005-2007 MacNN. All rights reserved.
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2016, vBulletin Solutions, Inc.