Re: Hex colors in Tex-Edit X
Re: Hex colors in Tex-Edit X
- Subject: Re: Hex colors in Tex-Edit X
- From: has <email@hidden>
- Date: Tue, 19 Nov 2002 19:02:33 +0000
Gnarlodious wrote:
>
> Ah, I believe you need to add an OSAX (scripting addition) for that
>
>automatic
>
> conversion (HTML color to RGB list).
>
Not so! Here is the entire script which ran in OS 9:
>
>
tell application "Tex-Edit"
>
activate
>
tell front window
>
set background color to black
>
repeat with n from 1 to count of style runs
>
if color of style run n is black then
>
set color of style run n to "#990099"
>
end if
>
end repeat
>
end tell
>
end tell
Doesn't work for me. Perhaps you do have that coercion installed someplace?
Pesky osaxen make it hard to tell where silent coercions are coming from
sometimes. And you have to remove the guilty osax(en) and restart the
system to get rid of them.
Anyway... it's possible to do this without the repeat loop:
======================================================================
tell application "Tex-Edit"
tell (every style run of text of window 1 whose color is black)
if (count) is greater than 0 then set color to {39321, 0, 39321} --[1]
end tell
end tell
======================================================================
This should be much faster.
<wistful>Application scripting doesn't get any better than this.
has
[1] Not sure if that's the right RGB value for "#990099". Anyone know the
correct formula for converting 8-bit colour to 16-bit? If I can find out,
I'll post a library for doing HTML/RGB colour conversions.
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.