Time Display on web site

Posted on
Tue Jun 05, 2012 12:37 pm
esprits300 offline
Posts: 49
Joined: Apr 29, 2012

Time Display on web site

Hello, i am trying to get the time to show up as a variable so i can have it on indigo both the touch app and the web site. After perusing around the forum it seems applescript is the best way but i cant seem to get this to work. i created a variable in indigo called CurrenTime and im trying to create an action to run a script every minute to update this variable. i cant quite seem to get the syntax right. coudl someone help me out or tell me of a better way to do this if possible? i looked on both the forums and online for sample code but so far it just wont work... thank you!

Posted on
Tue Jun 05, 2012 1:21 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Time Display on web site

Use the Insert Timestamp into Variable action in the Action Collection plugin. If you want the time formatted with 12 hour with am/pm then the formatting string would be "%I:%M %p" (i.e. "03:45 PM").

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jun 05, 2012 8:18 pm
esprits300 offline
Posts: 49
Joined: Apr 29, 2012

Re: Time Display on web site

Thank you! worked Perfectly!

Posted on
Tue Jun 12, 2012 3:56 pm
CraigM offline
Posts: 589
Joined: Oct 28, 2007

Re: Time Display on web site

I just tried this, but the time [on the website] is not auto-updating. I only get the current time when I click on the control page item.

Also, is there a string for 2:45, instead of 02:45 when there is a single digit hour [no am/pm]?

Posted on
Tue Jun 12, 2012 4:10 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Time Display on web site

Is the time updating in the Variable window? If not your trigger isn't working. If it is then the page element on your control page isn't defined correctly.

The built-in Python time functions don't appear to have a 0 free hour so you'd have to write a script to take off the leading 0 rather than using the Insert Timestamp into Variable action.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jun 12, 2012 4:35 pm
CraigM offline
Posts: 589
Joined: Oct 28, 2007

Re: Time Display on web site

jay (support) wrote:
Is the time updating in the Variable window? If not your trigger isn't working.

NOT updating in the variable window, only when I click on the control page item.

Assuming that I need a trigger in Indigo, what are the "Trigger/Condition/Actions" settings suppose to be?

Posted on
Tue Jun 12, 2012 4:50 pm
jay (support) offline
Site Admin
User avatar
Posts: 18225
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Time Display on web site

Create a schedule that fires every minute. No conditions. The action is the Insert Timestamp into Variable action in the Action Collection plugin. That will cause the variable to update once a minute. Then put a variable value page element on your control page that shows the value of the variable that you selected in the Insert Timestamp into Variable action.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jun 12, 2012 5:11 pm
CraigM offline
Posts: 589
Joined: Oct 28, 2007

Re: Time Display on web site

Got it, Thanks :D

Posted on
Mon Jul 20, 2015 5:24 am
TOPS offline
User avatar
Posts: 169
Joined: Jun 17, 2015
Location: London, England

Re: Time Display on web site

Hi,

Any chance of a simple walk through on how to display the date and time on my control pages please?

Thanks in advance

Dave

******UPDATE******

by playing around, I've got it working and updating every minute :D , how now do I change the date format from Y/M/D to D/M/Y and get the seconds to count? at the moment the seconds just stay at zero, or get rid of the seconds display

Thanks,

Dave

Posted on
Mon Jul 20, 2015 6:20 am
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Time Display on web site

To get the seconds to count, you'll have to update the data and the control page every second. I'd suggest not showing seconds unless you really need them.

As to the format, if someone doesn't respond, ping me later and I'll share the script I use after work.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 21 guests