Re: Looking for script that replaces last chars and replace it by .jpg
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: SVEN AERTS <email@hidden>
- Date: Sat, 17 Jan 2004 14:50:39 +0100
- Dear: lastname
What's wrong with this ?
---------------------------
--Allows user to select a folder in which there are files that need
--.jpg added to them.
-- Find files that have no .jpg at the end of the filename
-- Replace the last four digits by .jpg
Display dialog
"Welcome, this script replaces the last 4 characters of a filename with .jpg
if the filename has no .jpg at the end. What folder are the files in ?"
choose folder with promt
Select Folder
if name contains ".jpg"
then goto next name
else
replace name -4 to -1 by ".jpg"
---------------------------
>
At 2:59 AM +0100 16/01/04, SVEN AERTS wrote:
>
> Hi,
>
>
>
> I have about 400 pics. that have too long names.
>
> The .jpg drops and is necessary.
>
>
(I don't have a dog, so ...)
>
>
Use "text i thru j" to extract a substring. What is convenient is that you can
>
use negative indices, for instance you would get the extension with "text -4
>
thru -1 of theName".
>
>
Then use the concatenation operator "&" to concatenate sub-strings.
>
>
Like:
>
>
--------------------
>
set theName to (text 1 thru 27 of theName) & (text -4 thru -1 of theName)
>
--------------------
>
>
If the extension's length is not fixed (e.g. you have jpg and you have jpeg),
>
you've got to use "offset" to find out where exactly the "." is.
>
>
Emmanuel
>
_______________________________________________
>
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.
_______________________________________________
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.