• 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: Looking for script that replaces last chars and replace it by .jpg
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Looking for script that replaces last chars and replace it by .jpg


  • Subject: Re: Looking for script that replaces last chars and replace it by .jpg
  • From: BJ Terry <email@hidden>
  • Date: Thu, 15 Jan 2004 18:58:19 -0800

Without more information, it's hard to say exactly what you want, but
the following should work. All it does is dumbly removes the last 4
characters of the file name and replaces it with ".jpg". If you need
better logic you'll have to describe your problem more thoroughly. Is
the file length an issue because you're on OS 9 or is it because the
file names are extremely long? Also, are the names all right up to the
limit, or are some shorter? If they aren't right up to the limit,
what's the length limit? Do the shorter ones have the extension
already?

tell application "Finder"
set x to choose folder
set y to files of x
repeat with currentFile in y
set fileName to name of currentFile
set fileLength to length of fileName
set shortenedFile to items 1 through (fileLength - 4) of fileName
set name of currentFile to (shortenedFile & ".jpg" as Unicode text)
end repeat
end tell

On Jan 15, 2004, at 5:59 PM, SVEN AERTS wrote:

> Hi,
>
> I have about 400 pics. that have too long names.
> The .jpg drops and is necessary.
>
> Thank you,
>
> --
> Sven-Brussels
> GSM: +32 (0)485/389679
> OSX.2.4.Jaguar-IBook-500MHz-640MB SDRAM-14GB HD-Airport-QWERTY
> Keyboard
> CHAT : ICQ UIN: 113835655 - YahooID: aertssven -
> AOL Instant Messenger Screen Name: aertssven1 -
> MSN Messenger Passport ID: email@hidden
>
> For eco-techs & game for a better world, visit:
> http://homepage.mac.com/aertssven
> -----------
> Have a nice day...
> _______________________________________________
> applescript-users mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/applescript-users
> Do not post admin requests to the list. They will be ignored.

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Looking for script that replaces last chars and replace it by .jpg (From: SVEN AERTS <email@hidden>)

  • Prev by Date: Re: Timed watched folders
  • Next by Date: Re: Looking for script that replaces last chars and replace it by .jpg
  • Previous by thread: Looking for script that replaces last chars and replace it by .jpg
  • Next by thread: Re: Looking for script that replaces last chars and replace it by .jpg
  • Index(es):
    • Date
    • Thread