Page 1 of 1
need help with apple script
Posted: Sat Jul 23, 2005 8:06 am
by DiscoJoey
well i just saw zaudragon's font wave and it gave me the idea to make a color wave but i have no idea how to go about doing this. i just want it to make a random color for each letter and then once i do that make it so you can do a color and a wave font at once. so if anyone could point me in the right way to start this i would greatly appreciate it
Posted: Sat Jul 23, 2005 5:54 pm
by zaudragon
Colour wave? You can edit the font waver to your liking… but I wonder how you would do the rainbow-ness.
EDIT: freakman has a random colour script, but it was never released. Here’s the source:
Code: Select all
on substitute(uncolorizedtext)
--Color list
-- White == #FFFFF
-- Light Red == #FF0000
-- Yellow == #FFF00
-- Light Green == #00FF00
-- Light Cyan == #00FFFF
-- Light Blue == #0000FF
-- Light Magenta == #FF00FF
set thecolorlist to {"#FFFFF", "#FF0000", "#FFF00", "#00FF00", "#00FFFF", "#0000FF", "#FF00FF"}
set colorizedtext to ""
repeat with x from 1 to (count characters in uncolorizedtext)
set randomcolor to item (random number from 1 to number of items in thecolorlist) of thecolorlist
set anuncolorizedcharacter to character x of uncolorizedtext
set acolorizedcharacter to "<FONT COLOR=\"" & randomcolor & "\">" & anuncolorizedcharacter & "</FONT>"
set colorizedtext to (colorizedtext & acolorizedcharacter)
end repeat
return "<HTML>" & colorizedtext & "</HTML>"
end substitute
Posted: Sat Jul 23, 2005 8:14 pm
by DiscoJoey
^sweetness thank you so much i was using trying to use parts of applescripts mail sample script that does somthing kind of like that. hope he doesnt mind if i use that ill post what i have soon
edit: so i didnt like that he only had a few colors so i edited it to alot of colors and now its still only uses the first set of colors he had and i cant figure out why here is script.
on substitute(uncolorizedtext)
--Color list
-- White == #FFFFF
-- Light Red == #FF0000
-- Yellow == #FFF00
-- Light Green == #00FF00
-- Light Cyan == #00FFFF
-- Light Blue == #0000FF
-- Light Magenta == #FF00FF
set thecolorlist to {"#02020c", "#06062d", "#090940", "#0a0a4e", "#0d0d5d", "#0e0e65", "#0f0f72", "#111180", "#12128c", "#121298", "#1313a5", "#1515b0", "#1515bc", "#1616c8", "#1616d4", "#1818e1", "#1a1aed", "#0303fa", "#0349fa", "#0394fa", "#03b1fa", "#03d4fa", "#03ebfa", "#03faeb", "#03fac9", "#03faa6", "#03fa8e", "#03fa43", "#54fa03", "#94fa03", "#cefa03", "#f7fa03", "#face03", "#faac03", "#fa8903", "#fa6c03", "#fa3103", "#fa0349", "#fa036c", "#fa039a", "#fa03b1", "#fa03c9", "#fa03eb", "#e603fa", "#bd03fa", "#8903fa"}
set colorizedtext to ""
repeat with x from 1 to (count characters in uncolorizedtext)
set randomcolor to item (random number from 1 to number of items in thecolorlist) of thecolorlist
set anuncolorizedcharacter to character x of uncolorizedtext
set acolorizedcharacter to "<FONT COLOR=\"" & randomcolor & "\">" & anuncolorizedcharacter & "</FONT>"
set colorizedtext to (colorizedtext & acolorizedcharacter)
end repeat
return "<HTML>" & colorizedtext & "</HTML>"
end substitute
Posted: Sun Jul 24, 2005 2:58 am
by zaudragon
It looks OK to me.