[comp.sys.mac.programmer] File and Folder Comments?

siegel@endor.harvard.edu (Rich Siegel) (02/24/89)

	I'd like to programmatically get the comment information (if any)
that is displayed in the Get Info box for files and folders. Do any of the
HFS system calls (PBHGetFInfo, PBGetCatInfo) return this information as
part of their parameter blocks? I'd like to get the information, but I
don't want to hack the desktop file, since (a) it may not necessarily be
present, and (b) this also needs to work on AppleShare volumes.

	Any information would be much appreciated.

		--Rich

Rich Siegel
Staff Software Developer
THINK Technologies Division, Symantec Corp.
Internet: siegel@endor.harvard.edu
UUCP: ..harvard!endor!siegel
Phone: (617) 275-4800 x305

bob@accuvax.nwu.edu (Bob Hablutzel) (02/25/89)

> 	I'd like to programmatically get the comment information (if any)
> that is displayed in the Get Info box for files and folders. Do any of the
> HFS system calls (PBHGetFInfo, PBGetCatInfo) return this information as
> part of their parameter blocks? I'd like to get the information, but I
> don't want to hack the desktop file, since (a) it may not necessarily be
> present, and (b) this also needs to work on AppleShare volumes.

> 	Any information would be much appreciated.

> 		--Rich

No luck unless you want to play with the Desktop file. One of the 'finder'
longwords returned by GetCatInfo is the ident of the resource in the desktop.
(See the description of the FXInfo record on page IM IV-183). I don't know
of any routine which will consistantly return the comment for all volumes.
Note to Apple - this would be nice, especially if we could _set_ the comment
as well. This would allow newly created files to have comments on them.

> Rich Siegel
> Staff Software Developer
> THINK Technologies Division, Symantec Corp.
> Internet: siegel@endor.harvard.edu
> UUCP: ..harvard!endor!siegel
> Phone: (617) 275-4800 x305
> ----------


Bob Hablutzel	Wildwood Software	BOB@NUACC.ACNS.NWU.EDU

alexis@ccnysci.UUCP (Alexis Rosen) (02/26/89)

[Rich asks about programmatically accessing finder comments]

As far as I know this has never been possible. After all, when not in the
Finder, the DeskTop file is closed (ignore MultiFinder for the moment) and
those calls certainly aren't going to open it for you. I suspect that this
will change sometime in the future, when the revised DTM init is universal,
and MultiFinder is always active (and thus the DT files will always be open).
Alternatively, Apple might drop the file comments altogether. This seems
quite possible, now that we have 'vers' resources.

Perhaps you should consider just looking for 'vers' 0, and then for the
signature resource if you can't find that and it's an app.

(BTW, I wouldn't write code to parse the DTM init desktop files, as it is
possible- no, likely- that they will change if/when Apple comes out with
the revised resource manager, which could be as early as August. I know that
those files don't use the Resource Manager now, but if the RM is altered
in such a major way as it will be, it may be used for all sorts of things,
like the Desktop file again.)

Alexis Rosen
alexis@ccnysci.uucp

amanda@lts.UUCP (Amanda Walker) (02/28/89)

alexis@ccnysci.UUCP (Alexis Rosen) writes:
    
    (BTW, I wouldn't write code to parse the DTM init desktop files, as it is
    possible- no, likely- that they will change if/when Apple comes out with
    the revised resource manager, which could be as early as August. I know that
    those files don't use the Resource Manager now, but if the RM is altered
    in such a major way as it will be, it may be used for all sorts of things,
    like the Desktop file again.)
    
    Alexis Rosen
    alexis@ccnysci.uucp

You should never need to parse the DTM files, since any time you would
have to, you can use the new Desktop Manager calls; this is how the
Finder does it.  The calls are mentioned in IM V, although I don't remember
if they are documented there.

siegel@endor.harvard.edu (Rich Siegel) (02/28/89)

In article <922@lts.UUCP> amanda@lts.UUCP (Amanda Walker) writes:
>
>You should never need to parse the DTM files, since any time you would
>have to, you can use the new Desktop Manager calls; this is how the
>Finder does it.  The calls are mentioned in IM V, although I don't remember
>if they are documented there.

	Agreed, and I don't intend to try interpreting them. The mentioned
Desktop Manager calls are referred to on Inside Mac 5, page 393, but not
documented anywhere.

	Anyone have any ideas on where I can find docs on these calls?


		--Rich

Rich Siegel
Staff Software Developer
THINK Technologies Division, Symantec Corp.
Internet: siegel@endor.harvard.edu
UUCP: ..harvard!endor!siegel
Phone: (617) 275-4800 x305

gandreas@umn-d-ub.D.UMN.EDU (Glenn Andreas) (02/28/89)

In article <1287@husc6.harvard.edu> siegel@endor.UUCP (Rich Siegel) writes:
>	Agreed, and I don't intend to try interpreting them. The mentioned
>Desktop Manager calls are referred to on Inside Mac 5, page 393, but not
>documented anywhere.
>
>	Anyone have any ideas on where I can find docs on these calls?
>
>
>		--Rich


I believe that these (OpenDB, AddIcon, AddComments) are all AppleTalk AFP
calls, rather than "normal" calls.  So if you have a volume connected
through LocalTalk and want to roll your own packets.  You might want to
check out "Inside Appletalk" or whatever it is called for more details.

Of course I could be wrong.


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
= "Whether you like it, or don't like it, sit   | - gandreas@ub.d.umn.edu - =
=  back and take a look at it, because it's the |   Glenn Andreas           =
=  best going today!  WOOOOoooo!" - Ric Flair   |                           =
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

ech@pegasus.ATT.COM (Edward C Horvath) (02/28/89)

