Re: [Slightly OT] Scripting Bridge in Leopard
Re: [Slightly OT] Scripting Bridge in Leopard
- Subject: Re: [Slightly OT] Scripting Bridge in Leopard
- From: deivy petrescu <email@hidden>
- Date: Thu, 1 Nov 2007 21:10:20 -0400
On Nov 1, 2007, at 16:47, Christopher Nebel wrote:
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;
}
I'd appreciate it if someone would help me here!
I did created the iTunes.h file, but, when I run (g)cc this file in
terminal (itunes.m for me) I get:
"
Undefined symbols:
"___CFConstantStringClassReference", referenced from:
__cfstring@0 in ccADvb4i.o
".objc_class_name_SBApplication", referenced from:
literal-pointer@__OBJC@__cls_refs@SBApplication in ccADvb4i.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
"
What did I do wrong?
Thanks.
Deivy
_______________________________________________
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