text name changing

Hi all,

This applescript:

set JobNumber to 88888
set countFileIn to 2
set FilesIn to {alias "AraxiVolume_CTP1_J:Jobs:88888_Outwork:Proofs:2012-10-29  14-39  arw:PDFx-1a:88888_Prem.PDF", alias "AraxiVolume_CTP1_J:Jobs:88888_Outwork:Proofs:2012-10-29  14-39  arw:PDFx-1a:88888_WEL.PDF"}
set lprLocalName to "Test"
set FilemakerTimeStamp to "18/06/2013 12:57"
set lprZPwd to "TestZipPassword"

set templist to ""
set VersionList to ""
tell application "Finder"
	repeat with i from 1 to countFileIn
		set {tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
		set aFile to last item of text items of (((item i of FilesIn) as alias) as text)
		set AppleScript's text item delimiters to {JobNumber & "_", JobNumber & "_Z_1up_", JobNumber & "_z_1up_"}
		set aFile to last item of text items of (aFile as text)
		set AppleScript's text item delimiters to {".PDF", ".pdf"}
		set aFile to first item of text items of (aFile as text)
		set AppleScript's text item delimiters to tids
		if i = 1 then
			set VersionList to aFile
		else
			set VersionList to VersionList & "," & aFile
		end if
	end repeat
end tell

display dialog VersionList

repeat with ifm from 1 to countFileIn
	set VersionName to (item ifm of VersionList)
	display dialog VersionName
end repeat

Works up till the repeat at the end.

Basically in this instance I have 2 files I get the version name from the alias in the list (remove the job number (88888_) and the file extension (.PDF) which works OK.

Once it goes into the repeat I only get the first letter.

Can anybody help please? As it should still be the version name.

Cheers
Andy

Hi,

VersionList is declared as an empty string, later strings are appended.
item x of a string results character x

You could declare VersionList as a list (as the variable name implies :wink: )

set VersionList to {}

and add the items to the list

instead


    if i = 1 then
           set VersionList to aFile
       else
           set VersionList to VersionList & "," & aFile
       end if

just write


set end of VersionList to aFile   

Thanks for that.

it works a treat now.

I figured it would be something simple but I couldn’t find it.

Cheers
Andy