Make Finder hide last of multiple extensions (name.wpd.html)?

I am writing a script that converts an old WordPerfect document to an HTML file (using the open-source wpd2html utility) and then displays the HTML file in TextEdit. I want to hide the .html extension in the title bar of TextEdit, so that the displayed filename is the same as the original file.

I can do this easily if the original WordPerfect file has no extension, using code like this, where htmlPOSIX is the POSIX name of the converted HTML file, and I use this code after running the conversion program.

tell application "Finder"
set htmlFile to (POSIX file htmlPOSIX) as alias
set extension hidden of htmlFile to true
end tell

But if the original WordPerfect file has an extension (for example, myfile.wpd), then the converted file has the name myfile.wpd.html - and the Finder doesn’t recognize .html as the extension, and won’t hide it.

Is there any way to force the Finder to treat .html as the extension, so it can hide it?

Thank you for any help.

Hello!

I don’t know, as the file extension, is meaningful data, which together with the creator code is there to set the uniform type identifer, which decides what kind of file it is.

But, what is stored in the name extension of the file? And maybe if you set the name extension to .wpd.html in finder via Apple Script, and then hides the extension, it may work.

You may loose any assossiations for the file though.

Thank you. I am still experimenting with this, and will report any results.

For this script, I am creating a temporary html file that opens in TextEdit, and then is discarded, so the file associations do not matter.

I have tried various ways to make the Finder see the name extension as “html” and then hide that extension. I can do this when the original filename has no extension. I cannot do it when the original filename has an extension, and I want that extension to be the visible filename, so that the temporary file “myfile.doc.html” will display in the TextEdit title bar as “myfile.doc”.

Perhaps OS X prevents this for security reasons, so that the user cannot be deceived into thinking a file is one type when it is really another.

Hello!

You’ll find name extension under properties of item in Finders dictionary.

Maybe you should try to remove the ext of the filename first, then set the name extension, I don’t know, but I’d try that.