0

I'm trying to write an Applescript that accesses EyeTV (yes, I still have one running!). I'm trying to list the recordings in the programs window. From the dictionary:

application n [see also Standard Suite] : the EyeTV application
  elements
   contains player_windows, programs, recordings, channels, favorites lists.
  properties
   current recording (double integer, r/o) : unique id of the current (frontmost) recording. Returns 0 if there is none.
  programs window (programs_window, r/o) : schedule dialog

Further down in the dictionary is:

programs_window n [inh. window] : window containing the list of programs and recordings
  elements
   contains programs, recordings.
  properties
   selection (list of list) : A list containing every selected recording, channel or schedule (program) in the programs window, depending on what the current category is.

If I right click the dictionary and choose "New script" it will helpfully start the script for me:

tell application "EyeTV"

end tell

I then add the line that is the problem:

tell application "EyeTV"
    set recordList to recordings of programs window
end tell

If I compile this I get "Syntax Error Expected end of line but found class name."

If I use programs_window instead, on running the script the error will be The variable programs_window is not defined.

I found a script someone else has written to export recordings from EyeTV to Plex, and it uses programs window. If I copy and paste the whole script and try to compile it I again receive the error Syntax Error Expected end of line but found class name.

I'm unsure how to proceed. Should I be referring to the programs window property of the application or the programs_window class? How can I get rid of the errors?

I have a copy of the AppleScript Language Guide but it seems to say nothing on the topic of application dictionaries.

Any help with this would be much appreciated.

  • FWIW I downloaded EyeTV3.6.9(7524)20180130 and installed it. Added its AppleScript Dictionary to the Library in Script Ediror and both compile without error on my system, running macOS High Sierra. – user3439894 Jan 13 at 22:09
  • @user3439894 I fixed it, a hilariously simple fix but not one I was expecting. Thanks for taking the time to look into it, it's always nice to know there's someone willing to help! – Iain Jan 14 at 4:52
1

There was a simple fix, make sure the application is running during the compilation phase. I find that strange considering it has the dictionary and isn't (or I assume it isn't) making any calls to the application in question, but that's the way it is.

A little digging brought up a book about Applescript a few versions back but it obviously still applies (emphasis mine).

External Referents Needed at Compile Time

AppleScript is a little language, leaving it up to various external entities such as scriptable applications (or scripting additions) to extend the language as needed. When the time comes to compile a script, if it makes any use of such externally defined extensions to the language, those external entities must be present, and AppleScript must be able to locate them, so that it can ascertain whether the words you’re using in your code correspond to extensions to the language defined in these external entities, and if so, how to translate them into bytecode.

This is one more instance of the ancient call to developers - please, make your error messages better.

  • You said, "There was a simple fix, make sure the application is running during the compilation phase." and I find that not to be the case, EyeTV was not opened when I compiled the code! I have been using AppleScript regularly for the last 13 years and I've not had to have the applications running in order to compile the code! Also, this quoted from the referenced source, "those external entities must be present, and AppleScript must be able to locate them" does not at all mean the app must be running in order to compile the code, it means it's AppleScript Dictionary can be located. – user3439894 Jan 14 at 9:24
  • @user3439894 I can only tell you that's how it worked for me, if I quit the app the error returns, start the app it goes away so my assumption is that "those external entities must be present, and AppleScript must be able to locate them" is indistinguishable from requiring the app to be running. Your case does throw that into doubt somewhat. I've no idea why my system is the unique case here. – Iain Jan 14 at 9:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .