• 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: AppleScript create command
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AppleScript create command


  • Subject: Re: AppleScript create command
  • From: "James J. Merkel" <email@hidden>
  • Date: Tue, 13 Jul 2004 22:59:41 -0700

On Jul 13, 2004, at 11:16 AM, Dustin Voss wrote:


On 13 Jul, 2004, at 7:15 AM, James J. Merkel wrote:

Making a little more progress. I added the following to a delegate of NSApplication:


- (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key
{
NSLog(@"key = %@", key);
return [key isEqualToString:@"metadata"];
}

-(id)metadata{
NSLog(@"metadata method called");
return [ExifInfo self];
}

Is "metadata" a property or an element? If it is an element, you should be returning an array of ExifInfo objects. If it is a property, you should be returning one ExifInfo object.

"return [ExifInfo self]" is wrong. It will return nil because "self" is not a selector. Return an NSArray or ExifInfo instance variable.

I'm not sure what the metadata method should really do. The above was just a WAG.

Cocoa Scripting will handle the get command by converting the AppleScript "metadata" element (I assume it's an element) into a "metadata" to-many KVC key. The KVC system will call the -metadata method, which should return an array, like any to-many key. The KVC system will then pick out the indexed object and return that to Cocoa Scripting. Cocoa Scripting will take that object and call -objectSpecifier on it to convert it a specifier, which is a form the rest of AppleScript can deal with. The specifier will be the return value of the get command.

You need to re-read Apple's documentation. Try <http://developer.apple.com/documentation/Cocoa/Conceptual/ AppArchitecture/Concepts/Scripting.html> and <http://developer.apple.com/documentation/Cocoa/Conceptual/ Scriptability/Tasks/ScriptabilityGuidelines.html>.

Ok that worked -- I just created an array of ExifInfo objects and returned that array from the metadata method.

Thanks for your help.
Jim merkel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >AppleScript create command (From: "James J. Merkel" <email@hidden>)
 >Re: AppleScript create command (From: "James J. Merkel" <email@hidden>)
 >Re: AppleScript create command (From: Dustin Voss <email@hidden>)
 >Re: AppleScript create command (From: "James J. Merkel" <email@hidden>)
 >Re: AppleScript create command (From: "James J. Merkel" <email@hidden>)
 >Re: AppleScript create command (From: Dustin Voss <email@hidden>)

  • Prev by Date: applicationShouldTerminateAfterLastWindowClosed bug?
  • Next by Date: Re: Window "Flash"
  • Previous by thread: Re: AppleScript create command
  • Next by thread: retainCount PMPrintSettings
  • Index(es):
    • Date
    • Thread