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
2
votes
1 answer

Scripting iTunes: playing single tracks

I’m working on an app where I want to signal iTunes at certain times to play single tracks from whatever playlist happens to be active. I’ve just started studying Scripting Bridge, I’ve used the command-line tools Apple references to create an…
Jeff J
  • 139
  • 8
2
votes
1 answer

New tab in Safari window from Cocoa and Scripting Bridge

I'm trying to create a new tab in a Safari window from Cocoa using Scripting Bridge. My code looks something like this: SafariApplication *safari = [SBApplication applicationWithBundleIdentifier:@"com.apple.Safari"]; if ([[safari windows]…
Thor Frølich
  • 664
  • 5
  • 18
2
votes
2 answers

QuickTimeX in Applescript / Scripting Bridge

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 =…
JP.
  • 5,507
  • 15
  • 59
  • 100
2
votes
2 answers

AppleScript with Mail, reply to email, can't set content

I can correctly create a brand new outgoing message in Mail, and set its body. However, when I try to use the replyOpeningWindow:replyToAll: method (called on an existing mail message), I cannot set the content. Calling setContent: on the resultant…
Amy Worrall
  • 16,250
  • 3
  • 42
  • 65
2
votes
2 answers

ScriptingBridge causes iTunes to relaunch after quit

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…
Justin Voss
  • 6,294
  • 6
  • 35
  • 39
2
votes
0 answers

How do I successfully import ScriptingBridge in xCode 6?

I am making an basic app to control Spotify on OS X Mavericks using Xcode 6 and hopefully Scripting Bridge. I am using scripting bridge to interact with Spotify. I have linked the scripting bridge library in Xcode via Project > General > Linked…
atca
  • 21
  • 1
2
votes
2 answers

Objective-C Scripting Bridge and Apple Remote Desktop

Trying to automatically view a computer in Apple Remote Desktop via Scripting Bridge in Objective-C with this: @try { SBApplication *RD = [SBApplication applicationWithBundleIdentifier:@"com.apple.RemoteDesktop"]; // (code to…
TheTesla
  • 23
  • 4
2
votes
3 answers

Programmatically enter text into any application

Is there a proof-of-concept Objective-C executable that enters some text into an application and then clicks the mouse, using Apple events and not AppleScript? e.g. the AppleScript equivalent of tell application "System Events" tell process…
2
votes
3 answers

How to close all, or only some, tabs in Safari using AppleScript?

I have made a very simple AppleScript to close tabs in Safari. The problem is, it works, but not completely. Only a couple of tabs are closed. Here's the code: tell application "Safari" repeat with aWindow in windows repeat with aTab in…
Form
  • 1,949
  • 3
  • 25
  • 40
2
votes
1 answer

iTunesTrack location is nil in sandbox mode?

I am sandboxing an osx app that uses scripting bridge to access iTunes. for(iTunesFileTrack* track in fileTracks) { //url is nill in sandbox mode but good value in non sandbox mode NSURL* url = [track…
Ahmed
  • 14,503
  • 22
  • 92
  • 150
2
votes
0 answers

ScriptingBridge for System Events in OSX 10.9.2 (XCode 5.1)

I'm trying to use System Events.app via the ScriptingBridge to 'click at' menu (bar) items of running apps in OSX 10.9.2. Since OSX 10.9 I have a problem creating the header file as it has been described in the apple mailing lists…
Simon
  • 577
  • 3
  • 9
2
votes
1 answer

Using scripting Bridge with iTunes

I am new to Objective-C. I am now trying to get song information of selected track. But I can't. I've found that following code iTunesFileTrack *cuTrack = [iTunesApp.currentTrack get]; NSLog(@"result = %@",cuTrack); outputs reference(?) of…
xanadu6291
  • 931
  • 10
  • 20
2
votes
1 answer

Creating playlists in iTunes using Scripting Bridge in a Sandboxed app

Is this possible? In this question I saw that you add to the entitlements file: com.apple.security.scripting-targets com.apple.iTunes com.apple.iTunes.library.read
abroekhof
  • 796
  • 1
  • 7
  • 20
2
votes
1 answer

Issue with the new iTunes 11.0.3 and ScriptingBridge (specifically the 'playerPosition')

Two or three days ago Apple introduced a new updated for iTunes: a new miniplayer, a new player time bar, etc... And I thought: "sweet!". But I found a new issue with it, and here's my problem: A long time ago, I created the iTunes.h file by typing…
Pedro Vieira
  • 3,330
  • 3
  • 41
  • 76
2
votes
3 answers

OS X: Move window from Python

I'm trying to move around windows programatically from Python on OS X. I found a snippet of AppleScript here on Stackoverflow which does this, but I'd like to do it in Python or another "real" scripting language. This is my Python script, which does…
Mira Weller
  • 2,406
  • 22
  • 27