From article <1287@husc6.harvard.edu>, by siegel@endor.harvard.edu (Rich Siegel):
> Desktop Manager calls are referred to on Inside Mac 5, page 393, but not
> documented anywhere.
> 
> 	Anyone have any ideas on where I can find docs on these calls?

You need the "AppleTalk Filing Protocol (AFP) Engineering Technical Notes,"
from your friendly neighborhood APDA.  Or maybe Tim Maroney will dump core
in this very forum in the next day or two...

=Ned=

alexis@ccnysci.UUCP (Alexis Rosen) (02/28/89)

In article <922@lts.UUCP> amanda@lts.UUCP (Amanda Walker) writes:
>You should never need to parse the DTM files, since any time you would
>have to, you can use the new Desktop Manager calls; this is how the
>Finder does it.  The calls are mentioned in IM V, although I don't remember
>if they are documented there.

My first reaction to this was "What calls???" Since Amanda is not error-
prone, I looked in IM-V, and sure enough, there is a somewhat obscure
reference to such calls on page 393. (I wonder what other good things I've
missed since "leviticus" or whatever it was called...)

Nowhere, however, could I find any information about actually using these
calls. Does anybody know how to use them? My guess is that they're not
documented because they are liable to change. (An optimist might read this
as an indication that the Res Manager is indeed going to be changed soon,
as I suggested in a previous note. A pessimist would say that Apple was
lazy again. Truth is probably somewhere in the middle.)

A truly enterprising individual might want to run his/her favorite debugger
on the Finder to see what the Finder does. I'm not enterprising...

Alexis Rosen
alexis@ccnysci.uucp

amanda@lts.UUCP (Amanda Walker) (03/02/89)

alexis@ccnysci.UUCP (Alexis Rosen) writes:
    [about the new desktop manager calls]

    Nowhere, however, could I find any information about actually using these
    calls. Does anybody know how to use them? My guess is that they're not
    documented because they are liable to change. (An optimist might read this
    as an indication that the Res Manager is indeed going to be changed soon,
    as I suggested in a previous note. A pessimist would say that Apple was
    lazy again. Truth is probably somewhere in the middle.)

Well, my guess is that they're not in IM V because they are so far only
implemented for AppleShare volumes or if you're using the Desktop Manager
Init, which as we all know is Not Recommended By Apple :-).

Here's the fun part.  I know I've seen (sparse) docs on the new calls,
including arguments, trap numbers, and so forth.  I just can't for the
life of me remember where.  It might have been in the APDA draft of IM V,
or then again it might have been in the seed draft of the Shared Environment
notes, or maybe in the header files for MPW 2.0{A3,Bwhatever}, or something.

Wherever they are, I can't find them any more, which I find greatly annoying.
Anyone else care to sift through old Apple preliminary docs and see if you
can find this information?  I mean, after all, Apple *does* document the
call that tells you whether or not the new calls are available...

I hate half-documented things...

-- 
Amanda Walker, InterCon Systems Corporation
amanda@lts.UUCP / ...!uunet!lts!amanda / 703.435.8170
--
Those whom the gods would destroy they first teach COBOL.

ech@pegasus.ATT.COM (Edward C Horvath) (03/02/89)

From article <923@lts.UUCP>, by amanda@lts.UUCP (Amanda Walker):
> alexis@ccnysci.UUCP (Alexis Rosen) writes:
>     [about the new desktop manager calls]
> 
> Wherever they are, I can't find them any more...
> Amanda Walker, InterCon Systems Corporation

I replied to Alexis via mail; guessed wrong again...

They're in the AFP Engineering Tech Notes, APDA doc KNBAFP.  At least, they're
in my "preliminary" version handed out at the Developer's conference in '87,
dated 2/17/87.  At least, it was KNBAFP before Apple swallowed APDA.

=Ned Horvath=

amanda@lts.UUCP (Amanda Walker) (03/03/89)

ech@pegasus.ATT.COM (Edward C Horvath) writes:
    [re: new desktop DB calls]

    They're in the AFP Engineering Tech Notes, APDA doc KNBAFP.

Close, but no cigar.  That document does indeed document the arguments
and so forth, but it still doesn't document how to actually call the
routines from a program on the Mac.  What I was talking about was either
actual HFSDispatch routine selectors or trap numbers (I think it's the
former, but don't quote me on it :-))...

-- 
Amanda Walker, InterCon Systems Corporation
amanda@lts.UUCP / ...!uunet!lts!amanda / 703.435.8170
--
Those whom the gods would destroy they first teach COBOL.

sas1@tank.uchicago.edu (stuart austin schmukler) (03/10/89)

From the deep mists of time (aka LISA development days) I remember
that the Finder of those da kept the Comments in resources hashed into
the Desktop file.  I just got into Resedit under multifinder and found-out
that FCMT's are still around in the desktop file.

In fact there is a TMPL for the resource in my version of ResEdit.  (This
comes as a suprize because Apple didn't really want to tell use about FCMT's
in the fist place, but you know Apple.)  

Now there are a few more problems:
	- I have forgot the hash function you need to get at the FCMT
for a particlur file. (The code in at my old job, maybe on LISA
disks.)  I do recall that it was (is) NOT one-to-one. So, different
filenames can map to the same FCMT resource number.

	-I noticed that under MF the DeskTop file is Locked for any
open folder. 

I'll look in the pile of disks and ask if the guy who started
programming the project has the source code.

Apple did not want us poking around in the FCMT's for two reasons:
	-The format, etc may change.
	-The FCMT 'should be under the control of the user'.
		We were thinking of putting information in there.

Finially, the FCMT has an odd limit on the number of characters in the
text string, something like 253.

SaS