Page 1 of 1

Font Waver Script won't work :'(

Posted: Fri Dec 24, 2004 5:30 am
by zaudragon
Hello, freakman wanted me to make a font waver script.

Font waving is like this:

aaaaaaaaa

My script:
http://hitoshi.berkeley.edu/~takumi/FontWaver.rtf

I thought my script will work but it doesn't :(

And where can I get a Log of errors? ü8312-1_££7 didn't need one since I found the problem!

BTW: I don't care about the extra ()'s for now!

Posted: Fri Dec 24, 2004 6:36 am
by evands
1) You're not actually returning anything from the on substitute() function.

2) I have no idea what those 'set size of' commands are actually doing in terms of what return value we'd get... Adium does accept HTML, though, so while it won't look quite as elegant, perhaps the easiest way to go would be to insert <HTML> at the beginning and then do <FONT ABSZ="8">a</FONT><FONT ABSZ="9">b</FONT><FONT ABSZ="10">c</FONT> and so on.

Posted: Fri Dec 24, 2004 7:10 am
by zaudragon
What do you mean by I'm not running anything from the substitute function?

Posted: Fri Dec 24, 2004 7:23 am
by zaudragon
Oh I get it… I wasn't paying attention ;) I'll fix that…

But it still won't work (since I'm not good at AppleScript ;) )

Do variables work in HTML?

Posted: Fri Dec 24, 2004 7:32 am
by evands
Take a look at the built-in %_safari script, which returns an HTML link.

Posted: Fri Dec 24, 2004 7:41 am
by zaudragon
I tried using loops like in Pig Latin but it didn't work…

And I didn't try HTML yet…

And how would I say <div style="font-size: (font size of character x) + 1;">? This is a hard script freakman!

Thanks in advance evands and probably hypercube again in the future ;)

Boy, I really have trouble with AppleScripts! This is my second topic calling for assistance!

BTW the script file is updated :)

Posted: Fri Dec 24, 2004 7:52 am
by zaudragon
What's <FONT ABSZ="9">a</FONT>?

The absz isn't something I've seen!

I prefer to use <div style="font-size: 12pt;">a</div> because then I get unlimited font sizes

Posted: Fri Dec 24, 2004 7:55 am
by evands
Disclaimer: I know very little about HTML.

ABSZ is the absolute size tag. It specifies a point size just like you're wanting to.
Our HTML decoder probably won't parse your div tag anyways.

Also, keep in mind that, as you probably know, current message styles don't handle changing fonts and such very well... so you may or may not see proper results within Adium even if you get it working, for now ;)

Posted: Fri Dec 24, 2004 7:58 am
by zaudragon
Improvement now! Instead of showing no result, it shows no result and shows that the user is still typing!

