Info Window Comments (Help Needed Urgently!)

lostprocess

Registered
I'm working on a PHP script that will work as a directory index / gallery builder for my ~/Pictures folder. I very badly need a way to extract comments from info windows. The tricky part is that it needs to be done from the command line. My programming skills outside PHP are not that great, and I was hoping that there is an existing way of doing this.

This feature would be very very nice for providing a quick and easy way of providing a description of files for the gallery. I can not use AppleScript because every time the page is loaded, I'd have a bouncing AppleScript thing in the dock. This needs to be done from the command line. I need this to be dynamic, without a database for maximum reusability.

Please, if there's an existing way to do this, post here. If you have enough talent to build a small command line program that would do this for me, I would love you forever if you built it for me! I just need some answers soon, because it's holding up my project. :(

Please help!
 
Well, there is a program in /Developer/Tools which returns file creators and stuff like that. Its called GetFileInfo. You could allways, and I may be totally wrong about this, but have you ever viewed one of your files in a text editor, and searched for something in the window coments?

Once again, I'm speaking with out trying ;-)

Hope you figure this one out, and please post if you do.
 
Well from what I understand, info window comments are HFS+ Attributes, and GetFileInfo is supposed to view these (so you can see which attributes are set) though it seems to support everything BUT comments. Which is why this is so puzzling!

Are there anything in the Cocoa APIs that deal with retrieving comments?

I tried the text editor trick, and I had no luck. This is discouraging. :(
 
I highly doubt there would be anything in Cocoa dealing with comments. Use Carbon if you need C.

The easiest way to do it would be AppleScript - just set the script's Keep Open checkbox and save it as an applet.
 
I had this idea last night at 5am, so I thought it could wait until morning ;-)

Anyway, I think that coments are stored out-side of the file they coment on. Like a desktop file or something (remember when rebuilding the desktop caused all the window coments to be erased?)

Well, most of my directories contain the following:
.CFUserTextEncoding
.DS_Store
.FBCIndex
.FBCLockFolder/

So how about looking there for a known window coment? Hope you figure this out, and have you thought about maybe just not using window coments and in stead creating a file with a different extention than the picture? EG:
Picture2032.jpg
Picture2032.411

Thats what my mavica does, anyway.

Hope that helps ;-)
 
Hrm, I keep leaning more and more in the direction of an AppleScript. What about Carbon, though? Can Carbon applications be made to run from the command line, or is that specific to Cocoa? And would a Carbon app do what I need?
 
You can create both Foundation (Cocoa) and Carbon tools for the command line. If you're going to use Carbon then create a "standard tool" and go to Project - Add Framework and add the Carbon framework. Add #include <Carbon/Carbon.h> to the tops of your source files. This way the app won't be built as a bundle and so won't appear in the dock. Don't try to create windows or anything like that though.

I used this to create a command line "say" command using Carbon's Text-to-Speech. It was surprisingly easy to do.

As for how to read the file comments, I vaguely remember Apple discouraging users from using them progamatically in the Classic Toolbox, in which case it may not be in Carbon or Cocoa.

Peter
 
thanks for the information on command line stuff. i've since been told the following can be found in 'Files.h' -- i don't know enough of how to put this to use, but it seems to be a step in the right direction:

/*
*
* PBDTGetCommentSynch()
*
* Availability:
* Mac OS X: in version 10.0 and later in the CoreServices.framework
* CarbonLib: in CarbonLib 1.0 and later
* Non-Carbon CFM: in InterfaceLib 7.1 and later
*/

extern OSErr PBDTGetCommentSync(DTPBPtr paramBlock);

the guy who found this for me said the difficulty would be filling out DTPBPtr because he doesn't know how it should be done. i'm certainly at a loss because it just isn't my thing. i'm hoping this may provide enough of a jumpstart that i'll have something usable soon.
 
Back
Top