Re: String to list conversion
Re: String to list conversion
- Subject: Re: String to list conversion
- From: Johnny AppleScript <email@hidden>
- Date: Tue, 14 Sep 2004 00:06:32 -0600
I know you asked the master's opinion, but I'm curious: while I see the
value of awk for parsing text, I wonder why you're not going to use defaults
read/write for a quick swap of styles; e.g.:
set pListPath to "~/Library/Preferences/com.apple.applescript"
set applescriptPrefs to do shell script "defaults read " & pListPath
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 (paragraph i of applescriptPrefs)
end repeat
item 3 of referenceList
--> " \"Arial;p;16;0 0 0\", "
On 04/09/13 11:29 PM, "Gnarlodious" <email@hidden> wrote:
> 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}}
_______________________________________________
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