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.
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: