• 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: Apply script to subfolders, save file to new folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apply script to subfolders, save file to new folder


  • Subject: Re: Apply script to subfolders, save file to new folder
  • From: KOENIG Yvan <email@hidden>
  • Date: Thu, 4 Jan 2007 16:59:42 +0100


Le 4 janv. 07 à 16:23:26, Ruta a écrit :


Script for #1:

on resize(y)


--get rid of .jpg or .jpeg at the end of file name
if y ends with ".psd" then
set new_y to (characters 1 thru -5 of y) as string
else if y ends with ".tif" then
set new_y to (characters 1 thru -5 of y) as string
else if y ends with ".tiff" then
set new_y to (characters 1 thru -6 of y) as string
else
set new_y to y
end if


set OFset to offset of "." in y
if text OFset thru end of y is in {".psd", ".tif", ".tiff"} then set
new_y to text 1 through (OFset - 1) of y


set new_y to new_y & ".jpg"


if new_y does not end with ".jpg" then set new_y to new_y & ".jpg"

…


Hello

If the filename contains a period in a subfolder name or more than one in the file name, your code will give odd result.

Perhaps you may replace it by:

tell application "Finder"
try
set the_ext to name extension of file y
set new_y to (text 1 thru (-1 - (length of the_ext)) of y) & "jpg"
on error
set new_y to y & ".jpg"
end try
end tell


Yvan KOENIG
 _______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Apply script to subfolders, save file to new folder (From: Ruta <email@hidden>)

  • Prev by Date: Re: Apply script to subfolders, save file to new folder
  • Next by Date: Mounting server
  • Previous by thread: Re: Apply script to subfolders, save file to new folder
  • Next by thread: Mounting server
  • Index(es):
    • Date
    • Thread