Removing a resource from a file

I used to be able to use the Delete Resource command from the GTQ
Scripting Library, but can longer seem to get this working under MacOSX

Anyone have any suggestions?

Is there an alternative out there?

(the particular resource that I need to remove is the ckid)

This uses Satimage.osax, is a bit tricky and maybe unsafe. Test it in duplicates before adopting it:

set f to alias "path:to:file"
	put resource to f type "ckid" index 128
end try

And you can still use the command “ES delete resource” from Kanzu’s Extra Suites:


You can also use the standard additions read/write command to make a copy of the file without the resource fork. Basically you read the data and write it to a new file. Here’s an example:

set the_file to choose file
set file_info to (info for the_file)
set file_name to (name of file_info)
set file_data to read the_file as data
tell application “Finder”
set new_folder to (make folder at desktop with properties {name:“New Folder”}) as alias
on error
beep 2
set desk_path to (desktop) as string
set new_folder to (desk_path & “New Folder”) as alias
end try
end tell
set file_spec to ((new_folder as string) & file_name) as file specification
set ref_num to (open for access file_spec with write permission)
write file_data to ref_num as data
close access ref_num
on error err_mess
close access ref_num
display dialog err_mess
end try