Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Check folder size - classes wrong???




On 6 Jul 2006, at 01:21, Brett Conlon wrote:

Here's an extract of my larger script of what I have but I get the below error. The "size checking" line is taken from an email Adam Bell posted to the list some time back:

on open folderList
        repeat with PickFolder in folderList
                CheckOrigSize(PickFolder)
        end repeat
end open

on CheckOrigSize(PickFolder)
tell application "Finder"
set aFolder to name of PickFolder
set ProdFldr to first folder of PickFolder whose name contains "Production"
set OrigFldr to first folder of ProdFldr whose name contains "Originals"
if ((size of (info for OrigFldr)) div 1048576) > 5 then beep 5
end tell
end CheckOrigSize



info for folder "Originals" of folder "3. Production" of folder "Job D11111 D22222 D52518 Davids Folder Template" of disk "TECH"
"Finder got an error: File folder Originals wasn't found."



The File part worries me that I have my classes mixed up but I'm not sure how to resolve it.

The variable 'OrigFldr' represents a Finder reference, Coj. The 'info for' command won't understand this - until you coerce it to an alias or file reference.


I tried getting the properties of the folder but it said that the size value was missing...

Yeah, Finder sometimes needs a second crack at getting the size property...


Try something like:

----------------

to CheckOrigSize(PickFolder)
tell application "Finder"
set ProdFldr to first folder of PickFolder whose name contains "Production"
set OrigFldr to (first folder of ProdFldr whose name contains "Originals") as alias
end tell
if size of (info for OrigFldr) > 6291455 then beep 5
end CheckOrigSize


----------------

---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden
References: 
 >Check folder size - classes wrong??? (From: Brett Conlon <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.