Applescript Weirdness

Posted on
Sat Apr 24, 2004 10:18 pm
Dano offline
Posts: 20
Joined: Feb 24, 2004
Location: Sterling Heights, MI

Applescript Weirdness

Hi,

I'm using the TXB-16 thermostat, Phlink, and a modified version of the TXB script that always keeps an Indigo variable up-to-date for the thermostat Temp, Setpoint, Fan, Setback, etc. If anyone wants this I will post it or send it to Matt.

Anyway, I'm trying to do telephone control my Thermostat, and the following command tied to an action group as embedded applescript works great:

set curTemp to (get value of variable "TXTemperature")
log "curTemp is " & curTemp

The log displays an appropriate log entry that looks something like

12:11:54 AM, 4/25/04
Script curTemp is 72
Action Group new action group

Cool. All is good.

However, this script, run from Phlink as a greeting.scpt, should do the same I believe.

on do_action given call:c, callername:cname, callerid:cid, tonesequence:tseqs
tell application "Indigo"
log "caller name = " & cname using type "Phlink"
log "caller ID = " & cid using type "Phlink"
log "key sequence = " & tseqs using type "Phlink"
log "curtemp is " & (get value of variable "TXTemperature") using type "Phlink"
set curTemp to (get value of variable "TXTemperature")
set curSet to (get value of variable "TXsetPoint")
-- set curTemp to 72
-- set curSet to 74
log "curtemp and set" & curTemp & " " & curSet & "." using type "Phlink"

tell application "Ovolab Phlink 1.3"
tell c
speak "The current house temperature is"
speak curTemp
speak ". And the thermostat is set at"
speak curSet & "."
speak "To Get more information, press 1. To change settings, press 2."
end tell
end tell
end tell
end do_action

This script craps out after the 4th log line. It logs curtemp is 72 to the log screen under phlink, and the next log entry never appears.

I try to embed the (get value of variable "TXTemperature") right into the speak commands in the Phlink section but it doesn't work there either.

If I comment out the two set commands with the (get value...) function and uncomment the ones that assign hard values 72 and 74, everything works great.

I cannot figure out for the life of me why this will work in embedded applescript but fails in this Phlink launched script. I don't see an error messages because Phlink doesn't appear to be trapping them and sending them to a log like Indigo -- which I why I made the test action group in Indigo. But it works, so I still have no idea what the computer is reporting as an error.

Any thoughts?

-Dan

--
Dan Mowczan

Posted on
Sun Apr 25, 2004 7:57 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Applescript Weirdness

Morning Dan,

I think maybe it is this line that is causing the problem:

   set curSet to (get value of variable "TXsetPoint")

My shot-in-the-dark guess is that your variable name in Indigo is "TXSetPoint" and not "TXsetPoint" (capital S), and the error is being caused by the script trying to get the value of a variable that doesn't exist.

If that is not it, then I'm not sure what the problem is.

Regards,
Matt

Posted on
Fri Apr 30, 2004 4:39 pm
Dano offline
Posts: 20
Joined: Feb 24, 2004
Location: Sterling Heights, MI

(No subject)

Hi, just back from a trip. Thank you. I can't believe I couldn't see it.

-Dan

--
Dan Mowczan

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 35 guests