applescript

iTunes Scripting Bridge reveal does not work

The following code should show a certain track in iTunes: NSString* iTunesPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.apple.iTunes"]; iTunesApplication *iTunes = nil; if ( iTunesPath ) { iTunes = [[SBApplication alloc] initWithURL:[NSURL fileURLWithPath:iTunesPath]]; [iTunes setDelegate:self]; }...

Getting Safari document title/location with Scripting Bridge does not work in full-screen mode

I'm trying to get the URL and document title from the topmost Safari document/tab. I have an AppleScript and an objective-c version using Apple's Scripting Bridge framework. Both versions work fine for most web pages, however when I open a Youtube video in full-screen mode, the Scripting Bridge based version fails. The Apple Script work...

Tagging files with colors in OS X Finder from shell scripts

One can tag files and folders with a color in the Mac OS X Finder. Is there a way to do this from a shell script? ...

View plain text files with different background colors in Mac OSX, for different programming languages

Hi, I work with Mac OS X Leopard. I usually have 5 or 10 text files opened at the same time with different programming languages; one for a bash script, another for a python one, etc. When I use exposé all of them look the same, so it is difficult to select them. I wonder how could I work with just plain text files in OSX, so when the...

Make new chat in Adium using Cocoa ScriptingBridge

The following AppleScript code works fine: tell application "Adium" to tell first account to make new chat with contacts {first contact} with new chat window But how can I do the same using Cocoa's ScriptingBridge? ...

Applescript file dialog with UI scripting

I am trying to open a file in a not so scriptable area of an application. I got halfway there by using UI scripting to select the proper menu item, but this opens a standard file dialog. How can I set the destination of the file dialog with Applescript? ...

Listening to mac keyboard play/pause events

Some mac apps, like iTunes and Spotify, react to the play/pause/next/previous buttons on some Apple keyboards. Presumably they're tapping into some sort of NSNotification, how can I do the same? ...

How do i add applescript support to my Cocoa app

i am new to the world of cocoa programming, i want to add applescript support to my app. Also the example at apple's website seems out of date ...

Get the URL of the frontmost tab from Chrome on OS X?

Is there a way to do this to Chrome? tell application "Google Chrome" return URL of front document as string end tell ... doesn't work. ...

What's the easiest way to make a simple app that sits in the Mac OSX menu bar?

I'm trying to make a simple app that sits on the Mac OSX menu bar and alerts users of updates on our website. I've been trying to search for documents on how to do this, but no luck so far. Can anyone point me in the right direction? Thanks! ...

How to close all, or only some, tabs in Safari using AppleScript?

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 ...

Is it possible to load a new Applescript scripting addition whilst my script is running?

According to various documents and discussions this used to be possible: you needed a block something like this in your script: try tell me to «event ascrgdut» end try tell me to doTheFunkyNewThing The event corresponds to hidden event with the undocumented C constant kUpdateAEUT (see here for the declaration of the constant) whi...

How to create new project in XCode using AppleScript??

Hi all, I want to do a simple task with XCode and AppleScript: I want to create a new project Save created project with desired name in desired folder. Can someone tell me how can I achieve it using AppleScript?? Thanks, Miraaj ...

Start applescript when itunes starts

Any way to bind an applescript to iTunes so that when iTunes is started the applescript is run? I have a script that runs continuously monitoring iTunes but it seems a waste to have it running even if iTunes is not running. Thanks ...

run applescript on 2x-click

OK, this feels like an idiot question, but I'm stuck - I don't know the first thing about AppleScript. I have a .scpt file and I want to double-click it and just have it run, but instead every time I click, it opens up the AppleScript Editor. This feels like it should just be an option on the file, but I'm missing something obvious. Ple...

Getting RTF data out of Mac OS X pasteboard (clipboard)

According to the man page for pbpaste, -Prefer {txt | rtf | ps} tells pbpaste what type of data to look for in the pasteboard first. As stated above, pbpaste normally looks first for plain text data; however, by specifying -Prefer ps you can tell pbpaste to look first for Encapsula...

Indesign scripting - Save Copy

Hello, I'm using a Objective-C Scripting Bridge to communicate with InDesign CS3/CS4. Unfortunately I'm stuck on Save command which appears to be existing only as a part of the standard suite and not defined again in InDesign. Because of that it looks like I can Save, Save as but not Save Copy a document. Does anyone have any idea how to...

What can you do with AppleScript?

Everything I know about AppleScript I taught myself and was wondering if I missed any cool features. I know you can make the computer talk to and control applications but is there anything else it can do or is it time to move on to a new language? ...

unable to copy release folder to desktop using AppleScript

Hi all, I tried this script to copy release folder of one of my Xcode projects to desktop: tell application "Finder" set targetFolder to folder "release" of folder "build" of folder "8_15pm" of folder "26th_March" of folder "XYZ" of startup disk set destinationFolder to folder "Desktop" of folder "miraaj" of folder "Users" of s...

How to look up a word in the Mac OS X dictionary with AppleScript?

How can I look up a word in the Mac OS X dictionary through AppleScript? ...