scripting-bridge

Is it possible to reduce the startup time of MacRuby scripts which use the ScriptingBridge?

痞子三分冷 提交于 2019-12-23 04:19:35
问题 I would like to use MacRuby with ScriptingBridge instead of AppleScript to control Mac applications which support AppleScript. I used to do this using appscript, which is effectively deprecated, hence the move the MacRuby and scripting bridge. The only problem I have is that the ScriptingBridge framework takes about a second to load, even on a fast machine with a fast SSD. For example, this simple script takes about 0.9 seconds to run, with almost of the time spend loading the ScriptingBridge

Creating playlists in iTunes using Scripting Bridge in a Sandboxed app

柔情痞子 提交于 2019-12-22 01:15:06
问题 Is this possible? In this question I saw that you add to the entitlements file: <key>com.apple.security.scripting-targets</key> <dict> <key>com.apple.iTunes</key> <array> <string>com.apple.iTunes.library.read</string> <string>com.apple.iTunes.playback</string> </array> </dict> for read access. But how do you get write access? I looked in the documentation and they suggest the manual for sdef , but I couldn't extract any information from this. Also, would this hamper a submission to the App

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

こ雲淡風輕ζ 提交于 2019-12-21 20:49:48
问题 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 of you can point me to a better and cleaner solution. Thank you in advance. 回答1: Ok, so after some research on Scripting Bridge, just like Andrew Madsen suggested. Here is the answer to my own question. This has been implemented and tested... Add

Swift iTunes ScriptingBridge linker error

耗尽温柔 提交于 2019-12-13 02:34:34
问题 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) I get the following error: Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_iTunesApplication", referenced from: __TFC8WAILT_v213iTunesWrapper17getSongWithFormatfS0_FTSS3sepSS10timeOnLeftSb_SS in iTunesWrapper.o __TMaCSo17iTunesApplication

Scripting Bridge adds unwanted HTML code when adding recipient to mail

戏子无情 提交于 2019-12-12 00:29:46
问题 Ok, so this one is a bit strange.... I have an HTML page in Safari which I want to send as an email. If I go the FILE menu and select "Mail Contents of this Page", it transfers as expected and looks correct. However, if I use Scripting Bridge add recipients to the outgoing message, it adds the following code to the top of the message content area for EACH recipient added. In one example, with 24 recipients added, the resulting email contains 24 sequential repeats of the following code: <div

Objective-C Scripting Bridge and Apple Remote Desktop

落花浮王杯 提交于 2019-12-11 08:43:11
问题 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 check for ARD running and installed omitted here) [RD activate]; // works just fine RemoteDesktopComputer *computer = [[[RD classForScriptingClass:@"computer"] alloc] initWithProperties: [NSDictionary dictionaryWithObjectsAndKeys: ipAddress,@"InternetAddress", // looked

iTunes song queue

被刻印的时光 ゝ 提交于 2019-12-11 04:37:11
问题 My app is controlling iTunes via scripting bridge. Other apps are able to choose a range of songs, and play them in order without having to create a playlist. I have searched the web for examples and red the iTunes.h file a dozen times, but I didn't find a solution. Can maybe someone of you help me? Look at the iTunes header file here: iTunes.h Thanks! 回答1: With iTunes 10 it's simply not possible without creating a playlist. The function(which is a known from great other music players) you

get a specific track in itunes via ScriptingBridge [closed]

空扰寡人 提交于 2019-12-11 02:46:52
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I'm updating my OS X program to accept iTunes drops, modify the metadata in the file, then refresh (Get Info) the dropped file(s) so iTunes can update its' metadata library. I've got the drops working, which provide a dictionary of some misc info about the file including track ID,

Send HTML Mail from Cocoa with Mail.app

瘦欲@ 提交于 2019-12-10 13:05:39
问题 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, but MailOutgoingMessage class doesn't have content type i can add content in plaintext. tried AppleScript, something like this: set htmlContent to read "/Path/index.html" set recipientList to {"mail@mail.com"} tell application "Mail" set newMessage

create iTunes playlist with scripting bridge

青春壹個敷衍的年華 提交于 2019-12-10 02:36:40
问题 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 applicationWithBundleIdentifier:@"com.apple.iTunes"]; SBElementArray *iSources = [iTunes sources]; iTunesSource *library = nil; for (iTunesSource *source in iSources) { if ([[source name] isEqualToString:@"Library"]) { library = source; break; } } // could not find the itunes library if (!library) { NSLog(@"Could not connect