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
36
votes
3 answers

Cocoa bindings for the Go language

Is it possible to write macOS/Cocoa applications in Google Go? Is there a Go-Obj-C bridge? (it seems to me that Obj-C dynamism would be a great fit for Golang's interfaces) Can I at least link the two together and make them talk to each other via…
Kornel
  • 97,764
  • 37
  • 219
  • 309
18
votes
4 answers

Python printing attributes with no __dict__

I am having trouble with scripting bridge for python I am trying to list the attributes of the iTunes object iTunes = SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes") using >>> from pprint import pprint >>> from Foundation import…
Ashley Hughes
  • 571
  • 1
  • 6
  • 18
15
votes
4 answers

What is the type of an enum whose values appear to be strings?

I am working with Apple's ScriptingBridge framework, and have generated a header file for iTunes that contains several enums like this: typedef enum { iTunesESrcLibrary = 'kLib', iTunesESrcIPod = 'kPod', iTunesESrcAudioCD = 'kACD', …
Evan DiBiase
  • 1,104
  • 9
  • 16
9
votes
5 answers

create iTunes playlist with scripting bridge

I am trying to create a new user playlist using the cocoa scripting bridge, but cannot seem to get it to work. I have so far: iTunesApplication *iTunes = [SBApplication …
user239499
8
votes
4 answers

Send HTML Mail from Cocoa with Mail.app

I'm trying to send html email from Cocoa app, through Mail.app. I want to open new message in Mail.app, include subject, recipient and add HTML Body with links and other content. But can't find the way to do this. I already tried Scripting Bridge,…
rozochkin
  • 679
  • 1
  • 7
  • 18
7
votes
2 answers

Get iTunes Artwork for Current Song with ScriptingBridge

I have been trying to figure out how to get the iTunes artwork for the currently playing song with scripting bridge. I have gotten to a point where it works for some songs, but for others, I get a SIGABRT. I'm not sure what the issue could be, so…
alwaysapple
  • 191
  • 1
  • 6
7
votes
3 answers

Add movie to iTunes using Scripting Bridge

I want to use Scripting Bridge to add a movie to iTunes. And preferably letting me choose between a 'music video' and a 'movie'. I know both Objective-C and AppleScript so I thought it wouldn't be that hard but I can't figure it out. I know how I…
Jeroen
  • 71
  • 2
7
votes
1 answer

Objective-C: get menu information from external application

I'm trying to write a Mac OS menu extra application that displays a contextual menu containing the currently active application's menu bar items, when the user presses some hotkey. The displaying of the contextual menu I can do fine, but I can't…
alaroldai
  • 336
  • 2
  • 11
6
votes
3 answers

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

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

Scripting Bridge vs PyObjC vs py2app

I am just starting to learn about integrating Python and Mac OS apps. (I want to call some methods from Cocoa to Python.) I've ran into these terminologies -- Scripting Bridge, PyObjC, and py2app. What's the difference? Is PyObjC an example of a…
janeh
  • 3,734
  • 7
  • 26
  • 43
5
votes
2 answers

Objective-C Mac OS X Distributed notifications iTunes

i need a little help, i currently have a method; updateTrackInfo in my Mac OS X application which gets the artist name, the track name and duration of the track currently being played in iTunes However i want the app to listen for the distributed…
Sami
  • 1,374
  • 1
  • 16
  • 43
5
votes
2 answers

Swift and ScriptingBridge.framework

In my Swift project I need to communicate with iTunes via ScriptingBridge framework. According to Apple documentation I create iTunes.h file with sdef /Applications/iTunes.app | sdp -fh --basename iTunes, then link ScriptingBridge.framework to…
Akki
  • 1,487
  • 14
  • 25
5
votes
1 answer

How to add a track to an iTunes playlist using Python and Scripting Bridge

I learned how to create a playlist in a previous question, but now I can't figure out how to add tracks to it. Right now I have: tracks.sort(key=lambda tup: tup[0]) i = 0 for trackList in generatePlaylists(tracks,10): i += 1 playlistname =…
abroekhof
  • 796
  • 1
  • 7
  • 20
4
votes
1 answer

ScriptingBridge - How Does It Work "Behind the Scenes"

Context: I'm working on a Pharo/Smalltalk -> Objective-C bridge Scenario: In the following Objective-C ScriptingBridge snippet: iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"]; iTunesTrack…
4
votes
2 answers

Reading currently playing track in macOS using ScriptingBridge not working

I am trying to read the currently playing track of iTunes using ScriptingBridge. I found a couple of other threads here but no one seems to be working for me (macOS Mojave and iTunes 12.9.4). I have created the iTunes.h file using the following…
inexcitus
  • 2,471
  • 2
  • 26
  • 41
1
2 3
12 13