How to remove file type completely?

I have a script that creates an XML file from QT Chapter marks in a proper CuePoint XML format for FlashVideo Encoder. However, finder creates files with a file type of “TEXT”. Well our wonderful friends at Adobe have written the Encoder to only import files with “NO” file type. In fact when listing the the properties of a an XML file that it will import the file type is shown as:

I really need a way of stripping the file type value. I have tried setting it to “msng” but that does not work. Any ideas?

The silly thing is the Encoder checks the XML file for well formedness and will not import the CuePoints if the XML format is wrong. Why in the world they would hard code it to not allow anything but file with no file type, is beyond my understanding. Right now I am having to use an XML file, exported from the encoder, and in a known location to write the chapter marks to. This is just not portable, and the encoder is not scriptable.

Thanks…

Hi,

here a droplet solution


on open theFiles
	repeat with oneFile in theFiles
		tell application "Finder" to set file type of contents of oneFile to missing value
	end repeat
end open

save it as application and drop the files onto it

Stefan, thanks for the quick reply. However, this actually does not work. I tried this prior to posting, and the result is that the file type ends up as:

This behavior is somewhat understandable, as the Finder is trying to ensure files have complete metadata.

and

are very different. I am now exploring a non-applescript methods. AppleScript just provided such a quick easy way to do this. It may be time to pull out the Cocoa - AppleScript bridge docs unless someone has another way.

Thanks again.

Put the file through TAR or ZIP compression without “Preserve Macintosh information” or it’s equivalent. That’s what I did to strip files to test a script that RESTORES that information. :wink:

As I checked, it is bug in the Finder.app, which instead of class «class msng» (missing value) sets text “msng”.

Following script solves the problem (sets file type property to missing value obect).


set oneFile to (choose file) as text

-- this works properly (sets to «class msng»)
tell application "System Events" to set file type of file oneFile to missing value

-- don't use, this doesn't work properly (BUG: sets to text "msng")
-- tell application "Finder" to set file type of file oneFile to missing value

-- get the result to see it is correct
tell application "Finder" to return file type of file oneFile