Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Enthusiast Zone > Classic Macs and Mac OS > AppleScript (OS 9)

AppleScript (OS 9)
Thread Tools
Fresh-Faced Recruit
Join Date: Sep 2002
Location: Stockholm
Status: Offline
Reply With Quote
Oct 14, 2002, 11:36 AM
 
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
Reply With Quote
Oct 15, 2002, 04:32 AM
 
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.
     
Clinically Insane
Join Date: Apr 2000
Status: Offline
Reply With Quote
Oct 15, 2002, 10:09 AM
 
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
Reply With Quote
Oct 16, 2002, 03:20 AM
 
--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!
     
Clinically Insane
Join Date: Apr 2000
Status: Offline
Reply With Quote
Oct 16, 2002, 04:32 AM
 
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
Reply With Quote
Oct 16, 2002, 09:51 AM
 
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`?
     
Clinically Insane
Join Date: Apr 2000
Status: Offline
Reply With Quote
Oct 20, 2002, 09:40 AM
 
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.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -4. The time now is 12:08 AM.
All contents of these forums © 1995-2015 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2015, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2