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: Apply script to subfolders, save file to new folder




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:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
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>)



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.