Writing SMIL files

am using this piece of code to generate smil files based on an input text file

repeat with i from 1 to the count of theRegionList

–set theTitles to theTitles & " " & item 1 of item i of theBigList & return
set theLeft to item 1 of item i of theRegionList
set theTop to item 2 of item i of theRegionList
set theWidth to item 3 of item i of theRegionList
set theHeight to item 4 of item i of theRegionList

set the SMIL_text to the SMIL_text & tab & tab & tab & “<region id=“region_” & i & “” left=”" & theLeft & “” top=“” & theTop & “” width=“” & ¬
theWidth & “”" & " height=“” & theHeight & “” fit=“fill” />" & return

end repeat

This prints out the correct tag for the first iteration of the loop,and for the subsequent iterations.But after the first time through the loop the line printed out is broken up over two lines.here’s an example of what i mean.

This is causing the smil to parse incorrectly.
Any help is greatly appreciated.


Without seeing what is contained in the variable “theRegionList”, this is impossible to troubleshoot.


Sorry John,
here is the code setting up the theRegionList,
theFile is just a text file ,delimeted by tabs here is an example,

20 50 100 150/
50 55 100 100/
30 50 75 125/
58 55 55 55

set theFile to choose file with prompt “Choose a tab-delimited text file”
open for access theFile
set theData to read theFile using delimiter “/”
close access theFile

set theRegionList to {}

set text item delimiters to tab
repeat with i from 1 to count of theData
set theLine to text items of item i of theData
copy theLine to the end of theRegionList
end repeat


Using your delimter “/” will naturally keep the return at the beginning of items 2 thru -1 of the paragraphs of the text file. You’re doing a lot of looping and things that you don’t need to do. Assuming that each line really does end with a forward slash (and not a forward slash & space as the code you posted), this code can be saved as an application for drag & drop simplicity:


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

thanks very much for the help,its greatly appreciated.I’ll try that out when i get in tomorrow.

Jon,you’re a legend!
that worked a charm,thanks very much ,your time and help is greatly appreciated.