• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Finder Show Info Comments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder Show Info Comments


  • Subject: Re: Finder Show Info Comments
  • From: Greg Titus <email@hidden>
  • Date: Thu, 6 Dec 2001 10:27:34 -0800

On Thursday, December 6, 2001, at 07:59 AM, Eric Schlegel wrote:

On Wednesday, December 5, 2001, at 10:53 PM, Ian G. Gillespie wrote:

I am trying to figure out how I can get a string out of the comments text view in Finder's Show Info Window. I would also like to be able edit the string and then put it back. Anyone know how I can do this preferably using Java?

You need to use the Finder's AppleEvent suite to do that. The old desktop database APIs are implemented in Carbon, but the Mac OS X Finder doesn't store comments in the desktop database, so using those APIs won't help.


There's no Java binding, but if you have OmniAppKit (see developer section of www.omnigroup.com) around you could do:

scriptText = [NSString stringWithFormat:@"tell application \"Finder\" to get comment of file \"%@\"", hfsPath];
comment = [OAAppleScript executeScriptString:scriptText];

// modify comment as desired here

scriptText = [NSString stringWithFormat:@"tell application \"Finder\" to set comment of file \"%@\" to \"%@\"", hfsPath, comment];
[OAAppleScript executeScriptString:scriptText];

Also note that Finder expects your path to be colon separated, Carbon style, not slash separated, Unix style.

A quick way to change is:

fileURL = CFURLCreateWithFileSystemPath(NULL, (CFStringRef)filename, kCFURLPOSIXPathStyle, NO);
hfsPath = (NSString *)CFURLCopyFileSystemPath(fileURL, kCFURLHFSPathStyle);
CFRelease(fileURL);

Hope this helps,
--Greg


References: 
 >Re: Finder Show Info Comments (From: Eric Schlegel <email@hidden>)

  • Prev by Date: Re: Rep_:_ObjC++_ and_a_word_about_Java,_too_
  • Next by Date: Re(2): Application localization
  • Previous by thread: Re: Finder Show Info Comments
  • Next by thread: Re: Finder Show Info Comments
  • Index(es):
    • Date
    • Thread