Mail signatures broken in Tiger

OK, here’s another one that doesn’t work in Tiger. And before anyone gigs me saying “it’s just you,” check out this thread here in the forum from last year.

I had a very lovely script that created mail signatures from clipboard text. Here’s the script:

set theFullName to do shell script "niutil -readprop . /users/" & (do shell script "whoami") & " realname"
set myUser to word 1 of theFullName
tell application "Mail"
	activate
	set myText to (the clipboard) as string
	copy (word 1 of myText & space & word 2 of myText & space & word 3 of myText) to myName
	copy myUser & return ¬
		& "--" & return ¬
		& myText to myText
	display dialog ¬
		("Name: " & myName & return ¬
			& "Sig: " & return ¬
			& myText & return ¬
			& return ¬
			& "Is this ok?") as string
	if the button returned of the result is "OK" then make new signature with properties {name:myName, content:myText}
end tell

I thought perhaps it needed an “at end” so tried:

if the button returned of the result is "OK" then make new signature at end with properties 

but that didn’t work either.

Anyone know what’s going on? This is what happens frequently in Applescript. I now also have 2 AS Studio apps that don’t work in Tiger, either (Romulan Hunt and Tower of Hanoi). I’m not using things that are “deprecated” or otherwise due for removal. Why does Apple keep breaking scripting?

Well, I’ve made some headway, but not much. Thinking back to our discussion of putting the right things in tell blocks, I revised the code to:

set theFullName to do shell script "niutil -readprop . /users/" & (do shell script "whoami") & " realname"
set myUser to word 1 of theFullName
set myText to (the clipboard) as string
copy (word 1 of myText & space & word 2 of myText & space & word 3 of myText) to myName
copy myUser & return ¬
	& "--" & return ¬
	& myText to myText
tell application "Mail"
	activate
	display dialog ¬
		("Name: " & myName & return ¬
			& "Sig: " & return ¬
			& myText & return ¬
			& return ¬
			& "Is this ok?") as string
	if the button returned of the result is "OK" then make new signature at end of signatures with properties {name:myName, content:myText}
end tell

This seems to create the new signature, but when I pull up the Signatures portion of the Preferences window, it won’t let me select the new signature or close the Prefs window. Quitting Mail seems to be the only solution, and when I restart Mail, the “new” signature is gone, not saved.

Weird…

Sad to report that as recently as tonight, using Snow Leopard, this functionality is STILL broken in Apple’s Mail. Sad, just sad.