Hello,

I'm just learning Objective-C/Cocoa with limited programming
background. I am trying to control an application via AppleScript
commands using Scripting Bridge. I am able to do almost everything I
want except for two methods I can't get to work. I would like to
implement the following methods found in the header file created to
use Scripting Bridge

- (void) connectTo:(NSArray *)x password:(NSString *)password;  //
Connect to the Airport Express speakers
- (void) disconnectFrom:(NSArray *)x;  // Disconnect from the speakers

I am able to do many of the other methods in the header I just can't
get these two to work. I've tried not building an Array and just
sending a String and that didn't work at all. I don't get any errors
when I do the following it just doesn't do anythings. I've tried both
the disconnectFrom and connectTo just in case connecTo was failing
because of the password.

-(void)connectToSpeaker:(NSString*)connectToThisSpeaker
{

       AirfoilApplication *Airfoil =
[SBApplicationapplicationWithBundleIdentifier:@"com.rogueamoeba.Airfoil"];

       NSArray *setTheSpeaker;
       setTheSpeaker = [[NSArray alloc]
initWithObjects:connectToThisSpeaker, nil];

       @try{

       [Airfoil connectTo:setTheSpeaker password:nil];

       }

       @catch(NSException *e)
       {
               NSLog(@"Exception:%@");
       }
       NSLog(@"connected");
}


This is the code from my header file. Airfoil.h

@interface AirfoilApplication : SBApplication

- (SBElementArray *) documents;
- (SBElementArray *) windows;

@property (readonly) BOOL frontmost;  // Is this the frontmost
(active) application?
@property (copy, readonly) NSString *name;  // The name of the application.
@property (copy, readonly) NSString *version;  // The version of the
application.

- (AirfoilDocument *) open:(NSURL *)x;  // Open an object.
- (void) print:(NSURL *)x printDialog:(BOOL)printDialog
withProperties:(AirfoilPrintSettings *)withProperties;  // Print an
object.
- (void) quitSaving:(AirfoilSavo)saving;  // Quit an application.
- (void) connectTo:(NSArray *)x password:(NSString *)password;  //
Connect to the Airport Express speakers
- (void) disconnectFrom:(NSArray *)x;  // Disconnect from the speakers
- (void) openx:(NSURL *)x;  // Open an object.
- (void) print:(NSURL *)x;  // Print an object.
- (void) quitSaving:(AirfoilSavo)saving;  // Quit an application.

@end

I'd rather not use NSAppleScript just for these two methods. I've read
the Scripting Bridge developer documents but can't figure out what I
am doing wrong. Thanks for any help.

scott
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to