Re: Photo list
Re: Photo list
- Subject: Re: Photo list
- From: Paul Skinner <email@hidden>
- Date: Wed, 05 Sep 2001 23:11:48 -0400
on 9/5/01 6:22 PM, email@hidden wrote:
>
Hi -
>
Ibm trying to write a script to change a list of photo descriptions. I need
>
to convert several thousand names.
>
>
This is an example of what I have:
>
>
Background Sky.jpg 00659
>
Sunset 00660.jpg
>
Clouds 00664.jpg
>
Sunshine 00665.jpg
>
>
This is an example of what I want:
>
>
00659.jpg Background Sky
>
00660.jpg Sunset
>
00664.jpg Clouds
>
00665.jpg Sunshine
>
>
I have done it in FMP, but I also need to change the actual photo name
>
and all attempts have failed miserably, anybody want to take a shot at it?
>
>
- - Les
I think that there's an error in the list of current filename examples that
you posted. I assume that the correct current structure is...
'filename filenumber.jpg'
If this is correct then you can process the filenames like so...
--begin script
set fileList to {"Background Sky 00659.jpg", "Sunset 00660.jpg", "Clouds
00664.jpg", "Sunshine 00665.jpg"}
repeat with thisName in fileList
set text item delimiters to "."
set thisName to item 1 of every text item of thisName
set text item delimiters to " "
set fileNumber to text item -1 of thisName
set text item delimiters to ""
set fileName to characters 1 thru -((length of fileNumber) + 2) of
thisName as text
set newName to fileNumber & ".jpg " & fileName
end repeat
--end script
--
Paul Skinner
"The prestige of government has undoubtedly been lowered considerably
by the Prohibition law. For nothing is more destructive of respect
for the government and the law of the land than passing laws which
cannot be enforced. It is an open secret that the dangerous increase
of crime in this country is closely connected with this."
-- Albert Einstein, July 7, 1921