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

Porting Applescript to Scripting Bridge: can't get value of range in Excel 2008

I have a need to move some Applescript code to Scripting Bridge to take advantage of some Cocoa hooks without the need for Applescript-ObjC. Using Excel 2008 with Applescript, getting the value of a range is easy: set myList to…
Philip Regan
  • 5,005
  • 2
  • 25
  • 39
3
votes
1 answer

Scripting Bridge classes with Swift 3

I am trying to instantiate a SB class using Swift but it doesn't seem to work: if let messageClass = (mail as! SBApplication).class(forScriptingClass:"outgoing message") { let message = (messageClass as! SBObject.Type).init(properties:…
altares
  • 115
  • 8
3
votes
1 answer

AppleScripting sandboxed app from another sandboxed app using ScriptingBridge

I'm trying to script a sandboxed app (which I wrote) from another sandboxed app using ScriptingBridge. I have access groups set up in the target app's sdef, and entitlements configured in the scripting app's sandbox entitlements. However, when I try…
Andrew Madsen
  • 21,309
  • 5
  • 56
  • 97
3
votes
2 answers

Can you use KVO with Scripting Bridge

Can you use KVO with Scripting Bridge? I want to know if I can make an Scripting Bridge interface for my application and allow client applications to be notified by observing an object returned by one of my app's SB commands. Is this possible? If…
AshleyS
  • 2,191
  • 2
  • 20
  • 23
3
votes
1 answer

How to set a property of iTunes ScriptingBridge using Swift protocols

I want to set the rating of a track in Swift 2.3/3 using the iTunes ScriptingBridge framework. I have the Swift iTunes header with the protocol definition as this (full header here): @objc protocol iTunesTrack: iTunesItem { @objc optional var…
pvieito
  • 117
  • 2
  • 8
3
votes
1 answer

Callbacks with Scripting Bridge?

I'm using Ruby to check the position of videos I'm playing in Quicktime via Scripting Bridge. At the moment I'm just checking the position like so every n seconds: require 'osx/cocoa' include OSX OSX.require_framework 'ScriptingBridge' app =…
JP.
  • 5,507
  • 15
  • 59
  • 100
3
votes
1 answer

Apple script for Sketch App

I am trying to write an Apple Script for Sketch.app (com.bohemiancoding.sketch3). What i want to do is, create some image file that can be rendered in browser from Sketch document. And when i open Sketch.app dictionary in Script Editior i…
Mirza Bilal
  • 891
  • 11
  • 34
3
votes
0 answers

OSX Scripting Bridge Options for Photoshop

I am trying to save image from Adobe Photoshop as PNG, I have achieved this with the following code. AdobePhotoshopApplication* psApp = [SBApplication applicationWithBundleIdentifier:@"com.adobe.Photoshop"]; AdobePhotoshopDocument *curDoc = [psApp…
Mirza Bilal
  • 891
  • 11
  • 34
3
votes
2 answers

How do I create a Numbers spreadsheet using objective-c?

I'm writing a Cocoa application and I'd like to generate a Numbers spreadsheet from my application using Scripting Bridge. I've generated the Numbers.h file and linked the ScriptingBridge.framework per the directions in Apple's Documentation. Below…
Austin
  • 4,638
  • 7
  • 41
  • 60
3
votes
1 answer

Alternative ways to use objc_msgSend without a cast with the new runtime

I am writing an objc bridge and I found a very efficient way to call objc methods using objc_msgSend. Basically the code was able to produce a macro that pass to objc_msgSend the right number of parameters from a NSArray (metamacros.h…
Marco
  • 783
  • 5
  • 21
3
votes
2 answers

Swift: Undefined Symbols: iTunesApplication

I'm trying to create Swift OS X app now, and found difficulty using ScriptingBridge. I included proper iTunes.h file, and Xcode is not giving any error when I wrote "iTunesApplication" as type. However, when I compile(run) the app, it gives me error…
3
votes
2 answers

How to dynamically typecast objects to support different versions of an application's ScriptingBridge header files?

Currently I'm trying to implement support for multiple versions of iTunes via ScriptingBridge. For example the method signature of the property playerPosition changed from (10.7) @property NSInteger playerPosition; // the player’s position within…
HobbinHood
  • 37
  • 4
3
votes
3 answers

OBJ-C Scripting Bridge - Trouble creating scripting object with properties (Microsoft Word)

I've been banging my head against the wall with this one. I'm trying to create a new autotext entry in MS Word using scripting bridge. Here is the code I am trying to use: wordApplication *theWordApp = [SBApplication…
3
votes
1 answer

How to import an mp3 song into iTunes using Objective-C?

I am building a Mac OS Application which needs to import an mp3 file into iTunes... Can't seem to find any framework that would help me achieve this. The only way I can think of doing this is modifying the "iTunes Music Library.xml". I'm hoping one…
MiMo
  • 4,905
  • 3
  • 22
  • 23
3
votes
1 answer

Is it possible to use Scripting Bridge to open an app, but move it to the background?

I'm trying to open the app Spotify, and move it to the background. I can easily open Spotify with SpotifyApplication *Spotify = [SBApplication applicationWithBundleIdentifier:@"com.spotify.client"]; [Spotify activate]; But Spotify goes to the…
epetousis
  • 455
  • 1
  • 4
  • 21
1 2
3
12 13