Re: Converting a nested list to return delimited string with TIDs
Re: Converting a nested list to return delimited string with TIDs
- Subject: Re: Converting a nested list to return delimited string with TIDs
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 07 Jun 2001 01:43:52 -0700
On 6/6/01 11:00 PM, I wrote:
>
set AppleScript's text item delimiters to {"\"" & return & "\""}
>
set n to {{"aa", "bb", "cc"}, {"dd", "ee", "ff"}}
>
set n to "\"" & n & "\""
>
set AppleScript's text item delimiters to {""}
>
n
>
>
>
-->
>
"\"aa\"
>
\"bb\"
>
\"cc\"
>
\"dd\"
>
\"ee\"
>
\"ff\""
>
>
which will show up in any text application just as you want:
>
>
"aa"
>
"bb"
>
"cc"
>
"dd"
>
"ee"
>
"ff"
Sorry. I forgot you wanted an extra line space between the converted
subgroups. I can't see any way to do that without a repeat loop (again for
the reasons given in my first post -- TIDs wipe out all internal nesting of
sublists), but here's a very simple one that uses TIDs tp speed things up:
set n to {{"aa", "bb", "cc"}, {"dd", "ee", "ff"}}
set AppleScript's text item delimiters to {"\"" & return & "\""}
repeat with i from 1 to (count n)
set item i of n to "\"" & (item i of n) & "\""
end repeat
set AppleScript's text item delimiters to {return & return}
set n to "" & n
set AppleScript's text item delimiters to {""}
n
--In a scriptable text application, continuing:
tell application "Tex-Edit Plus"
if not (document 1 exists) then make new document
set selection of document 1 to n
end tell
--that will show up as:
"aa"
"bb"
"cc"
"dd"
"ee"
"ff"
--
Paul Berkowitz