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: Testing for a specific value in a folder name




Many thanks to all who kindly responded.

I'll be keeping all suggestions on file for future reference.

What I ended up running with is the following:

on run
        tell application "Finder"
                set PickFolder to choose folder
        end tell
        CheckDNum(PickFolder)
end run

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

on CheckDNum(PickFolder)
        tell application "Finder"
                set aFolder to name of PickFolder
                set OutputFldr to first folder of PickFolder whose name contains "Output"
                set OutputFiles to (name of every file of entire contents of OutputFldr) as string
                --Get DNos from Files and compare it with Archive Folder.
                set Dnum to {}
                repeat with chunk in (every word of OutputFiles)
                        considering case -- we are looking for capitals
                                if item 1 of chunk is "D" then
                                        if length of chunk is in {5, 6} then -- is it the right length?
                                                try
                                                        (text 2 thru -1 of chunk) * 1 -- is the remainder a number?
                                                        set end of Dnum to chunk as Unicode text
                                                end try
                                        end if
                                end if
                        end considering
                end repeat
                repeat with checkDno in (every item of Dnum)
                        if not (aFolder contains checkDno) then
                                display dialog "Missing D Num [" & checkDno & "] from Archiving folder"
                        end if
                end repeat
        end tell
end CheckDNum

I'll work it a little more and add other checks but this is a great start!

Cheers,

Coj
 _______________________________________________
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: 
 >Re: Testing for a specific value in a folder name (From: Axel Luttgens <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.