FR: "local" variables

Posted on
Sat Apr 10, 2004 9:34 am
gregjsmith offline
Posts: 946
Joined: Apr 01, 2003
Location: Rio Rancho, NM

FR: "local" variables

I would like to have a way to have variables specific to devices. I envision accessing these variables via another tab in the devices window.

Posted on
Sat Apr 10, 2004 10:21 am
matt (support) offline
Site Admin
User avatar
Posts: 21426
Joined: Jan 27, 2003
Location: Texas

Re: FR: "local" variables

This is a great idea, and something I've been thinking about a bit lately. The plan is to have devices contain their standard internal variables (on/off, brightness, last modify, ...) and for the user to be able to add their own variable types. All of these variables should then be available to use in conditionals. Additionally, as discussed previously, I'd like to have a variable substitution scheme inside email content. So you could send yourself an email saying, "the front porch lights are $"front porch":deviceState." Not sure about the syntax I should use for this considering that devices can have spaces in their names, but you get the idea.

Regards,
Matt

Posted on
Tue Apr 13, 2004 10:31 am
lobster offline
Posts: 24
Joined: Mar 09, 2004
Location: Boca Raton, FL

(No subject)

Hey Matt,

I'm still pretty new with AppleScript and I'm not sure I fully understand what you want to do, but I'm wondering if you want to consider AppleScript records for handling things syntactically. For example, this code:
Code: Select all
tell application "BBEdit"
   set p to (get properties of web site 1)
   set r to {rating:"high"}
   set q to (r & p)
end tell

returns (to 'p') a record of BBEdit's web site properties:
Code: Select all
{id:"3162061B-B7E9-11D7-864B-0003934107FC", container:application "BBEdit", name:"Untitled Site", server url:"http://www.example.com/", server path:"", default file name:"index.html", is default web site:true}

Then, we can add our own entries to the record at will (above, I add a 'rating' property/variable/item), so that 'q' becomes:
Code: Select all
{rating:"high", id:"3162061B-B7E9-11D7-864B-0003934107FC", container:application "BBEdit", name:"Untitled Site", server url:"http://www.example.com/", server path:"", default file name:"index.html", is default web site:true}

Now, your example might look something like:
Code: Select all
tell application "Indigo"
   set p to (get properties of device "font porch")
   set msg to "The front porch lights are " & (get deviceState of p)
end tell

Note that the record items can have spaces in their names, and if there's a way to 'set' the record back into the device (is this possible?), then we can add our own named items nicely. Does this make any sense?
-John

Posted on
Tue Apr 13, 2004 8:50 pm
matt (support) offline
Site Admin
User avatar
Posts: 21426
Joined: Jan 27, 2003
Location: Texas

(No subject)

Hi John,

I was mainly referring to how to inline the variables within the UI of Indigo itself. For example, the user could choose the "Send Email" action and then, within the UI for the action in Indigo, use some type of syntax within the message edit field to represent the current variable values.

But you are correct, these user-added variables will also need an AppleScript representation. I haven't given much thought to AppleScript records, but based on your example it would be a good way to allow customization and extension of Indigo's elements.

Regards,
Matt

Posted on
Fri May 28, 2004 1:26 pm
lobster offline
Posts: 24
Joined: Mar 09, 2004
Location: Boca Raton, FL

(No subject)

Another feature request related to variables:

I think variables should be more similar to devices then they are now. More specifically, could variables keep track of their 'last changed' times? So if I use a variable to hold an updated value, other script code could find out when the variable was last updated. Also, the 'display in remote ui' property would be useful for variables as well. For example, I've modified the Indigo.acgi script posted in your sample scripts area to display variables as well. Controlling which variables to display would be dandy.

Sorry, one more: Any chance you could make your sample scripts directory browsable?
   http://www.perceptiveautomation.com/indigo/sample_scripts/
Then we could see all the scripts that have been contributed without knowing the names ahead of time. Same thing is true of the Download directory, but it's not as big of a deal to me. Thanks,

-John

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests