View unanswered posts | View active topics It is currently Sun May 19, 2013 6:57 am



Reply to topic  [ 6 posts ] 
 Date and Time Script 
Author Message

Joined: Jun 21, 2010
Posts: 11
Post Date and Time Script
I'm using the following script to show CURRENT DATE and TIME on my control page

tell application "IndigoServer"
    set value of variable "CURRENTDAYDATE" to (current date) as string
end tell

The problem is I cant get the time to update as the current time changes- The time will only change if I RUN the script and then the Time is stuck.
Is their a way to auto AUTO RUN it. Any help will be greatly appreciated.


Fri Feb 04, 2011 8:49 am
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6642
Location: Austin, Texas
Post Re: Date and Time Script
You need a separate time/date trigger that runs periodically (perhaps once a minute that updates the variable (use the script you have above). Then you would just show that variable on your control page.

_________________
Jay (Indigo Support)
Image


Fri Feb 04, 2011 9:45 am
Profile WWW

Joined: Jun 21, 2010
Posts: 11
Post Re: Date and Time Script
Hi JAY,
I have a trigger set up already but there is no option to PERIODICALLY run it- Which is what I'm looking for.


Fri Feb 04, 2011 10:36 am
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6642
Location: Austin, Texas
Post Re: Date and Time Script
That's exactly what a Time/Date Action does - it runs at the time periods you specify.

_________________
Jay (Indigo Support)
Image


Fri Feb 04, 2011 10:45 am
Profile WWW

Joined: Jun 21, 2010
Posts: 11
Post Re: Date and Time Script
I guess I was looking for an option for SECONDS but then again that might be too much. Is it possible to take the seconds off my script?
It currently reads " Friday,February,4 2011 12:09:03 am". If I cant run every second, can the "03" be removed from the script?


Fri Feb 04, 2011 11:13 am
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6642
Location: Austin, Texas
Post Re: Date and Time Script
On the Time/Date Trigger tab, under the "Time:" section, you'd select the "Every" radio button and put in some fractional amount of minutes (.02 or something) to get seconds. But really, that's a lot of processing overhead to just show seconds ticking on a control page.

AppleScript uses the formats specified in the "Language & Text" system control panel to format the string that's returned when you coerce a date into a string. The easiest way to change what's shown is to change the format there. AppleScript uses the "Full" date format and appends the "Medium" time format. You can see/edit those if you click on the "Customize" button. If you edit the "Medium" format for Time and remove the ":" and "09" popup so that the medium line looks like this:

7:08 PM

Then here's what you'd get for the various coercions and elements of a date in AppleScript:

Code: Select all
time string of (current date) -- result: 12:14 PM
(current date) as string -- result: Friday, February 4, 2011 12:13 PM

_________________
Jay (Indigo Support)
Image


Fri Feb 04, 2011 12:16 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.