Re: String to list conversion
Re: String to list conversion
- Subject: Re: String to list conversion
- From: Gnarlodious <email@hidden>
- Date: Mon, 13 Sep 2004 23:29:35 -0600
Title: Re: String to list conversion
Paul, you’re pretty good at this. Will you look at the latter part of this script and tell me if it looks OK? It just seems a little bulky for what I’m trying to do. Thanks.
-- Recolor Applescript colors for HTML so it doesn’t hurt Martin's eyes
set pListPath to "~/Library/Preferences/com.apple.applescript.plist"
set applescriptPrefs to do shell script "awk '/AppleScriptTextStyles/,/<\\/array>/' " & pListPath & "| sed -n '3,10p' | sed" & ¬
" -e 's| <string>|{\"|' " & ¬
" -e 's|;|\",\"|' " & ¬
" -e 's|;|\",|' " & ¬
" -e 's|;|,{|' " & ¬
" -e 's| |,|g' " & ¬
" -e 's|<\\/string>|}}|' "
set referenceList to {a reference to osaOther, a reference to osaOperator, a reference to osaLanguage, a reference to osaApplication, a reference to osaComments, a reference to osaValues, a reference to osaIdentifier, a reference to osaReference}
repeat with i from 1 to count items of referenceList
set item i of referenceList to run script (paragraph i of applescriptPrefs)
end repeat
item 3 of referenceList
--> {"Verdana", "b", 12, {52428, 13107, 0}}
Entity Paul Berkowitz spoke thus:
> On 9/13/04 9:07 PM, "Gnarlodious" <email@hidden> wrote:
>
>> Say I have an unquoted string direct from a shell script:
>> {"Verdana","b",12,{30583,30583,30583}}
>
> What's an "unquoted string". All strings in AppleScript are surrounded by
> quotes, including all those coming from 'do shell script'. If you mean
> you're "getting it" in Terminal, how do you propose top transfer it to
> AppleScript? Via the clipboard? Or how?" However you do it, it will turn
> into a "quoted" string (either a string, or Unicode, in quotes), complete
> with escaped internal quotes.
>>
>> and I want a list:
>> {"Verdana", "b", 12, {30583, 30583, 30583}}
>>
>> How to?
>
> The usual way. Since that "string" will actually be:
>
>
> "{\"Verdana\", \"b\", 12, {30583, 30583, 30583}}"
>
> the simple way would be to
>
> run script "{\"Verdana\", \"b\", 12, {30583, 30583, 30583}}"
> --> {"Verdana", "b", 12, {30583, 30583, 30583}}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden