My old OS 9 scripts need updating to OSX to run, and I’m trying the following but just get an error (it’s set to beep on error). The idea is that I have server logs emailed to me daily, sitting in a folder, and File Buddy shows the creator and type codes are blank, not even a “???”, just nothing. The logs are nested in various subfolders of a folder “ACCESS” and the first thing I’m trying to do it open them with StuffIt Expander, which works fine manually. Here’s the script - can someone tell me what might be wrong?
open (every file of every folder of “Macintosh HD:Documents:ACCESS LOGS:MAIN SITES:ACCESS” whose file type is “”) using “Macintosh HD:Applications:Utilities2:StuffIt Standard 8.0.2:StuffIt Expander”
–Thanks for any help, Rich
Well for a start those commands are Finder-specific and therefore need to be in a ‘tell application “Finder”’ block…
They are, I had just posted what I thought was the relevant part of the script. Entire script:
tell application “Finder”
open (every file of every folder of "Macintosh HD:Documents:ACCESS LOGS:MAIN SITES:ACCESS" whose file type is "") using "Macintosh HD:Applications:Utilities2:StuffIt Standard 8.0.2:StuffIt Expander"
I note a these problems:
- If you are using OS X with the standard folder setup, your path is wrong. In general, path to your Documents folder should be as follows
Hard disk:Users:Your user name:Documents:
searching for file types alone may not be reliable in OS X since Apple no longer requires the classic 4 character code we are so used to using. Many apps will not have a file type code either, so you need to modify scripts to look at the classic file type and add something for the file suffix type code ( e.g. MyLog.txt)
as entered in your post, you are specifying a folder in your script but the path does not end with a colon, as it shoud for a folder.
I am just getting back into Applescript having gotten a copy of Hanaan Rosenthal’s book on Applescript. I highly recommend it!
I didn’t know your second point about the codes under OSX. That’s really helpful to know about.