Questions tagged [scripting-bridge]

Scripting Bridge is a Cocoa framework that enables developers to communicate with scriptable applications in Objective-C.

Scripting Bridge is a framework and a technology that makes it much easier for Cocoa developers to control and communicate with scriptable applications. Instead of incorporating AppleScript scripts in your application or dealing with the complexities of sending and handling Apple events, you can simply send Objective-C messages to an object that represents an application with a scripting interface. Scripting Bridge Programming Guide

192 questions
1
vote
2 answers

How to Create a FileMaker Pro Record with scripting bridge

I am working on a Ruby Script (using MacRuby with Scripting Bridge) to do some processing on a FileMaker Pro database (FMP Advanced 10.) I am able to read databases, tables, and records by creating a FileMakerProAdvancedApplication object: framework…
jars
  • 145
  • 2
  • 8
1
vote
5 answers

IN operator with NSPredicate and SBElementArray

Does the IN operator work for filtering SBElementArrays? I have been trying to use it but it always returns a NULL array. My code (hexArray will typically have more elements): SBElementArray *musicTracks = [libraryPlaylist fileTracks]; hexArray =…
abroekhof
  • 796
  • 1
  • 7
  • 20
1
vote
2 answers

Apple Pages - Scripting Bridge and contents of selection

I am trying to use Apple Pages (from iWork) with Objective-C's Scripting Bridge. This is the working AppleScript: tell application "Pages" set name of item 1 of contents of (get selection) to "myLittleTextBox" end tell How can I achieve the…
1
vote
2 answers

ScriptingBridge without sdef? (cocoa)

I'd like to get properties of the currently active app. I understand that this should be possible with ScriptingBridge, however, this seems to require you generate an sdef file and import this in your project for the app you are trying to target.…
user429620
1
vote
0 answers

Issues when checking [iTunes isRunning] while iTunes is already lauching or closing - OSX

So, I have a status bar app that, when I click on it, does a bunch of stuff like retrieving current artist, track, and so on... So when the status bar is clicked I check if([iTunes isRunning]){ NSLog(@"do my stuff..."); } And it works very…
Pedro Vieira
  • 3,330
  • 3
  • 41
  • 76
1
vote
1 answer

How can I set iTunes album artwork via ScriptingBridge?

Today I discovered that when I added album artwork to iTunes, it had only actually added it to some of the tracks in each album. So I did what anyone would do and tried to write a script to rectify that. This is the first try, after about 3 hours of…
Hakanai
  • 12,010
  • 10
  • 62
  • 132
1
vote
2 answers

iTunes song queue

My app is controlling iTunes via scripting bridge. Other apps are able to choose a range of songs, and play them in order without having to create a playlist. I have searched the web for examples and red the iTunes.h file a dozen times, but I didn't…
IluTov
  • 6,807
  • 6
  • 41
  • 103
1
vote
1 answer

Creating an iTunes playlist and adding tracks in MacRuby

Why does this code result in an empty playlist, and how can I get that track into the playlist? #!/usr/local/bin/macruby framework 'Cocoa' framework 'ScriptingBridge' load_bridge_support_file 'iTunes.bridgesupport' iTunes =…
Chris Adams
  • 1,008
  • 1
  • 11
  • 22
1
vote
1 answer

sdef command not found - OSX 10.8

I'm trying to follow the instructions here: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/UsingScriptingBridge/UsingScriptingBridge.html#//apple_ref/doc/uid/TP40006104-CH4-SW1 Whenever I try to use…
Matthew Jones
  • 197
  • 1
  • 10
1
vote
1 answer

How to save the current safari tab using ScriptingBridge

I am trying to use the scripting-bridge to tell Safari to save the current page as PDF In the "Safari.h" header file exists a saving method of SafariItem class: - (void) saveAs:(NSString *)as in:(NSURL *)in_; So I used this but it doesn't…
MildC
  • 65
  • 1
  • 1
  • 5
1
vote
1 answer

Converting images with MacRuby

Does anybody know how to convert images with MacRuby (or normal ruby)? I would imagine that the 'ScriptingBridge' framework would be able to handle it. In addition, I would prefer not to use ImageMagick or the like (something lighter would be fine,…
dejay
  • 758
  • 2
  • 6
  • 18
1
vote
1 answer

Is it possible to modify iTunes tracks using Objective-C?

The question is in the title :) I'm playing a bit with Objective-C and Scripting Bridge. I know it is possible to get information (readonly) from iTunes, but i see nowhere a way to modify a track, for exemple change its name. Is it possible with…
mvdb
  • 443
  • 4
  • 19
1
vote
1 answer

How to use ScriptingBridge to tell Safari to open a URL in a new window?

I have an Objective-C app that uses ScriptingBridge to control Safari. It works, but I'm having trouble writing code for a new capability - to tell Safari to open a URL in a new window. Here's the AppleScript that does what I want: tell…
0
votes
1 answer

I'm trying to use scripting bridge with iTunes, but I'm getting an error

I'm trying to use scripting bridge to access album artwork with iTunes, but when I use the method [iTunesApplication currentTrack]; I get an error saying that there is no know class method current track It seems to work in other people's code, so…
0
votes
1 answer

Observing Distributed Objects in Cocoa

I'm trying to observe iTunes track changes on a local network machine. I have a scripting bridge object and can pass commands to it, but in order to find out any information I have to poll it. I thought distributed objects might be a solution, but…
Jesse
  • 551
  • 1
  • 5
  • 8