[comp.sys.mac.programmer] "Startup" documents

dbert@churchy.ai.mit.edu (Douglas Siebert) (02/27/91)

I have a question for all you programmers which I *think* may relate to
ResEdit, but I'm not certain.  What I want to know is, how can one determine
the actions taken by a "startup" document (I'll call it this for want of a
better/standard term to call it -- what I'm referring to is a document
which, when double-clicked upon, opens a related application.  An example
of what I mean would be when you double-click on a MacWrite document you
open the MacWrite application)

What I'm trying to determine is if there is any way to use ResEdit (or some
other application) and look at the startup document and locate the sections
where the related application is opened.  Also I'd like to know how to make
this action occur myself, but I'd bet information like that would be
available in Inside Macintosh (which I, as a new Mac owner, haven't yet
gotten around to purchasing :) ) or some other reference.  Mainly though
I'd just be really happy if someone could tell me how to locate the
aforementioned sections of a startup document (not specific to any one
application, but in a general sense)  Since this is probably not of general
interest it would probably be better if you e-mailed me.  Thank you to
anyone who can take the time to help me out in this matter.

--
________________________________________________________________________
Doug Siebert                                     dbert@albert.ai.mit.edu
MBA Student (2nd year)
The University of Iowa

stevec@Apple.COM (Steve Christensen) (02/28/91)

dbert@churchy.ai.mit.edu (Douglas Siebert) writes:
>[...]
>What I'm trying to determine is if there is any way to use ResEdit (or some
>other application) and look at [an app's] document and locate the sections
>where the related application is opened.  Also I'd like to know how to make
>this action occur myself, but I'd bet information like that would be
>available in Inside Macintosh (which I, as a new Mac owner, haven't yet
>gotten around to purchasing :) ) or some other reference.  Mainly though
>I'd just be really happy if someone could tell me how to locate the
>aforementioned sections of a startup document (not specific to any one
>application, but in a general sense)  Since this is probably not of general
>interest it would probably be better if you e-mailed me.  Thank you to
>anyone who can take the time to help me out in this matter.

An application's document just contains relevant data, i.e, text in a word
processing document or graphics in a paint or drawing program.  It has no
knowledge of how to open the application.  Rather, the process is the other
way around: the application knows how to open and interpret the document.
So how does the application get started up when you click on one (or more) of
its documents?

The Finder (usually) builds a list of documents that are to be opened, figures
out which application they belong to (by checking the document's creator info),
and opens the application(s).  The application can then ask if there are any
documents to be opened when it starts up and peruse that list seeing if any
are for it.  It then opens the documents as if "Open..." had been selected.

The specifics on how this works can be found in the Segment Loader chapter of
Inside Mac volume II.

steve

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Steve Christensen			Never hit a man with glasses.
  stevec@apple.com			Hit him with a baseball bat.

thomps@inmet.inmet.com (03/07/91)

	If I may piggyback on this question - where can I look to
	find out how to make a "Startup" file for an application?

	In UNIX land, this would just be a link (ln).  If, for example,
	I have a Lightspeed C (3.0) application that lives in a
	development folder, how can I link to this with a "Startup"
	file in different folders where I want to use it?  It really
	wastes disk space copying the application everywhere I want to
	use it.

	Thanks, -JohnT.

d88-jwa@dront.nada.kth.se (Jon W{tte) (03/08/91)

JohnT says:

	In UNIX land, this would just be a link (ln).  If, for example,
	I have a Lightspeed C (3.0) application that lives in a
	development folder, how can I link to this with a "Startup"
	file in different folders where I want to use it?  It really
	wastes disk space copying the application everywhere I want to
	use it.

System 7 will include "aliases" that point to other files, very much
symbolic links. You'll also have the possibility of putting aliases
in the menu.

As regards startup files, you could create an empty document with
your application's signature as creator. When you double-click it,
your application gets launched (and, presumably, opens the empty
document...)

Happy hacking,

						h+@nada.kth.se
						Jon W{tte
"The IM-IV file manager chapter documents zillions of calls, all of which
seem to do almost the same thing and none of which seem to do what I want
them to do."  --  Juri Munkki in comp.sys.mac.programmer