[comp.sys.mac.programmer] Opening Double-clicked documents

gilbert@grad1.cis.upenn.edu (Michael Gilbert) (10/19/90)

How does one convince their application to automatically open a
document that has been double-clicked.  All mine seems to do is to
start the application, but it forgets about the document that started
it.

Thanks,

Mike W. Gilbert

wolf@mel.cipl.uiowa.edu (10/19/90)

In your program you must check to see if there are any files which were double
clicked and that is why your application is up.

You use CountAppFiles and it returns an integer, if it is > 0 then there has
been opened files from the finder (the number of selected files is the integer
returned, call it count), as a part of CountAppFiles, I think it returns a
variable integer which represents 'open' or 'print' (which command was used
from the finder).

You then use GetAppFile which takes an index number from 1 to Count and you
give it a variable for the fType.  It will pull out the relevant info like the
WDRefNum, fName, fType, Version....

You can then check the fType to see if it is what you want, then do what you
need to do according to if it was to open or print.

Then you can set the finder info for the file to processed by calling (someone
fill in this blank).

I know this is not exacting, but my IM's are at home.  All of this can be found
in IM II I believe.

If I made any mistakes above, please no flaming, as I said, my IM's are at
home, and I don't have the memory of an elephant....


Michael