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

ScriptingBridge code errors in Xcode 8.0 and swift 3.0

This is the code I used in Xcode 7.3.1 and that worked fine: var selectedFiles = NSMutableArray(capacity:1) let finder: AnyObject! = SBApplication(bundleIdentifier:"com.apple.finder") let finderObject = finder.selection as! SBObject …
Kader Mokhefi
  • 341
  • 4
  • 15
1
vote
1 answer

AppleScript VLC Scripting Bridge

I am trying to use the Scripting Bridge to control VLC. However, I seem unable to access all methods. I generated the file using: sdef /Applications/VLC.app | sdp -fh --basename VLC I can access properties such as vlc.pathOfCurrentItem just fine.…
Coder-256
  • 5,212
  • 2
  • 23
  • 51
1
vote
3 answers

Working with a file by pathname/URI using Finder + ScriptingBridge

I'm using the generated Finder.h headers from the sdef utility, and it appears that a lot of Finder SB methods require objects of type FinderItem to do anything meaningful with. How would I go about creating one of them objects based on a path to…
dmkc
  • 1,161
  • 1
  • 15
  • 22
1
vote
1 answer

Using the Apple Scripting bridge with Mail to send an attachment causes the message background to go black

When I use the Apple Scripting Bridge to send a message with an attachment the background of the message is set to black which is a problem because the text is also black. The code in question is: MailApplication *mail = [SBApplication…
Naym
  • 11
  • 1
1
vote
0 answers

How compare performance of LuaJIT vs JavaScriptCore, for a bridge to Objective-C?

I’m writing a few unit tests for an Objective-C <-> LuaJIT bridge, the idea is to compare the performance of LuaJIT against JavaScriptCore and make the test fail when JS has better execution time than LuaJit at some specific tasks. What tasks? a…
1
vote
1 answer

Using ScriptingBridge framework for communicating with Entourage

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…
subramanian
  • 1,005
  • 2
  • 11
  • 21
1
vote
1 answer

Swift iTunes ScriptingBridge linker error

I have searched extensively for an answer to this, but have found none, so I'm asking here. I am trying to read the current track in iTunes using Swift, but whenever I try to reference any of the iTunes classes (iTunesApplication, iTunesTrack, etc)…
thislooksfun
  • 1,049
  • 10
  • 23
1
vote
1 answer

SBApplication (in this case SafariApplication) leads to SIGKILL (Objective-C)

I have a global SafariApplication variable (from a Scripting Bridge generated Safari header) that I set to, of course, the Safari Application: self.safari = [SBApplication applicationWithBundleIdentifier:@"com.apple.Safari"]; Then I check the URL…
erikvdplas
  • 551
  • 5
  • 10
1
vote
2 answers

Creating iPhoto albums using Cocoa Scripting Bridge

I'm tearing my hair out trying to create a new album from a Cocoa Application. In applescript it's a nice simple procedure: tell application "iPhoto" new album name "Album" end tell But I can't work out how this is done in Cocoa via the…
user269597
1
vote
1 answer

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

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…
Gavin Brock
  • 5,027
  • 1
  • 30
  • 33
1
vote
1 answer

Generate header files for an app having space in their app name

I am looking to generate a header file for "App Store" app. Referring Apple's documentation on Scripting Bridge, I was able to generate the header file for iTunes and Safari apps: sdef /Applications/iTunes.app | sdp -fh --basename iTunes sdef…
tech_human
  • 6,592
  • 16
  • 65
  • 107
1
vote
1 answer

ScriptingBridge iTunesTrack VS. iTunesFileTrack - Sandbox Error

I have an AppleScript-ObjC app, which is sandboxed, and am running into an issue with trying to get or set properties of an iTunes track. Oddly, I can successfully run the get/set methods when working with an iTunesTrack object, but cannot when…
1
vote
2 answers

Objc scriptingbridge how open new Finder window in a specific folder

I want to open a new Finder window of a specific size in a specific position and displaying a specific folder. In ScriptingBridge (XCode 6, Mavericks 9.4) I can open a new Finder window and have figured out how to read the URL of the folder it…
BickaSoft
  • 11
  • 3
1
vote
1 answer

How to enable "Private Browsing" in Safari (Mac) and open a new link? Scripting Bridge

I'm currently trying to enable "Private Browsing" in Safari for Mac, through Scripting Bridge but without any success. The following code shows how to do the same thing, but for Google Chrome (creating a new window with incognito mode enabled and…
Pedro Vieira
  • 3,330
  • 3
  • 41
  • 76
1
vote
1 answer

Sandboxing breaks NSPredicate with SBElementArray

I am trying to filter out an array of tracks from iTunes using Scripting Bridge in a Sandboxed app. The following works when the app is not Sandboxed, but not when it is: if(!self.iTunes){ self.iTunes = [SBApplication…
abroekhof
  • 796
  • 1
  • 7
  • 20