Re: Naming Files from List Ref
Re: Naming Files from List Ref
- Subject: Re: Naming Files from List Ref
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 01 Sep 2002 23:53:00 -0700
On 9/1/02 11:02 PM, "rich allen" <email@hidden> wrote:
>
one possible solution
over 100 lines.
another: (It has the advantage that it will wok with any "job_name" without
having to revise the script)
---------------
set originalJobText to "jobname_001.tif
jobname_002.tif
jobname_003.tif
jobname_004.tif
jobname_005.tif"
set colorText to "001_Cyan
002_Magenta
003_Yellow
004_Black
005_Pantone072"
set colorList to paragraphs of colorText
set AppleScript's text item delimiters to {"_"}
repeat with i from 1 to (count colorList)
set code_Color to item i of my colorList
set item i of my colorList to text item 2 of code_Color
end repeat
set finalList to {}
repeat with i from 1 to count (paragraphs of originalJobText) -- -1?
set jobLine to paragraph i of originalJobText
set AppleScript's text item delimiters to {"_"}
set jobName to text item 1 of jobLine
set theCode to text item 2 of jobLine
set AppleScript's text item delimiters to {".tif"}
set theCode to text item 1 of theCode
set theIndex to theCode as integer
set end of finalList to jobName & "_" & (item theIndex of colorList) &
".tif"
end repeat
set AppleScript's text item delimiters to {return}
set finalText to finalList as string
set AppleScript's text item delimiters to {""}
finalText
-->
"jobname_Cyan.tif
jobname_Magenta.tif
jobname_Yellow.tif
jobname_Black.tif
jobname_Pantone072.tif"
-------------------
This is really worth $13,000? It took me 1 1/2 minutes
I must be
under-selling myself. ;-)
>
Hi,
>
>
I have been lurking on the list for awhile now but have come across a
>
problem which doesn't seem to have been answered in the archives.
You can't have looked very hard, or don't really understand what you're
seeing. It's one of the most basic operations in all of AppleScript -
probably several replies per day use text item delimiters.
>
>
I have some tiff files of a colour separated postscript file output
>
from a RIP. I need to have the colour names added to the filenames
>
before they are passed onto our colour proofing software. The
>
filenames are in the form of :-
>
jobname_001.tif
>
jobname_002.tif
>
jobname_003.tif
>
jobname_004.tif
>
jobname_005.tif
>
>
The numbers corresponds to the separation numbers. I have extracted
>
the separation names from the postscript file prior to ripping and have
>
them in a text file in the format of:-
>
001_Cyan
>
002_Magenta
>
003_Yellow
>
004_Black
>
005_Pantone072
>
>
I need to replace the separation name with the colour name so that the
>
tif files are named as follows:-
>
jobname_Cyan.tif
>
jobname_Magenta.tif
>
jobname_Yellow.tif
>
jobname_Black.tif
>
jobname_Pantone072.tif
>
>
Any help would be greatly appreciated as this will enabled us to avoid
>
a costly RIP upgrade ($13,000).
--
Paul Berkowitz
_______________________________________________
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.