Setting Mac OS File Type & Creator

Dan Shafer revdan at danshafer.com
Mon Aug 15 18:36:29 EDT 2005


The problem I'm having -- and several people have been very helpful  
trying to get this to work -- is that my Rev standalone app writes a  
file to the disk and then later wants to use an AppleScript to open  
that file. In order for AppleScript to open the file via Finder,  
Finder needs to know the type and creator of the file, of course. But  
whether we use Revolution's set the fileType command or whether we  
plug in AppleScript set the creator and set the type commands, the  
type of the file never gets updated on the drive. As a result, Finder  
can't open it, either from my script calling an AppleScript or from  
the Finder directly by double-clicking the file. The old "I don't  
know what app created this file" dialog pops up.

We've tried a lot of stuff, including inserting a delay between the  
time we set the type and creator and the time we try to open the file  
(figuring maybe a slow drive or CPU could be at fault). So far, no  
luck on my setup, though one of the guys has had it work on his  
machine fine with a later version of OS9.


On Aug 15, 2005, at 1:54 PM, Martin Baxter wrote:

> Dan,
>
> Under OS9 and earlier the type and creator are stored by the finder  
> in a hidden file on the disk where the file resides. So forget the  
> resource fork. Res Edit just sets the finder information in this case.
> You can set the global filetype property in rev before writing the  
> file. Once the finder has this info about the file, it will then be  
> copied to any mac media that the file itself is copied to. To  
> transmit the file via a network with this data intact I suggest zip  
> or stuffit, both of which should keep type creator info intact.
>
> Martin Baxter
>
> Dan Shafer wrote:
>
>> This ought to be duck soup. But it's turned into alligator stew  
>> with  a live alligator.
>> I have a custom property set to a file. I want to write this file  
>> out  to an OS 9 system so that it shows up in Finder as a PDF  
>> file. From  all I can gather, I have a two-line problem:
>>   set the fileType to "CAROPDF "
>>   put PDFToOpen into URL "binfile:myFile.pdf"
>> But alas, this does not work. The file type and creator come up   
>> empty. If I use ResEdit to set the file type and creator as in  
>> the  command above, the file becomes a PDF file that Acrobat  
>> Reader  recognizes. So I know I have the creator and file type  
>> correct. Am I  perhaps doing this in the wrong place?
>> A clue: ResEdit tells me the file I'm writing has no resource  
>> fork. I  was under the impression that using "binfile" solved that  
>> problem?
>> I gather then that this has something to do with resfile: types  
>> but I  can't find anything in the docs about creating a resource  
>> fork, only  about copying them. But when I do a getResources on an  
>> OS9 file, as  far as I can tell, the type and creator aren't  
>> stored in the resource  fork (at least not as identifiable  
>> resources), so I'm basically lost  and under very tight deadline.
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> Dan Shafer, Revolution Consultant and Author
>> http://www.shafermedia.com
>> Get my book, "Revolution: Software at the Speed of Thought"
>>  From http://www.revolutionpros.com, Click "My Stuff"
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dan Shafer, Revolution Consultant and Author
http://www.shafermedia.com
Get my book, "Revolution: Software at the Speed of Thought"
 From http://www.revolutionpros.com, Click "My Stuff"






More information about the use-livecode mailing list