| Author |
Message |
|
anode
Joined: May 27, 2007 Posts: 689 Location: NC
|
 Sending a variable??
I searched and found stuff semi-close.
But I need a 'hello world' proggy to jump start me.
What I am doing is using an industrial PLC in conjunction with x-10 and some homebrew hardware. I plan on sending over a variable to be inserted into Indigo.
Here's what I got:
tell application "IndigoServer"
set value of variable "Thermostat" to "87" as integer
end tell
And heres the error:
IndigoServer got an error: Can't set value of variable "Thermostat" to 87.
Wrench in the works right now (maybe?) is that I am trying this over the internet (I'm on da' road)
What am I missing?
|
| Sun May 27, 2007 5:39 pm |
|
 |
|
Matt
Joined: Aug 13, 2006 Posts: 390 Location: Northern Idaho
|
Create the variable in Indigo first.
Click Windo, Select Variable List, and create a new variable called Thermostat using the New button
|
| Mon May 28, 2007 12:49 am |
|
 |
|
wikner
Joined: Nov 02, 2003 Posts: 88
|
 Variables in Indigo
I may be wrong, but I think all variables in Indigo are stored (or at least they look, from appleScript like they are stored) as strings. I have used the following code:
- Code: Select all
tell application "IndigoServer" if (exists variable "Temperature") then set (value of variable "Temperature") to "85" else make new variable with properties {name:"Temperature", value:"85"} end if end tell
|
| Thu Jun 21, 2007 7:49 am |
|
 |
|
anode
Joined: May 27, 2007 Posts: 689 Location: NC
|
 Re: Variables in Indigo
Thanks! I did try this and no luck. Even deleted the "temperature'" variable to see if it would create it. That failed too.
Maybe the prob is the server is on a different machine then the applescript?
And if that is the prob, then indigo is useless to me.
wikner wrote:I may be wrong, but I think all variables in Indigo are stored (or at least they look, from appleScript like they are stored) as strings. I have used the following code: - Code: Select all
tell application "IndigoServer" if (exists variable "Temperature") then set (value of variable "Temperature") to "85" else make new variable with properties {name:"Temperature", value:"85"} end if end tell
|
| Fri Jun 22, 2007 11:44 am |
|
 |
|
matt (support)
Site Admin
Joined: Jan 27, 2003 Posts: 11682 Location: Texas
|
 Re: Variables in Indigo
anode wrote:Maybe the prob is the server is on a different machine then the applescript?
If the script is embedded in an Indigo action, and you are using the Indigo client on your remote machine, then you can run and have the Indigo Server on a remote machine execute the AppleScript automatically.
If you are just running the script from the Apple Sript Editor application and the Indigo Server is on another machine, then you need to use the "tell application on machine" notation to target the remote machine.
Regards,
Matt
|
| Fri Jun 22, 2007 12:57 pm |
|
 |
|
hammer32
Joined: May 13, 2006 Posts: 66 Location: Copperas Cove, TX
|
I've got a similar problem trying to set the value of a variable within a script. I'm trying to use the DS10A type security sample script to set the value of a variable with the name of the devID to either alarm or normal:
- Code: Select all
-- Sample attachment script that illustrates how to listen to -- commands from security devices. Only the W800RF32 -- interface receives these commands.030515 (mmb)
using terms from application "Indigo" on receive security event of eventType with code devID if eventType is sec_SensorNormal_min then tell application "Indigo" to set value of variable devID to "normal" if eventType is sec_SensorNormal_max then tell application "Indigo" to set value of variable devID to "normal" if eventType is sec_SensorAlert_min then tell application "Indigo" to set value of variable devID to "alarm" if eventType is sec_SensorAlert_max then tell application "Indigo" to set value of variable devID to "alarm" log "(device ID " & devID & ")" using type "Security Sample" -- important: we must pass the event on to Indigo continue receive security event of eventType with code devID end receive security event end using terms from
For this I'm using a security sensor with ID "109" and I've got a variable in Indigo called 109. When I run the script I get this in Indigo's log: - Code: Select all
17:24:44 Error script error: Indigo got an error: Can't set value of variable 109 to "alarm". 17:24:47 Error script error: Indigo got an error: Can't set value of variable 109 to "normal".
|
| Thu Jul 19, 2007 4:44 pm |
|
 |
|
matt (support)
Site Admin
Joined: Jan 27, 2003 Posts: 11682 Location: Texas
|
Are you using Indigo 2.0? If so, then change every instance of:
- Code: Select all
application "Indigo"
to: - Code: Select all
application "IndigoServer"
Lastly, try casting the devID to a string like this: - Code: Select all
if eventType is sec_SensorNormal_min then tell application "IndigoServer" to set value of variable (devID as string) to "normal"
Matt
|
| Thu Jul 19, 2007 4:48 pm |
|
 |
|
hammer32
Joined: May 13, 2006 Posts: 66 Location: Copperas Cove, TX
|
(devID as string)
Thanks! That did the trick (I'm still using 1.8 ).
-Sean
|
| Thu Jul 19, 2007 4:59 pm |
|
|