How to refer to Applescript dictionary objects with spaces in the name 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.
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.