• 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: Scripting Bridge running method passing an array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Bridge running method passing an array


  • Subject: Re: Scripting Bridge running method passing an array
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 30 Oct 2009 13:33:32 -0700

On Fri, Oct 30, 2009 at 12:55 PM, Scott <email@hidden> wrote:
> Through some help I was able to get this resolved. My problem was I
> didn't look at SBElementArray closely enough. I thought it was only
> used to get objects not pass them back to an application. Makes sense
> that Scripting Bridge needs to use it's own array's now that I think
> about it. I was trying to create a new array. Anyway for anyone in the
> future who is as bad at reading the developer docs as I am here is a
> working example of what I was trying to do it is actually pretty
> simple.

There are some quirks… the -exists method that the documentation
prescribes doesn't actually exist.  So this doesn't work (using
OmniFocus names here because I don't have Airfoil):

OmniFocusDocument *document = [[[OmniFocus documents]
objectWithName:@"OmniFocus"] exists];

This results in a compiler error; defining this method instead results
in unrecognized selector exception.

Then I tried using -get:

OmniFocusDocument *document = [[[OmniFocus documents]
objectWithName:@"OmniFocus"] get];
BOOL exists = (document != nil);

But that didn't work because that's not how documents are identified.
So finally, this worked for Mail.app:

MailMailbox *mbox = [[[Mail mailboxes] objectWithName:@"ToDos"] get];
BOOL exists = (mbox != nil);

So there you have it.

--Kyle Sluder
_______________________________________________

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

References: 
 >Scripting Bridge running method passing an array (From: Scott <email@hidden>)
 >Re: Scripting Bridge running method passing an array (From: Kyle Sluder <email@hidden>)
 >Re: Scripting Bridge running method passing an array (From: Scott <email@hidden>)
 >Re: Scripting Bridge running method passing an array (From: Kyle Sluder <email@hidden>)
 >Re: Scripting Bridge running method passing an array (From: Scott <email@hidden>)
 >Re: Scripting Bridge running method passing an array (From: Scott <email@hidden>)

  • Prev by Date: Re: Cocoa bindings problem
  • Next by Date: Re: Cocoa bindings problem
  • Previous by thread: Re: Scripting Bridge running method passing an array
  • Next by thread: Re: Scripting Bridge running method passing an array
  • Index(es):
    • Date
    • Thread