I have made a very simple AppleScript to close tabs in Safari. The problem is, it works, but not completely. Only a couple of tabs are closed. Here's the code:
tell application "Safari"
repeat with aWindow in windows
repeat with aTab in tabs of aWindow
if [some condition is encountered] then
aTab ...
I'm having a problem with the Scripting Bridge framework in 10.5. Specifically, I use this code to create a new user playlist in iTunes:
NSDictionary *propertiesDict = [NSDictionary dictionaryWithObject:@"playlistName" forKey:@"name"];
playlistToReturn = (iTunesUserPlaylist*)[[[iTunesApp classForScriptingClass:@"user playlist"] alloc] ...
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 can see the window id 3263 and tab number 1 (although I don't know how to query myTab to...
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 Scripting Bridge. I've tried this:
iPhotoApplication *iPhoto = [SBApplication applicationWithB...
Hi,
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 would use NSAppleScript for it but I'm targeting 10.5 or later and read that Scripting ...
So, the application I'm trying to script has a scripting definition file that includes a <contents> element, which is an "implicitly specified container."
The question, how do I get at what's inside this element using Scripting Bridge? Or alternatively, how do I send the Apple Event necessary to retrieve it and then transform what I ge...
I'm trying to create a new tab in a Safari window from Cocoa using Scripting Bridge. My code looks something like this:
SafariApplication *safari = [SBApplication applicationWithBundleIdentifier:@"com.apple.Safari"];
if ([[safari windows] count] == 0)
{
NSLog(@"No window found. Creating a new one.");
...
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 is the code I'm using to try to simply create a Numbers document and save it.
NSString *...
Hello,
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 applicationWithBundleIdentifier:@"com.apple.Mail"];
/* create a new outgoing message object ...
Is there a way to do a remote copy within a container from Scripting Bridge? In AppleScript, this looks like "copy [element] of [container] to [location in container]". For example, in the context of a tell to a TextEdit document, you can "copy first paragraph of its text to end of its text" to copy the first paragraph to the end of th...
Hi,
I need to fetch cached cover art from iTunes. Currently I'm working with the scripting bridge, but it only fetches covers that are embedded in the tracks. I've also tried this method here
http://stackoverflow.com/questions/1433035/fetch-itunes-album-artwork-without-itunes-running
but it seems to be broken (at least in iTunes 9.2)...
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 = SBApplication.applicationWithBundleIdentifier_("com.apple.QuickTimePlayerX")
while true
ap...
I am writing a mac application that uses the scripting bridge to control iTunes. I have generated the header file iTunes.h, and the SBApplication object can tell me all kinds of wonderful things.
However, the commands seem very limited. There is a 'playpause' function, but I see no way to do this
// iTunes is my SBApplication Object
[i...
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 not, what's an alternative?
...
I was trying to replicate "take a screenshot shortcut" (cmd+shift+3) via cocoa and scripting bridge
SystemEventsApplication * sysEvent = [SBApplication applicationWithBundleIdentifier:@"com.apple.systemevents"];
[sysEvent keyCode:20 using:SystemEventsEMdsCommandDown];
but i can't send more than one SystemEventsEMds to the method.
In a...