Applescripts in Yosemite no longer Working

Hi All,

I have a program that uses Applescript to control the Image Capture App that has been running for years. Recently we upgraded all our Macs to Yosemite and now these Applescripts no longer work. They work fine from my Applescript Editor but not inside Xojo. I think this is some security issue, can anyone help me resolve this issue?

Here is one of the Applescripts:

set Status to “OK”
tell application “Image Capture” to activate
tell application “System Events”
tell process “Image Capture”
if exists (static text “Steve’s Camera” of UI element 1 of row 2 of outline 1 of scroll area 1 of group 1 of splitter group 1 of window “Image Capture”) then
tell window “Image Capture”
set size to {1000, 400}
set position to {1400, 20}
end tell
set Status to “No Camera Found”
end if
end tell
return Status
end tell

Thanks, Steve

from what system version did you come to yosemite ?

Mac OS 8.5

System Preferences/Security & Privacy/

On the ‘Privacy’ tab highlight “Accessibility”

You’ll see a list of all application you authorize Yosemite to allow to control your Mac - your application will be in that list after it attempts to control the Mac for the 1st time. Check the box next to your application.

I’ll assume you mean OS X 10.8.5 ?

yes 10.8.5. I think the accessibility is the key, I will just have to compile to debug any of the parts of the program that use scripts. as I cannot give the debugger privacy settings is my guess…

Thanks, Steve

It looks like you’re trying to control or download images from a digital camera? If so I would suggest that you start looking at the Image Capture API, probably needing a plugin like Christian’s MBS to do so.

Apple Script seems to be something that Apple are slowly phasing out; for your own security of course.

Apple seems to be on a “its slightly older so we’re phasing it out” bent with no suitable replacements for some things
AppleScript is a decently designed language (very OO in fact)
And its a great glue language for driving disparate apps in a work flow
But phasing the language out and keeping apple events would still be OK

Dropping Apple Events they’d better get on with something like COM etc or revive OpenDoc
There’s lots of work flows that require something like it

Judging by the way that iOS has nothing like it and the iOSification of OS X… It’s days are numbers.

From a developers POV, application intercommunication is on it’s way out. If you need your applications to communicate; there’s plenty of replacement technologies. If you want to communicate with OS functions, there’s a ton of API. It’s getting two apps from two different vendors who don’t know each other to communicate that’s becoming “a bag of pain”.

I don’t think so.
Probably the Applescript dialect will be phaseout but not the feature.
Yosemite has introduced the Javascript dialect (you can write the same automation in javascript) and ElCap has extended this feature with more debugging tools (Safari)

Sadly Xojo can’t use Applescript written in Javascript…

@Antonio Rinaldi : write a mail to Christian to request AppleScript with JaveScript. I think this would be a very good feature.

AFAIK osascript supports JavaScript, so it is possible to shell to it. Not as simple as dragging the script into the project, though.

This is exactly where apple script & scripting dictionaries are extremely useful

JS has been available one way or another for a very long time
Late Night released an OSA component in 2001

I was referring to this document:
where is written that JS can be used as global, supported and appleEvents compatible language for the script editor.

Anyway I can’t use it directly in a Xojo app as I can use an old Applescript.

Javascript has been possible since 2001 when released their OSA plugin
OSA is nicely designed and other languages can be used (there were others besides AppleScript & Javascript -
Or here - even documented in 2005

I have no idea IF apple used or based their Javascript implementation on Marks or not but its possible

Given HOW applescript works I’m sort of surprised that you cant use it
I’d file a report with a small sample script

I have a feeling that NSServices are the replacement… a bit more investigation is required to confirm this hunch; but the work I did this morning strengthens my suspicions.

Very possibly
No idea how they plan to make that be exposed to end users via something akin to Apple Script etc
A tool like Quark would be really hampered without it as there are a lot of glue applications driving Quark work flows in the print / publishing businesses
Thats really where Applescript (or whatever other OSA language) excels
Its a great “glue” language

I guess JXA is the ‘next’ Applescript because it seems Apple is actively improving and updating things.
I can hardly find any documentation or examples though.

Here is a (rather long winded) article with examples: Getting Started with JavaScript for Automation on Yosemite - MacStories

Not sure how difficult it would be but I think JXA -support would be a great addition.

The actual language you use (apple script vs java script) SHOULD be immaterial since they are all OSA languages

It used to be you could write a script in AppleScript then switch it to java script since its all just apple events and their various selectors & codes under the hood

Thats why I previously suggested someone write a bug report with a sample script