MacNN Forums (http://forums.macnn.com/)
-   Classic Macs and Mac OS (http://forums.macnn.com/classic-macs-and-mac-os/)
-   -   AppleScript (OS 9) (http://forums.macnn.com/64/classic-macs-and-mac-os/127561/applescript-os-9-a/)

 
AndreasF Oct 14, 2002 11:36 AM
AppleScript (OS 9)
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
 
AndreasF 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.
 
Cipher13 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.
 
AndreasF 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!
 
Cipher13 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'.
 
AndreasF 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`?
 
Cipher13 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.
 
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.


Content Relevant URLs by vBSEO 3.3.2