Run AppleScript on Control Page open

Posted on
Wed Nov 25, 2009 7:05 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Run AppleScript on Control Page open

Is it possible (or is this a feature request) to have a control page automatically run an AppleScript whenever it is called? The purpose would be to assure that variable were up to date, but might also do picture swapping or whatever.

In my case I poll the thermostats automatically every 10 minutes. But, if my wife resets the setpoint at the tstat right after a poll and I then load the tstat control page (in another part of the house), I see the old data.

Posted on
Thu Nov 26, 2009 8:48 am
anode offline
Posts: 697
Joined: May 27, 2007
Location: NC

(No subject)

The variables on a CP seem to self update rather quickly.
I'd almost say that when one changes it forces a CP update.

(But I like the AS run on page load idea)

Posted on
Thu Nov 26, 2009 10:02 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

(No subject)

There isn't currently a way to do this via the UI, but the request has come up a few times so I'll bump it up higher on our feature consideration list. Actually, now that I think about it you could use a RESTful URL to execute an Action Group (that does your AppleScript) and then immediately do a redirect. Here is an example:
Code: Select all
http://127.0.0.1:8176/actions/your_applescript_action_group?_method=execute&_redirect=your_control_page_url

The problem with that approach is that you have to use that URL every time you access/link to the Control Page and it does not work with Indigo Touch.

Image

Posted on
Thu Nov 26, 2009 11:41 am
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

(No subject)

support wrote:
...The problem with that approach is that you have to use that URL every time you access/link to the Control Page and it does not work with Indigo Touch.

Thanks Matt. Given that I use this control page almost exclusively in Indigo Touch [ iIndigo :wink: ] I guess I'll wait for the feature to appear at some future time.

Posted on
Thu Nov 26, 2009 11:51 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

(No subject)

If you are linking to the Control Page from another Control Page, then you could assign a server On Click action for that control that executes the Action Group. That is, the On Click would have a client action to go to the new Control Page and a server action to execute the Action Group. That should work from Indigo Touch. It also works from Firefox, I think, but not from Safari. Safari kills the Javascript a bit too quickly when it follows the URL and the command to execute the Action Group never makes it to Indigo.

Image

Posted on
Thu Nov 26, 2009 12:43 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

(No subject)

Thanks Matt: That solves 1/2 of my problem. Sometimes I go directly to the control page for the tstat, but other times I navigate there from another control page.

However, I guess that I can develop my own start page at the root level of the Control Pages and use that to navigate to my other pages... for now.

Enjoy the holiday.

Posted on
Thu Nov 26, 2009 12:49 pm
bobeast offline
User avatar
Posts: 400
Joined: Apr 16, 2003

(No subject)

support wrote:
There isn't currently a way to do this via the UI, but the request has come up a few times so I'll bump it up higher on our feature consideration list.


Yup. Please add me to the chorus. I've often wanted an On Control Page Open/Close trigger mechanism for status updates, contextual image swapping, etc.

Choose to chance the rapids.
Dare to dance the tide.

Posted on
Thu Nov 26, 2009 12:58 pm
berkinet offline
User avatar
Posts: 3290
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

(No subject)

Ok, so I built my own landing page and it does the basic job. The only issue is that I have to navigate to it after touching Control Pages. So, if I might enter one more request into the future feature queue...

Allow one control page to be designated as the Indigo Touch landing page and that control page is what would be seen when you "click/touch" the Control Pages icon in Indigo Touch.

I might also be nice to be able to designate a landing page for connections to the built-in web server. That would allow a nice custom look.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 6 guests