Search Results

Search found 6 results on 1 pages for 'scriptingbridge'.

Page 1/1 | 1 

  • Using ScriptingBridge framework for communicating with Entourage

    - by Subramanian Ganapathy
    Hi, The motivation for my question is the following doc, which describes how mail.app could be integrated using ScriptingBridge: http://developer.apple.com/mac/library/samplecode/SBSendEmail/Introduction/Intro.html I tried to apply a similar technique with Entourage as well but could not get any results so far. I understand that using AppleScript would help me solve my problem and mactech.com has extensive documentation for doing so. But i find this ScriptingBridge technique elegant and want to figure why it is not working for me with Entourage. The biggest problem seems to be my inability to create Scripting classes based on their names as it happens in Mail because Entourage has a different interface than Mail as their headers indicate. Could someone please tell me what I am missing or provide any sort of hint on why this wont work? I am also adding sample code ` MicrosoftEntourageApplication * mail = [SBApplication applicationWithBundleIdentifier:@"com.Microsoft.Entourage"]; MicrosoftEntourageOutgoingEmailMessage * emailMessage = [[[mail classForScriptingClass:@"outgoing message"] alloc] initWithProperties: [NSDictionary dictionaryWithObjectsAndKeys: @"my sample subject", @"subject", @"my sample body", @"content", nil]]; //then i create a set of recipients and try to use "to recipient" as the string scripting class id, but MicrosoftEntourageRecipient is returned as nil MicrosoftEntourageRecipient * theRecipient = [[[mail classForScriptingClass:@"to recipient"] alloc] initWithProperties: [NSDictionary dictionaryWithObjectsAndKeys: @"[email protected]", @"address", nil]]; ` I am trying to make the simple thing work, I am not even concentrating on the task I am supposed to do now. I am a Cocoa beginner( and willing to learn ), please excuse an syntactic naivetes and do point them out in the sample code, in addition to answering my question. Best Regards, Subramanian

    Read the article

  • ScriptingBridge causes iTunes to relaunch after quit

    - by Justin Voss
    I'm working on a Cocoa app that monitors what you're listening to in iTunes, and since I'm targeting Mac OS 10.5 and higher, I've decided to use Scripting Bridge. If I try to close iTunes too close to the time that my app polls it for the current track, iTunes will immediately relaunch! The only way to reliably prevent this behavior is to quit my app first, then quit iTunes. Switching to EyeTunes solves the problem, but it's a fairly old codebase and I was hoping that I could accomplish this without an external library. Surely I'm doing something wrong that's causing the relaunch? Here's some sample code; this snippet is run every few seconds, triggered by an NSTimer. #import "iTunesBridge.h" // auto-generated according to Apple's docs -(void)updateTrackInfo { iTunesApplication *iTunes = [[SBApplication alloc] initWithBundleIdentifier:@"com.apple.iTunes"]; iTunesTrack *currentTrack = [iTunes currentTrack]; // inspect currentTrack to determine what's being played... [iTunes release]; } Is this a known issue with Scripting Bridge, or am I using it incorrectly?

    Read the article

  • How can I close a Window using the OS-X ScriptingBridge framework, from Perl?

    - by Gavin Brock
    Problem... Since MacPerl is no longer supported on 64bit perl, I am trying alternative frameworks to control Terminal.app. I am trying the ScriptingBridge, but have run into a problem passing an enumerated string to the closeSaving method using the PerlObjCBridge. I want to call: typedef enum { TerminalSaveOptionsYes = 'yes ' /* Save the file. */, TerminalSaveOptionsNo = 'no ' /* Do not save the file. */, TerminalSaveOptionsAsk = 'ask ' /* Ask the user whether or not to save the file. */ } TerminalSaveOptions; - (void) closeSaving:(TerminalSaveOptions)saving savingIn:(NSURL *)savingIn; // Close a document. Attempted Solution... I have tried: #!/usr/bin/perl use strict; use warnings; use Foundation; # Load the ScriptingBridge framework NSBundle->bundleWithPath_('/System/Library/Frameworks/ScriptingBridge.framework')->load; @SBApplication::ISA = qw(PerlObjCBridge); # Set up scripting bridge for Terminal.app my $terminal = SBApplication->applicationWithBundleIdentifier_("com.apple.terminal"); # Open a new window, get back the tab my $tab = $terminal->doScript_in_('exec sleep 60', undef); warn "Opened tty: ".$tab->tty->UTF8String; # Yes, it is a tab # Now try to close it # Simple idea eval { $tab->closeSaving_savingIn_('no ', undef) }; warn $@ if $@; # Try passing a string ref my $no = 'no '; eval { $tab->closeSaving_savingIn_(\$no, undef) }; warn $@ if $@; # Ok - get a pointer to the string my $pointer = pack("P4", $no); eval { $tab->closeSaving_savingIn_($pointer, undef) }; warn $@ if $@; eval { $tab->closeSaving_savingIn_(\$pointer, undef) }; warn $@ if $@; # Try a pointer decodes as an int, like PerlObjCBridge uses my $int_pointer = unpack("L!", $pointer); eval { $tab->closeSaving_savingIn_($int_pointer, undef) }; warn $@ if $@; eval { $tab->closeSaving_savingIn_(\$int_pointer, undef) }; warn $@ if $@; # Aaarrgghhhh.... As you can see, all my guesses at how to pass the enumerated string fail. Before you flame me... I know that I could use another language (ruby, python, cocoa) to do this but that would require translating the rest of the code. I might be able to use CamelBones, but I don't want to assume my users have it installed. I could also use the NSAppleScript framework (assuming I went to the trouble of finding the Tab and Window IDs) but it seems odd to have to resort to it for just this one call.

    Read the article

  • QuickTimeX in Applescript / Scripting Bridge

    - by JP
    I'd like to be able to grab the metadata of the currently playing file in Quicktime X using ScriptingBridge and Ruby, so far I have the following code require 'osx/cocoa' OSX.require_framework 'ScriptingBridge' @app = OSX::SBApplication.applicationWithBundleIdentifier("com.apple.QuickTimePlayerX") @app.documents.each do |movie| # What now?! end But I can't find any functions in QuickTime X's applescript dictionary to get the metadata from a document object (the same data you can see in QT's 'Show Movie Inspector' HUD) — does anyone have any ideas?

    Read the article

  • How do I get the window id and tab number of a Terminal window using AppleScript via the ScriptingBr

    - by Gavin Brock
    I can open a Terminal tab using the following AppleScript: tell application "Terminal" set myTab to do script "exec sleep 1" get myTab end tell This returns a string like: tab 1 of window id 3263 of application "Terminal". This is great, I can see the window id 3263 and tab number 1 (although I don't know how to query myTab to get only these values). In the Cocoa ScriptingBridge, I can do: SBApplication *terminal; SBObject *tab; terminal = [SBApplication applicationWithBundleIdentifier:@"com.apple.terminal"] tab = [terminal doScript:@"exec sleep 1" in:nil] How do I get the window id and tab number from the tab object?

    Read the article

1