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

Rewriting MacTypes::FileURL from appscript-ruby to MacRuby ScriptingBridge

I have a script that automatically attaches a given PDF to a publication in BibDesk. Using appscript-rb, the following snippet works perfectly: BibDesk = Appscript.app('BibDesk') selection = BibDesk.document.selection.get[0] f =…
Stian Håklev
  • 1,240
  • 2
  • 14
  • 26
0
votes
1 answer

Script Bridge and iPhoto - lat/lon info is NSInteger only?

I am trying to access the GPS info in iPhoto images using Script Bridge in Obj-C (XCode 4.1, SDK 10.7). Here is a code snippet: iPhotoApplication *iPhoto = [SBApplication applicationWithBundleIdentifier:@"com.apple.iPhoto"]; NSArray *selection =…
0
votes
1 answer

How do I retrieve an iTunes Track via ScriptingBridge?

I have two situations. Given a track id of a song, set the rating to some integer. The second is the same except I am given an array of track ids. I know I can use the ScriptingBridge to search for the iTunesTrack object based on a song's name, but…
jp.rider63
  • 574
  • 3
  • 20
0
votes
2 answers

Finder Scripting Bridge to Shutdown

I tried to use Application Scripting Bridge to send my Mac to sleep. The code look like the following: #import "Finder.h" FinderApplication *Finder = [SBApplication applicationWithBundleIdentifier:@"com.apple.finder"]; [Finder sleep]; But…
Chris
  • 117
  • 1
  • 5
0
votes
1 answer

SBApplication no communication

I`m trying to control the Spotify using my custom switch app. Creation works OK but each communicaction ends with nil or undefined value. For example this snipped prints "??": func applicationDidFinishLaunching(_ aNotification: Notification) { …
mikeek
  • 132
  • 11
0
votes
2 answers

Cocoa/Finder: weird path

im asking the finder for the current finder window location/path/whatever with NSString *path = [[finder insertionLocation] get]; which results in a path like that: 2011-06-03 18:38:55.132 CutIt[1980:903]
Eike Cochu
  • 3,249
  • 7
  • 34
  • 57
0
votes
1 answer

Using Cocoa Scripting Bridge to send email without knowing the recipient beforehand

I am using the code from default Apple provided SBSendEmail example to send an email. The only difference in my case is that I don't know the recipient beforehand and I expect the user to enter the recipient in the To field of mail window. Here is…
AmaltasCoder
  • 1,123
  • 3
  • 17
  • 35
0
votes
1 answer

Use Scripting Bridge to create an album in iPhoto and import a picture into this album

I have a document based drawing application that allows the user to save the final document as a JPEG file. Whenever the user saves a JPEG, I would like to import the picture to an iPhoto album "MyAppName album". I am using Using Scripting Bridge…
AmaltasCoder
  • 1,123
  • 3
  • 17
  • 35
0
votes
1 answer

How do I get just the audio files from the iTunes main library (returned by Scripting Bridge)?

I have quite a simple problem. I want to put the audiofiles into my table view. How do I distinguish them from pdfs and movies, etc? I get them from iTunes over Scripting Bridge: iTunesSource *source = [[[self iTunes] sources] objectAtIndex:0]; …
david
  • 3,553
  • 4
  • 28
  • 39
0
votes
1 answer

Having issues getting started with a ScriptingBridge Application Cocoa/Objective-C

I'm trying to use Scripting Bridge in my Mac OS app and am having difficulty implementing it. I've included the framework, and am intending to use it with Finder, so I've included a Finder.h file in my application as well. I.E #import…
minimalpop
  • 6,997
  • 13
  • 68
  • 80
0
votes
1 answer

Objective-C Scripting Bridge and iTunes

Hi i need a little help i want to include 2 buttons on my Mac App which will trigger 2 actions, 1 will trigger the iTunes shuffle feature and set it to YES but if it is all ready set to YES then it will set it to NO. The other will get iTunes…
Sami
  • 1,374
  • 1
  • 16
  • 43
0
votes
1 answer

Expressing a range (or slice) with ScriptingBridge

I'm trying to express a slice ("thru in AppleScript") in Objective-C using Scripting Bridge. The example code is making a selection in iWorks Pages. The AppleScript code looks like this tell application "Pages" tell document 1 select…
0
votes
1 answer

Objective-C, constantly run method whilst Mac OS X application is running

i'm currently writing an application in Objective-C which displays the artist name of the song currently being played in iTunes, however i want the artist name to update when the song changes. This is the method i have so far which gets the artist…
Sami
  • 1,374
  • 1
  • 16
  • 43
0
votes
1 answer

How to get the Artwork of the current track in iTunes using Swift/ScriptingBridge?

I'm currently trying my hardest but can't get anywhere. I can get the current track using iTunes.currentTrack but the .artworks() SBElementArray doesn't really get me anywhere since I don't know what to do with it. There is also @objc public…
Ghosty141
  • 21
  • 7
0
votes
1 answer

NSAppleEventDescriptor returned from Scripting bridge unwrapping problems

I am working on OSX, Xcode 8.2. Objective-C. I use scripting bridge to adress Adobe InDesign. I have a pretty long AppleScript i want to translate to Objective-C with Scripting-Bridge to take advantage of its background-task possibilities. For…