Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Applescript "Expected end of line but found property." error when using google chrome

I recently updated to OS Mavericks and it appears a few of my applescripts dealing with Google Chrome have stopped working properly.

I have a simple function that opens chrome and creates a new window..

on openWindow()
  tell application "Google Chrome"
      activate
      set newWin to make new window
      tell active tab of newWin to set URL to "http://play.google.com/music"
  end tell
end openWindow

However, this gives me the error: Expected end of line but found property.

referring to the "tab" in "tell active tab of newWin." This link seems to offer a bit of help, but I'm still lost as to how to fix this issue. Can anyone help me get this working again? Thanks.

like image 271
android_student Avatar asked Nov 01 '22 02:11

android_student


1 Answers

I'm having a similar problem, also on OS X 10.9.4, where a very simple script

tell application "iTunes"
    return persistent ID of (first source where kind is library)
end tell

every now and then returns the exact same error message:

NSAppleScriptErrorBriefMessage = "Expected end of line but found property.";
NSAppleScriptErrorMessage = "Expected end of line but found property.";
NSAppleScriptErrorNumber = "-2741";
NSAppleScriptErrorRange = "NSRange: {45, 2}";

It's not a real solution, but in my experience a computer restart gets rid of the issue (for a while). The whole problem looks like a bug in AppleScript to me.

Turns out I was running a Windows VM using Parallels at the same time. In the VM, there was also an iTunes instance. In essence, I had two different versions of iTunes on the same system. One that understands AppleScript and one that doesn't. Addressing the OS X iTunes like this solved the issue:

tell application "/Applications/iTunes.app"
    return persistent ID of (first source where kind is library)
end tell

Perhaps the problem in the original question can be solved the same way.

like image 98
Hendrik Avatar answered Nov 11 '22 13:11

Hendrik