Posted: Sat Dec 25, 2004 10:23 pm
by zaudragon
This still doesn't work :'( Any help please!!!!!!

Posted: Sun Jan 09, 2005 1:37 am
by zaudragon
It almost works…

The problem is that the first character isn't parsed. From the Debug Window:

Code: Select all

<HTML>a<FONT FACE="Helvetica" ABSZ="13" SIZE="4" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="14" SIZE="4" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="15" SIZE="5" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="16" SIZE="5" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="17" SIZE="5" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="18" SIZE="5" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="19" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="20" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="21" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="22" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="23" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="24" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="25" SIZE="7" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="24" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="23" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="22" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="21" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="20" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="19" SIZE="6" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="18" SIZE="5" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="17" SIZE="5" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="16" SIZE="5" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="15" SIZE="5" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="14" SIZE="4" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="13" SIZE="4" COLOR="#000000">a</FONT><FONT FACE="Helvetica" ABSZ="12" SIZE="3" COLOR="#000000">a</FONT></HTML>

Posted: Mon Jan 10, 2005 2:49 am
by zaudragon
Please, someone help :cry:

I am out of ideas…

Here is the script:

Code: Select all

on substitute(unwave)
	set x to 0
	set rsult to ""
	set waved1 to ""
	set waved2 to ""
	set x to x + 1
	set waved1 to "<FONT ABSZ=\"" & (11 + x) & "\">" & character (x) of unwave & "</FONT>"
	set rsult to rsult & " " & waved1
	repeat until x ? ((number of characters in unwave) / 2)
		set x to x + 1
		set waved1 to "<FONT ABSZ=\"" & (11 + x) & "\">" & character (x) of unwave & "</FONT>"
		set rsult to rsult & waved1
	end repeat
	set y to x
	repeat until x = ((number of characters in unwave))
		set y to y - 1
		set x to x + 1
		set waved2 to "<FONT ABSZ=\"" & (11 + y) & "\">" & character (x) of unwave & "</FONT>"
		set rsult to rsult & waved2
	end repeat
	set rsult to "<HTML>" & rsult & "</HTML>"
	return rsult as string
end substitute

Posted: Mon Jan 10, 2005 4:47 am
by zaudragon
Here's one that's easier to see:
--[url=applescript://com.apple.scripteditor/?action=new&script=(*%0Adisplay%20dialog%20%22unwave%3A%22%20default%20answer%20%22aaaaaaaaaaaaaaaaaaaaaaaaaaaa%22%0Aset%20txt%20to%20text%20returned%20of%20result%0Adisplay%20dialog%20%22%22%20default%20answer%20substitute(txt)%0A*)%0Aon%20substitute(unwave)%0A%09set%20x%20to%200%0A%09set%20rsult%20to%20%22%22%0A%09set%20waved1%20to%20%22%22%0A%09set%20waved2%20to%20%22%22%0A%09set%20x%20to%20x%20+%201%0A%09set%20waved1%20to%20%22%3CFONT%20ABSZ%3D%5C%22%22%20%26%20(11%20+%20x)%20%26%20%22%5C%22%3E%22%20%26%20character%20(x)%20of%20unwave%20%26%20%22%3C%2FFONT%3E%22%0A%09set%20rsult%20to%20rsult%20%26%20%22%20%22%20%26%20waved1%0A%09repeat%20until%20x%20%B3%20((number%20of%20characters%20in%20unwave)%20%2F%202)%0A%09%09set%20x%20to%20x%20+%201%0A%09%09set%20waved1%20to%20%22%3CFONT%20ABSZ%3D%5C%22%22%20%26%20(11%20+%20x)%20%26%20%22%5C%22%3E%22%20%26%20character%20(x)%20of%20unwave%20%26%20%22%3C%2FFONT%3E%22%0A%09%09set%20rsult%20to%20rsult%20%26%20waved1%0A%09end%20repeat%0A%09set%20y%20to%20x%0A%09repeat%20until%20x%20%3D%20((number%20of%20characters%20in%20unwave))%0A%09%09set%20y%20to%20y%20-%201%0A%09%09set%20x%20to%20x%20+%201%0A%09%09set%20waved2%20to%20%22%3CFONT%20ABSZ%3D%5C%22%22%20%26%20(11%20+%20y)%20%26%20%22%5C%22%3E%22%20%26%20character%20(x)%20of%20unwave%20%26%20%22%3C%2FFONT%3E%22%0A%09%09set%20rsult%20to%20rsult%20%26%20waved2%0A%09end%20repeat%0A%09set%20rsult%20to%20%22%3CHTML%3E%22%20%26%20rsult%20%26%20%22%3C%2FHTML%3E%22%0A%09return%20rsult%20as%20string%0Aend%20substitute]Open this script in a new Script Editor window[/url].

(*
display dialog "unwave:" default answer "aaaaaaaaaaaaaaaaaaaaaaaaaaaa"
set txt to text returned of result
display dialog "" default answer substitute(txt)
*)
on substitute(unwave)
     set x to 0
     set rsult to ""
     set waved1 to ""
     set waved2 to ""
     set x to x + 1
     set waved1 to "<FONT ABSZ=\"" & (11 + x) & "\">" & character (x) of unwave & "</FONT>"
     set rsult to rsult & " " & waved1
     repeat until x is greater than or equal to ((number of characters in unwave) / 2)
          set x to x + 1
          set waved1 to "<FONT ABSZ=\"" & (11 + x) & "\">" & character (x) of unwave & "</FONT>"
          set rsult to rsult & waved1
     end repeat
     set y to x
     repeat until x = ((number of characters in unwave))
          set y to y - 1
          set x to x + 1
          set waved2 to "<FONT ABSZ=\"" & (11 + y) & "\">" & character (x) of unwave & "</FONT>"
          set rsult to rsult & waved2
     end repeat
     set rsult to "<HTML>" & rsult & "</HTML>"
     return rsult as string
end substitute
-------------------------
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Posted: Mon Jan 10, 2005 9:15 am
by evands
- It'd be a lot easier for someone to help with an example that isn't aaaaaaaaaa but rather illustrates the problem
- Screen shots in this context, or something, might be useful
- Posting the packaged AdiumXtra would be helpful, as well.

Posted: Fri Jan 14, 2005 1:24 am
by zaudragon
Here is an example:

I typed "A That A doesn't work"

Image
http://hitoshi.berkeley.edu/~takumi/Font%20Waver.zip