|
|
AppleScript (OS 9)
|
|
|
|
Fresh-Faced Recruit
Join Date: Sep 2002
Location: Stockholm
Status:
Offline
|
|
Hello!
I need an AppleScript that deletes every file in a certain folder on my harddisk!
I have tried but no success this far...
Any suggestions?
thanx
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Sep 2002
Location: Stockholm
Status:
Offline
|
|
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.
|
|
|
|
|
|
|
|
|
Registered User
Join Date: Apr 2000
Status:
Offline
|
|
Tell application "Finder"
Delete contents of folder "blah" of startup disk
Empty trash
End tell
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.
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Sep 2002
Location: Stockholm
Status:
Offline
|
|
--Save it as an applet, don't show startup screen, etc, etc, and put --it in /System Folder/Shutdown Items.
done that!
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!
|
|
|
|
|
|
|
|
|
Registered User
Join Date: Apr 2000
Status:
Offline
|
|
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'.
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Sep 2002
Location: Stockholm
Status:
Offline
|
|
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`?
|
|
|
|
|
|
|
|
|
Registered User
Join Date: Apr 2000
Status:
Offline
|
|
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?
Try this:
On run
try
tell application "Finder"
blah
end tell
end try
end run
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|