| Author |
Message |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
 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.
|
| Wed Nov 25, 2009 7:05 pm |
|
 |
|
anode
Joined: May 27, 2007 Posts: 689 Location: NC
|
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)
|
| Thu Nov 26, 2009 8:48 am |
|
 |
|
matt (support)
Site Admin
Joined: Jan 27, 2003 Posts: 11698 Location: Texas
|
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.
_________________
|
| Thu Nov 26, 2009 10:02 am |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
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  ] I guess I'll wait for the feature to appear at some future time.
|
| Thu Nov 26, 2009 11:41 am |
|
 |
|
matt (support)
Site Admin
Joined: Jan 27, 2003 Posts: 11698 Location: Texas
|
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.
_________________
|
| Thu Nov 26, 2009 11:51 am |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
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.
|
| Thu Nov 26, 2009 12:43 pm |
|
 |
|
bobeast
Joined: Apr 16, 2003 Posts: 392
|
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.
|
| Thu Nov 26, 2009 12:49 pm |
|
 |
|
berkinet
Joined: Nov 18, 2008 Posts: 1721 Location: Berkeley, CA
|
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.
|
| Thu Nov 26, 2009 12:58 pm |
|
|