• 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
Setting filename of files and in subfolders
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting filename of files and in subfolders


  • Subject: Setting filename of files and in subfolders
  • From: "T.J. Mahaffey" <email@hidden>
  • Date: Mon, 14 May 2001 09:16:41 -0500

Ok, folks, I'm apparently not getting my logic right.
I'm using a previously circulated script, LabelWizard, as a basis for a new
script with slightly different functionality.

My problem lies in the 4th to the last line where I try to set the file name
to EXCLUDE the suffix. So, something like Apple's Trim File Names script, I
need to trim the ".jpg" from each file in the folder and the files in it's
subfolders.

Can someone offer guidance on this part?


on open theFolders
if checkSysVers() then
repeat with theFolder in theFolders
if folder of (info for theFolder) then
changeLabels(theFolder)
else
display dialog ,
"Found a dropped item which is not a folder." buttons
{"Skip It"} default button 1 with icon 2 giving up after 15
end if
end repeat
end if
end open

on checkSysVers()
tell application "Finder"
if (computer "sysv") < 2144 then
beep
tell me to display dialog ,
"LabelWizard: Revised requires Mac OS 8.6 or later." buttons
{"Quit"} default button 1 with icon 0
return false
else
return true
end if
end tell
end checkSysVers

on changeLabels(theFolder)
tell application "Finder"
activate
set theseFolderItems to every item in theFolder
repeat with thisItem in theseFolderItems

set name of thisItem to ((name of thisItem) - (".jpg" as text))

end repeat
end tell
end changeLabels


  • Follow-Ups:
    • Re: Setting filename of files and in subfolders
      • From: Bill Briggs <email@hidden>
  • Prev by Date: Re: Scientific notation to text
  • Next by Date: OSA Events
  • Previous by thread: Re: Scientific notation to text
  • Next by thread: Re: Setting filename of files and in subfolders
  • Index(es):
    • Date
    • Thread