• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Script to replace lost file extension
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script to replace lost file extension


  • Subject: Re: Script to replace lost file extension
  • From: Brett Conlon <email@hidden>
  • Date: Wed, 25 Apr 2007 09:39:23 +1100


Or as kai more succinctly just amended it (we're conversing off list) <:-}

on CheckImgsFldr(ThisItem, aFolder)
        activate
        tell application "Finder" to tell (first folder of folder ThisItem whose name contains "Images")
                if not (exists) then tell me to return display dialog ¬
                        "Can't check for foreign files because an images folder could not be found in folder \"" & ¬
                        aFolder & "\"." buttons {"OK"} default button 1 with icon caution with title aFolder
                tell (document files of entire contents where ¬
                        file type is not in {"EPSF", "TIFF", "EPSP", "JPEG"} and ¬
                        kind is not in {"EPS File", "Adobe Photoshop TIFF file"})
                        set FailedCount to count
                        if FailedCount is 0 then return
                        select
                        script FileData
                                property NameList : name
                                property TypeList : file type
                                property KindList : kind
                        end script
                end tell
        end tell
        set text item delimiters to return
        tell FileData to repeat with i from 1 to FailedCount
                set its NameList's item i to its NameList's item i & ¬
                        {"", "                 [TYPE: " & its TypeList's item i & "]", ¬
                                "                 [KIND: " & its KindList's item i & "]"}
        end repeat
        set text item delimiters to return & return
        if FailedCount is 1 then
                set msg to "The following file"
        else
                set msg to "The following " & FailedCount & " files"
        end if
        set msg to msg & " (selected for your convenience) may not belong in your Images folder:" & ¬
                {"", FileData's NameList as text, ""}
        set text item delimiters to {""}
        beep
        if button returned of (display dialog msg buttons {"Cancel", "Fix now", "Fix at end"} ¬
                default button 1 with title aFolder) is "Fix now" then FixNow()
end CheckImgsFldr

Damn I love his brain!  :-}

Coj


Brett Conlon <email@hidden>
Sent by: applescript-users-bounces+brett.conlon=email@hidden

25/04/07 08:03 AM

To
email@hidden
cc
Subject
Re: Script to replace lost file extension






This is a handler from a script I just recently finished, with the help of this list, that I use for checking image files in a graphic design job folder. You could repurpose it to whatever you like:



on
CheckImgsFldr(ThisItem, aFolder)
<SNIPPED>
end
CheckImgsFldr

Cheers,


Cojcolds



"Stockly, Ed" <email@hidden>
Sent by: applescript-users-bounces+brett.conlon=email@hidden

25/04/07 04:44 AM


To
<email@hidden>
cc
Subject
Re: Script to replace lost file extension









>>> There must be a shell script that can determine what a file's extension was.


I don't think so, but there may be an AppleScript solution.

Ask finder for the file type and creator type. You may get a result that
could tell you what extension to use.

You may need to do some trial and error, and this would only work with those
files you've mapped a file/creator types to a specific extension, but it
should work if you're not dealing with an unlimited variety of file types.

If you're interested I could post a sample of how it would work.

HTH,

ES

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

This email sent to email@hidden

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

This email sent to email@hidden

References: 
 >Re: Script to replace lost file extension (From: Brett Conlon <email@hidden>)

  • Prev by Date: Redirect e-mail
  • Next by Date: Re: Using the 'Create Archive' - File Menu Command
  • Previous by thread: Re: Script to replace lost file extension
  • Next by thread: Using the 'Create Archive' - File Menu Command
  • Index(es):
    • Date
    • Thread