Creating AppleScript document based app with custom file type

Hi,

I know that you have to use a Document based appelscript studio app to make a custom file type and I did that. My file type is called “.crproj”. Its a basically a renamed folder (a package). How do I associate my app with this format, and give the format a custom icon.

Thanks

Alright, I’ve gotten a little further. I set up a DocumentType in target properties like this:

Then I did the following script:

on read from file theObject of type ofType path name pathName
	display dialog pathName as text
end read from file

on write to file theObject of type ofType path name pathName
	do shell script "mkdir " & "\"" & pathName & "\""
	return true
end write to file

As you can see, on write to file it creates a empty directory, which is then recognized as a bundle (with “Show Package Contents” context menu item) with the proper icon, so that’s all good. The issue here is when it comes to reading/opening the file. If I try to open the file by double clicking it in Finder, it crashes Finder. If I try to open it from within the app, nothing happens. Can someone tell me what’s wrong? I put “display dialog pathName as text” in there because I wanted to see if I could make it do something :stuck_out_tongue:

EDIT: Another little development. After having the app try to open the file (and it did nothing) I opened Console and tried to see if I could find any errors, and I did:

This error is what is causing the problem, but I’m not sure what I should do to fix it