• 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: [Slightly OT] Scripting Bridge in Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Slightly OT] Scripting Bridge in Leopard


  • Subject: Re: [Slightly OT] Scripting Bridge in Leopard
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 1 Nov 2007 13:47:47 -0700

On Oct 31, 2007, at 7:23 AM, Rob Stott wrote:

I guess this is kind of off topic, but as it relates to automating apps in Mac OS X... Has anyone had a play with Scripting Bridge?

I was wondering if it might have any advantages over AppleScript for automation but so far I can't even get the example in the 'Scripting Bridge Programming Guide' to work.

I'm thinking I'm probably missing something obvious (pretty likely!). Anyone got a sample 'Hello World' type thing they'd be prepared to share?

It might be faster if you just posted your code, but in the meantime, here's a short snippet (run it in Terminal) that prints the current track, pauses, and then resumes:


#import <Foundation/Foundation.h>
#import "iTunes.h"

int main()
{
iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"];
if (iTunes) {
iTunesTrack *t = [iTunes currentTrack];
printf("now playing: %s (%s, %d)\n", [[t name] UTF8String], [[t artist] UTF8String], [t year]);
sleep(1);
printf("pausing...\n");
[iTunes pause];
sleep(5);
[t playOnce:NO];
printf("as you were.\n");
}
return 0;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden
  • Follow-Ups:
    • Re: [Slightly OT] Scripting Bridge in Leopard
      • From: Rob Stott <email@hidden>
    • Re: [Slightly OT] Scripting Bridge in Leopard
      • From: deivy petrescu <email@hidden>
  • Prev by Date: RubyOSA in Leopard
  • Next by Date: Re: arrow icon
  • Previous by thread: Re: [Slightly OT] Scripting Bridge in Leopard
  • Next by thread: Re: [Slightly OT] Scripting Bridge in Leopard
  • Index(es):
    • Date
    • Thread