Specify only ".rtf" in "my file.abc.rtf" as extension (for hiding)?

I have a script that coverts other files into RTF format and then displays the converted file in a viewer window. Because I don’t want to confuse users who want to view the content of the original file, and never asked to see an RTF, my script first asks the Finder to hide the RTF extension so that that extension doesn’t appear in the viewer window’s title bar. All you see is the filename of the original (unconverted) file.

This doesn’t work when the original file has an extension, so the converted file gets a name like MyFile.ABC.rtf. The Finder apparently won’t hide anything in that kind of filename if you check “Hide extension” in Get Info or if you use AppleScript to tell the Finder to hide the extension.

Is there any way to convince the Finder that it should treat only “.rtf” as the extension so that it can be hidden?

An interesting problem. The following code does not work, because the displayed name property in both Finder and System Event is read-only:


set my_Rtf to (choose file) as string

tell application "Finder"
	set my_Rtf to file my_Rtf
	set old_Displayed_Name to (displayed name of my_Rtf)
	set new_Displayed_Name to (text 1 thru -5 of old_Displayed_Name)
	set displayed name of my_Rtf to new_Displayed_Name
end tell

But somehow it is regulated, if we see it?
Maybe this property is regulated only by setting grid spacing’s value?

NOTE: For applications (not system) it is easy to set displayed name - just change in its plist file property NSBundleName to other.

What you’re describing — hiding a “second” extension to make it look the file is some kind other than it is — is a technique much favored by malware, so I have to say I’m not surprised — and rather pleased — that the system won’t play along. I can see why it annoys you, but even with the best of intentions, you are trying to deceive the user. I’m not sure that’s a good idea.