Error message variable not defined.

I have a script that works. I download a fresh copy of the application the script runs against, and I get the error message. Looking at the library with AppleScript editor, the dictionaries appear identical. The author of the program says both are identical.
In the first snippet, I get “the variable hdg is not defined”. In the second I get “the variable TxRpt is not defined”.

The script gets the value of a text field “TxRpt” from one application and transfers it to an edit box in a second app, which is GUI scripted.


tell application "RUMlog"
  set hdg to TxRprt
  set beam to hdg as string
end tell

tell application "RUMlog"
  if TxRpt is nil then
    display dialog "TxRpt is nil" buttons {"OK"}
  end if
  set hdg to TxRprt
  set beam to hdg as string
end tell

I’ve just downloaded the app to take a look at your script. :slight_smile:

In the first snippet, you’ve got ‘TxRprt’, which compiles as a keyword against the application. According to the application’s dictionary, ‘TxRprt’ writes a ‘TxRprt’ parameter to a field in the application. It doesn’t return a value to the script, which is why ‘hdg’ isn’t defined. In the second snippet, you’ve got ‘TxRpt’, which isn’t in the dictionary and is therefore assumed to be a variable.

Thanks, Nigel. The only difference in the snippets is the second one tests TxRpt for nil. The script actually gets the value of TxRpt FROM RUMlog and transfers it to my app. I don’t understand the why it works, but that’s what it does.

Now for the embarrassing part. I was trying to run against a version of RUMlog prior to it exposing TxRpt. :rolleyes: