Archive for the ‘AppleScript’ Category

October 23 '13 - 12:00 pm
But There’s Good AppleScript News, Too

While losing iWorks AppleScript support is anxiety-inducing, some great new features have been added to AppleScript in Mavericks that are pretty exciting. I’ve played a little with libraries and Notifications in the DPs, but haven’t incorporated anything into my scripts since most a few of these features are not backwards-compatible on earlier operating systems.

Don Southard has a good article at MacStories outlining the latest stuff.

October 23 '13 - 7:19 am
AppleScript Support Killed In Latest iWorks

Apple has effectively killed AppleScript support in its latest versions of the iWorks apps. Probably not a surprise but a shock just the same. It’s not a surprise because AppleScript support in Pages.app et al has never been very glamorous. But I don’t have any doubts that the main consideration is the big part the iWorks apps play in Apple’s iCloud/iCloud.com stategy and the security ramifications thereof. Anything that touches iCloud is pretty much hands-off to AppleScript.

Still, it’s hard to sit helpless and watch AppleScript’s maddeningly sad and frustrating march to irrelevance as iOS usage inevitably overtakes OS X.

Inter-app automation on iOS. Now that would cheer me up. There’s hope, right?

October 22 '13 - 3:35 pm
OS X 10.9: AppleScripts and Accessibility Control

With OS X 10.9 Apple takes security more seriously than it ever has. In this regard, Apple has added an additional level of security for apps that access the Accessibility API via “System Events”. Here’s how that new level of security may affect the way you use some AppleScripts downloaded from this site.

First of all: Some of my script applets (the ones with user interfaces) cannot run effectively while iTunes is in full screen mode. This is because only one of them, iTunes or the script, can be frontmost. So, when these scripts are launched they will detect and alert you if iTunes is in full screen mode.

To do this the script targets “System Events” to check for an accessibility property of the iTunes user interface indicating whether or not full screen is on. “System Events” is in the purview of Accessibility. If you’ve ever used GUI Scripting—to script key codes for example—you’ve had to set “Enable access for assistive devices” in the Accessibility pane of System Preferences. Well, as of OS X 10.9, this is no longer a global setting and must be set on a per-app basis.

(more…)

December 2 '12 - 8:59 pm
Show Track Count and Time of Selected Playlist

There’s seems to be a bit of inconsistency with the way iTunes 11 displays playlist time information as DD:HH:MM:SS. Sometimes times are displayed in the Status Bar at the bottom and sometimes a decimal version will be displayed beneath the playlist’s name at the top of the browser. I can’t quite get a grasp on something like “7.6 days” though.

Here’s a script you can attach a shortcut to that will simply display a dialog box listing the name of the selected playlist, the number of tracks it contains, and the time of the playlist as DD:HH:MM:SS:

tell application "iTunes"

set thePlaylist to (get view of front browser window)

display dialog (get name of thePlaylist) & return & return & ¬

(get index of last track) & " tracks" & return & return & ¬

(get time of thePlaylist) buttons {"OK"} default button 1 giving up after 300

end tell

November 30 '12 - 10:49 am
Interesting play Issue with MiniPlayer

As I mentioned below, I had to fix a script to workaround a problem playing a playlist when only one track had as yet been copied to it, which prevented the rest of the subsequently added tracks from being recognized by MiniPlayer and Up Next; thus, only the first track would play. Similarly, if you were to play (the AppleScript command) any track in a playlist, the following tracks will not play because they haven’t been recognized by MiniPlayer and Up Next (”No upcoming songs”).

Doesn’t go good when Mini Player is empty:

tell application “iTunes”

set aTrack to item 1 of selection

play aTrack

end tell

You can play the playlist and everything’s OK. You just can’t initiate play of the entire playlist by playing one of its tracks with AppleScript.

Goes good and loads in MiniPlayer:

tell application “iTunes”

set aPlaylist to view of front window

play aPlaylist

end tell

Additionally, I found that if the MiniPlayer was already loaded up with tracks, playing a track (via AppleScript) from anywhere would play that track and then resume with whatever is next in MiniPlayer.

November 30 '12 - 10:26 am
iTunes 11 Loses playlist window

Technically, you can’t open a playlist in its own window in iTunes 11, so the playlist window element is moot.

November 29 '12 - 9:40 pm
iTunes 11 Loses Gapless Track Feature

You can no longer designate an album of tracks as gapless. Thus, a track’s gapless property is now moot.

ERRATA: My title for this post is misleading. The gapless feature has not been lost. But the ability to manually change a track’s gapless setting has been removed.

November 29 '12 - 2:37 pm
iTunes 11 Released

Apple has released iTunes 11. Apple originally previewed iTunes 11 at its September Special Event, announced a vague October release date, and then later postponed release to November.

This updated version features some iOS-inspired GUI changes, re-designed MiniPlayer, improved iCloud integration, improved search, and a revamped design of the iTunes Store.

August 21 '12 - 7:39 pm
Use TextExpander to Run iTunes AppleScripts

I was inspired by this recent article by Dr. Drang on using TextExpander to insert the URL of Safari’s front document wherever you’re entering text. There might be some benefits to being able to get current information in iTunes with a TextExpander AppleScript snippet or two. Or, as I describe below, three.

In case you don’t know, TextExpander is a typing shortcut tool for the Mac whereby you enter a little abbreviated text and a predefined batch of text is inserted where you’re typing. One of its amazing features is its ability to fire AppleScript snippets the same way. TextExpander can’t accommodate hulking huge AppleScripts but it does allow for some pretty flexible ’scripting.

Before I get to the AppleScript part, here’s how to set up TextExpander:
(more…)

August 8 '12 - 7:47 pm
AppleScript Save Changes in Mountain Lion

I’ve been meaning to post this for the record. Shane Stanley has written up How Mountain Lion Changes the Rules for AppleScript at TidBITS. He explains how scripts and AppleScript applications can be saved in an uncompiled state. If you distribute or system manage AppleScripts and develop on Mountain Lion you really should be aware of these changes.

Site contents © 2001 - 2014 Doug Adams and weblished by Doug Adams, dougscripts AT mac DOT com. About.
All rights reserved. Legal.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc.