• 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: NSAppleScript - what is going on here?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSAppleScript - what is going on here?


  • Subject: Re: NSAppleScript - what is going on here?
  • From: Steve Cronin <email@hidden>
  • Date: Sun, 22 Mar 2009 12:53:18 -0500

Adam;

I'm an ObjC guy -- I generally avoid the C stuff if possible - 'cause I have to support my own code.

But your method seems like it will work not only as a replacement but actually a doorway to the full gamut of common metadata attributes - very nice!!

I know I should lose the resistance but there are only so many mountains one guy can climb...

Thanks for the very helpful note!
Steve

On Mar 22, 2009, at 12:43 PM, Adam R. Maxwell wrote:

On Mar 21, 2009, at 10:38 AM, Steve Cronin wrote:

The 'theScript' is a valid script that executes flawlessly in 'Script Editor':
tell application "Finder"
try
comment of file ("/Users/steve/...." as POSIX file)
on error
return "Error"
end try
end tell

It sounds like you've solved your problem, but I'd just note that if you're only getting Finder comments, MDItem is faster and simpler:


- (NSString *)commentForURL:(NSURL *)fileURL;
{
   NSParameterAssert([fileURL isFileURL]);

   MDItemRef mdItem = NULL;
   CFStringRef path = (CFStringRef)[fileURL path];
   NSString *theComment = nil;

if (path && (mdItem = MDItemCreate(CFGetAllocator(path), path))) {
theComment = (NSString *)MDItemCopyAttribute(mdItem, kMDItemFinderComment);
CFRelease(mdItem);
[theComment autorelease];
}
return theComment;
}





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSAppleScript - what is going on here?
      • From: Michael Ash <email@hidden>
    • Re: NSAppleScript - what is going on here?
      • From: Jim Correia <email@hidden>
    • Re: NSAppleScript - what is going on here?
      • From: Kyle Sluder <email@hidden>
References: 
 >NSAppleScript - what is going on here? (From: Steve Cronin <email@hidden>)
 >Re: NSAppleScript - what is going on here? (From: "Adam R. Maxwell" <email@hidden>)

  • Prev by Date: Re: NSAppleScript - what is going on here?
  • Next by Date: Re: Programmatically Change Icon
  • Previous by thread: Re: NSAppleScript - what is going on here?
  • Next by thread: Re: NSAppleScript - what is going on here?
  • Index(es):
    • Date
    • Thread