Re: Scripting Bridge running method passing an array
Re: Scripting Bridge running method passing an array
- Subject: Re: Scripting Bridge running method passing an array
- From: Scott <email@hidden>
- Date: Fri, 30 Oct 2009 15:55:07 -0400
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.
@try{
AirfoilApplication *Airfoil = [SBApplication
applicationWithBundleIdentifier:@"com.rogueamoeba.Airfoil"];
SBElementArray * speakers =[Airfoil speakers] ;
id aSpeaker = [speakers objectWithName: connectToThisSpeaker];
[Airfoil connectTo:aSpeaker password:nil];
}
@catch(NSException *e)
{
NSLog(@"Exception:%@");
}
On Fri, Oct 30, 2009 at 5:03 AM, Scott <email@hidden> wrote:
> I have read over the developer documents but am still confused. Do I
> need to look at "classForScriptingClass"? I was playing around with
> this but it wasn't making a lot of sense of sense in this instance. I
> could understand if I was trying to send the speaker to an object but
> I'm trying to run the method with an object. It does make sense that I
> need to define the application class to my object though. Just want to
> make sure I'm headed in the right direction. Thanks for your help.
>
>
> On Fri, Oct 30, 2009 at 3:02 AM, Kyle Sluder <email@hidden> wrote:
>> On Thu, Oct 29, 2009 at 11:54 PM, Scott <email@hidden> wrote:
>>> Thanks for the response Kyle. I will ask Rogue. This is how you send
>>> commands via AS
>>>
>>> tell application "Airfoil"
>>>
>>> -- Connect to Airport Express
>>> connect to (every speaker whose name is "Computer")
>>>
>>> end tell
>>
>> Ah, this would be a problem… your code is trying to pass an NSArray
>> with an NSString in it, whereas the command wants an NSArray
>> containing references to "speaker" objects. You're going to need to
>> read the Scripting Bridge documentation a bit more thoroughly.
>>
>> --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