Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Why Does AppleScript Fail With Google Earth?

This simple script:


tell application "Google Earth"

GetCurrentVersion

end tell


fails with the following error:


error "Google Earth got an error: Can’t continue GetCurrentVersion." number -1708


and with the following Console message:


3/2/13 5:24:42.505 PM Google Earth[53575]: +[NSDictionary scriptingRecordWithDescriptor:]: unrecognized selector sent to class 0xacdb248c


Anyone know why?


The GE AppleScript dictionary has the following entry:


GetCurrentVersionv : Get the current version of the Google Earth client

GetCurrentVersion record : record of major, minor and build numbers

→ list of integer : version fields


AppleScript and Google Earth work fine for other users on this machine. It only fails on my account.


I have tried deleting all vestiges of GE from the machine and reinstalling, but this hasn't worked.


Any other ideas?

Posted on Mar 2, 2013 2:52 AM

Reply
36 replies

Aug 29, 2017 1:58 PM in response to Buadhai

I've been getting that failure notice every time I tried to upgrade Google Earth. The copy I had in applications worked, it was just an old copy since I kept getting the automatic update notice (where I got the Applescript error every time).


Thinking I must have some corrupt files in the current versions or Applescript, I decided to trash all Google applications (Google, Google Earth, Google Earth Pro) including any associated files, along with Caches and try freshly downloaded installers of Chrome and Google Earth Pro, the latest versions. Chrome installed fine, but got the same Applescript error and software install failure notice for Google Earth Pro. . Okay, after reading a lot of stuff, I finally decided to just give up and put the old Google Earth files (temporarily put in trash) back in their place and just use what I have since I probably open Google Earth once a year! All of this just wasn't worth the effort and Graphic Converter is not in my computer, as the culprit others found. SURPRISE! when moving the application back to my folder, it gave the familiar "the application already exist in the folder, do you want to replace it?"


*** I thought, it said the application failed to install but there it was in my applications folder? Launched it, checked all associated folders in my user library and everything was where it was supposed to be. Went back to the application and ran some tests and most things I tried (just a few that I would use:-) and all were functioning fine.


Seems like the Applescript and install failure warnings are false and the install actually worked and took place. So before you pull your hair out, check your applications folder if it's there and give it a whirl to see if it works :-)

Mar 2, 2013 4:21 AM in response to softwater

Of course that works, but it misses the point entirely.


Your script communicates with the Finder to get the application's version number.


What I want is for AS to communicate with Google Earth.


My 'version' example was just to demonstrate that AS doesn't work with GE.


AS works fine with other applications, including the Finder. It only fails with Google Earth.


What I want to do is use GoogleEarth AppleScript dictionary items like GetViewInfo and GetPointOnTerrain.

Mar 2, 2013 3:34 PM in response to HD

tellapplication "System Events" togethas scripting terminologyofapplication process "Google Earth"


Result=true


AFAIK, AS works with all other applications. It only fails with GE and only on my account.


softwater, I apologize if my original post was not specific enough.


I thought that the title "Why Does AppleScript Fail With Google Earth?" made it clear that the AS failure was with GE. I guess not.


Message was edited by: Buadhai

Mar 2, 2013 3:56 PM in response to Buadhai

-1708 : <reference> doesn't understand the <commandName> message. (from the AppleScript Language Guide)


Which is screwy when it works fine in other accounts on the same Mac. It works ok on my machine too.


Have you tried basic stuff like repairing permissions, clearing caches, rebuilding launchd database? (Second time I've thought of Cocktail tonight). I'm not sure any of it will work, but it's worth a try.


Another thought: are you running it from AppleScript Editor or in another environment (perhaps a Cocoa app?)

Mar 2, 2013 4:05 PM in response to HD

This is actually a longstanding problem. I have indeed used Cocktail to clean up the system; including caches, permissions, etc. As In mentioned, I have twice removed all vestiages of GE from my machine, including caches, preferences, plugins, etc. No joy.


The problem arose because I use Graphic Converter and it uses AS to geotag photos based on the current Google Earth position. That stopped working about six months ago. I contacted the author of Graphic Converter and he suggested using AS Editor to test. Sure enough, the simple GetCurrentVersion script failed from AS Editor.


Several months ago I posted the problem on the GE Google Groups forum. No substantive replies.


It's truly baffling. I figure it has to be something in ~/Library, but I'm at a loss as to what it might be.

Mar 2, 2013 4:18 PM in response to HD

Bleach:bin mnewman$ osascript -e 'tell application "System Events" to get has scripting terminology of application process "Google Earth"'

true

Bleach:bin mnewman$ osascript -e 'tell application "Google Earth" GetCurrentVersion'

32:49: syntax error: Expected end of line but found identifier. (-2741)

Mar 2, 2013 4:37 PM in response to Buadhai

Well.


I have just used Graphic Converter to set the GPS position of an image using Google Earth. I now get the same error message as you when I run your original AppleScript.


User uploaded file


Are you running a licensed installation of Graphic Converter? I'm not, I'm running the trial version.

Mar 2, 2013 4:46 PM in response to Buadhai

Snap.


xx-MacBook-Air:~ xxx$ osascript -e 'tell application "System Events" to get has scripting terminology of application process "Google Earth"'

true

xxx-MacBook-Air:~ xxx$ osascript -e 'tell application "Google Earth" GetCurrentVersion'

32:49: syntax error: Expected end of line but found identifier. (-2741)


Copied and pasted from my Terminal.

Mar 2, 2013 5:10 PM in response to HD

Just to confirm, I get exactly the same error messages as you when trying to AppleScript Google Earth after using Graphic Converter to set the GPS of an image.


I trashed Graphic Converter and its associated preference files. The script now runs fine:




tell application "Google Earth"

GetCurrentVersion

end tell



{7, 0, 3, 8542}


It's Graphic Converter.

Mar 2, 2013 5:27 PM in response to HD

Thanks for your work HD. I am using a licensed version of GC.


I tried geotagging a photo with GC in a different account. Sure enough, that caused AppleScript to fail with Google Earth. After deleting the GC preferences and caches, AS with GE started working again.


Yes, it's Graphic Converter.

I will contact the author and invite him to comment here.


Thanks again for your help in figuring this out.

Why Does AppleScript Fail With Google Earth?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.