applescript for clipboardICAS
applescript for clipboardICAS
- Subject: applescript for clipboardICAS
- From: "AAT at www.aatideas.org" <email@hidden>
- Date: Sun, 6 Feb 2005 17:06:37 -0800
AAT is developing ICAS standards for developing
uniform scales of calendar and clock.
The applescript application clipboardICAS for Mac OS lets a user choose an
ICAS formatset for date, time, or datetime to copy to the clipboard.
The following datetime stamp is one of the three ICAS formatsets
that can be generated by the application:
---- begin ICAS formatset datetime ----
ICAS uniform date and time as of:
UCN 12005P07 IDC deka(SanJose) t538
UCN 12005P07 IDC zodiac(PST) t505
(UCN calendar and IDC clock per 'ICAS in use'
at http://www.aatideas.org/itinica/licenses/index.html)
(AD common year day 037)
trad 2005 February 06 Sunday 12:08:08)
---- end ICAS formatset datetime ----
The applescript application may be used by others
at no charge in accordance with
'ICAS in use' terms of use referenced therein. See the applescript source code
for terms by which code may be modified
(for example to configure a format set for other time zones).
The bug "2004December31 is not a valid date" may be resolved by opening:
--> System Preferences --> International --> formats
and then configuring date format order as [Year
Month Day Weekday and yyyy-mm-dd-weekday].
The Mac OS international format preferences also
lets you set the --Measurement Units-- to
"Metric".
A forthcoming version of ICAS will likely specify
additional support for 'formatsets'
and standards for ICAS coding and development corresponding to claims of
'ICAS in use' by developers and users.
A new version of ICAS is presently under review and is expected to be released
as a working draft during the first half of this year.
More later,
Ron
===== begin applescript source code =====
-- clipboardICAS.applescript
-- clipboardICAS
(*
_clipboardICAS_
applescript code is copyright © 2005 UCA and
prior, Alliance for the Advancement of Technology
code developed by Ron Stone for AAT with reference to the
_Current Date & Time_ sample script by Apple Computer, Inc.;
and the Integrated Chronological Applications System (ICAS)
licensed by Alliance for the Advancement of Technology (AAT).
Use of this script is only permitted subject to conformance with
'ICAS in use' terms of use referenced on the
http://www.aatideas.org/itinica/license/index.html ICAS licenses page.
Extensibility of this code to uniform scales of
calendar and clock is subject to limitations.
Changes or modifications to this code are permitted subject to conformance with
'ICAS in use' and ICAS licensing, and on the condition that the resulting code
represent the use of 'ICAS in use' for any subsequent developer,
and not the developer of this code.
The Uniform Calendar (UC), New Calendar (NC), and Inter-Dial Clock (IDC)
systems are part of the Integrated Chronological Applications System (ICAS).
AAT provides ICAS standards documents subject to terms of use described
in document AAT ICAS Agave-9010. Please refer to other key
AAT ICAS standards documents accessible via the AAT ICAS web site at
http://www.aatideas.org/icas for important information about ICAS.
AAT has made efforts to ensure the quality of ICAS resources;
however is not responsible for errors. aatideas implementations of
ICAS including AppleScript and Java are not designed for fault tolerance
nor are intended for use in high-risk situations
calling for fault tolerant software/hardware systems.
*)
-- time from computer clock
set currentYear to (year of (current date)) -- is number
set currentMonth to (month of (current date))
set currentDay to (day of (current date))
set currentWeekday to (weekday of (current date))
set currentTime to (time of (current date))
--formats the current SMH clock time
set smhHours to (currentTime div hours)
set properHours to characters 2 thru 3 of ((smhHours + 100) as string)
set smhMinutes to ((currentTime - (smhHours * 3600)) div minutes)
set properMinutes to characters 2 thru 3 of ((smhMinutes + 100) as string)
set smhSeconds to ((currentTime) - (currentTime div 60) * 60)
set properSeconds to characters 2 thru 3 of ((smhSeconds + 100) as string)
--calculates the UT time for both SMH and IDC
set offsetUT to (time to GMT)
set currentUT to ((currentTime) - offsetUT)
if (((smhHours) - (offsetUT div hours)) > 23) then
--(if UT clocks midnight first)
set utHours to (((smhHours) - (offsetUT div hours)) - 24)
else if (((smhHours) - (offsetUT div hours)) < 0) then
--(if my time zone clocks midnight before UT)
set utHours to (((smhHours) - (offsetUT div hours)) + 24)
else
set utHours to (((smhHours) - (offsetUT div hours)))
--(if my time zone and UT are in same calendar day)
end if
set utMinutes to smhMinutes -- code not
necessarily extensible for time zones other than
the hour increments, the ((currentUT - (utHours *
3600)) div minutes) did not debug, other zones
may need to apply an extensible debug or a zone
minute offset
set utSeconds to ((currentUT) - (currentUT div 60) * 60)
set idcUT to ((86400 + currentUT) / 86400)
--formats the SMH-UT clock times
set proputHours to characters 2 thru 3 of ((utHours + 100) as string)
set proputMinutes to characters 2 thru 3 of ((utMinutes + 100) as string)
set proputSeconds to characters 2 thru 3 of ((utSeconds + 100) as string)
--calculates the local zoneDeka times
set idcCurrent to (currentTime / 86400)
set dekaSanJose to ((idcUT) - 0.3)
set dekaMpls to ((idcUT) - 0.25)
set dekaChicago to ((idcUT) - 0.2)
set dekaParis to ((idcUT) + 0.05)
-- please see AAT ICAS Agave-3134 AAT ICAS
zoneDeka zone set for additional information
about deka system time zones
--formats the local IDC times
set properUT to characters 3 thru 5 of ((idcUT) as string)
set properDekaSanJose to characters 3 thru 5 of ((dekaSanJose) as string)
set properCurrent to characters 3 thru 5 of ((idcCurrent) as string)
--calculates the Uniform Calendar and New Calendar dates from computer clock
set propnumerMonth to characters 2 thru 3 of
((currentMonth + 100) as string) -- for use in
currentDate with numerical representations of
month
set properDay to characters 2 thru 3 of ((currentDay + 100) as string)
set priorYear to ((year of (current date)) - 1) --is number
set priorDecember to "December" as string
set priorLast to "31" as string
set priorEnd to (priorYear & priorDecember &
priorLast as string) --is string in format YYYY
Month Day
set currentDate to (currentYear & " " &
currentMonth & " " & properDay as string) --is
string
set currentSMH to (properHours & ":" & properMinutes & ":" & properSeconds)
set currentUTSMH to (proputHours & ":" & proputMinutes & ":" & proputSeconds)
set numEnd to date priorEnd as date --sets string to numerical date
set numCurrent to date currentDate as date --sets string to numerical date
set numDayofYear to (((numCurrent) - (numEnd)) div 86400)
set properDayofYear to characters 2 thru 4 of
((numDayofYear + 1000) as string) --is string
-- determines Uniform Calendar year type
set rule4n100 to (false)
set rule400 to (false)
set ruleZero to (false)
if (((currentYear div 4) = (currentYear / 4)) and ¬
((currentYear div 100) (currentYear / 100))) then
set rule4n100 to (true)
end if
if ((currentYear div 400) = (currentYear / 400)) then
set rule400 to (true)
end if
if currentYear = 0 then
set ruleZero to (true)
end if
if rule4n100 or rule400 or ruleZero is true then
set yearType to "leap"
else
set yearType to "common"
end if
if ((currentYear div 2) = (currentYear / 2)) then
set biAnnum to "even"
else
set biAnnum to "odd"
end if
if ((((numDayofYear - 1) div 30) + 1) < 12) then
set umOrdinal to ((((numDayofYear - 1) div 30) + 1))
else
set umOrdinal to 12
end if
set biEven to "ABCDEFGHJKLM"
set biOdd to "NPQRSTUVWXYZ"
if biAnnum is "even" then
set uniformMonth to character umOrdinal of biEven
else
set uniformMonth to character umOrdinal of biOdd
end if
set numDayofUmonth to ((numDayofYear - (umOrdinal * 30) + 30))
set properDayofUmonth to characters 2 thru 3 of
((numDayofUmonth + 100) as string)
set yearNC to currentYear + 10000
--defines formatsets content and presentation
set lineSpace to ("
")
set tabFirst to ("
")
set tabSecond to ("
")
set termsICAS to (" per 'ICAS in use'" &
tabSecond & "at
http://www.aatideas.org/itinica/licenses/index.html)")
set icasUCN to ("UCN Calendar")
set icasIDC to ("IDC clock")
set icasICAS to ("UCN calendar and IDC clock")
set tradDay to (tabFirst & "(AD " & yearType & "
year day " & properDayofYear & ")")
set tradDate to (tabSecond & "trad " &
currentDate & " " & currentWeekday & ")")
set tradDateTime to (tabSecond & "trad " &
currentDate & " " & currentWeekday & " " &
currentSMH & ")")
set anncUC to ("ICAS Uniform Calendar (UC) date as of:" & lineSpace)
set dateUCN to (tabFirst & yearNC & uniformMonth & properDayofUmonth as string)
set termsUCN to (lineSpace & tabFirst & "(" & icasUCN & termsICAS & lineSpace)
set uformDate to (anncUC & dateUCN & " UCN" & termsUCN & tradDay & tradDate)
set anncIDC to ("ICAS Inter-Dial Clock (IDC) time as of:")
set tformDeka to (tabSecond & "IDC deka(SanJose) t" & properDekaSanJose)
set tformZodiac to (tabSecond & "IDC zodiac(PST) t" & properCurrent & ¬
tabSecond & "SMH-PST " & currentSMH as string)
set tformUT to (tabSecond & "IDC-UT t" & properUT
& tabSecond & "SMH-UT " & currentUTSMH as string)
set timeDeka to (lineSpace & tabFirst & "deka system of 20 zones:" & tformDeka)
set timeZodiac to (lineSpace & tabFirst & "zodiac
system of 24 zones:" & tformZodiac)
set timeUT to (lineSpace & tabFirst & "universal time:" & tformUT)
set termsIDC to (lineSpace & tabFirst & "(" & icasIDC & termsICAS)
set uformTime to (anncIDC & timeDeka & timeZodiac & timeUT & termsIDC)
set anncICAS to ("ICAS uniform date and time as of:")
set dtformDeka to (lineSpace & tabFirst & "UCN "
& yearNC & uniformMonth & properDayofUmonth & "
IDC deka(SanJose) t" & properDekaSanJose as
string)
set dtformZodiac to (lineSpace & tabFirst & "UCN
" & yearNC & uniformMonth & properDayofUmonth & "
IDC zodiac(PST) t" & properCurrent as string)
set termsUCNIDC to (lineSpace & tabFirst & "(" &
icasICAS & termsICAS & lineSpace)
set uformDateTime to (anncICAS & dtformDeka &
dtformZodiac & termsUCNIDC & tradDay &
tradDateTime)
--interface
set chooseICAS to ("Select an ICAS formatset for the clipboard:")
display dialog the chooseICAS buttons {"date", "time", "datetime"}
if the button returned of the result is "date" then
set uformSelect to uformDate
else if the button returned of the result is "time" then
set uformSelect to uformTime
else if the button returned of the result is "datetime" then
set uformSelect to uformDateTime
end if
display dialog the uformSelect buttons {"cancel", "clipboard"} default button 2
if the button returned of the result is "clipboard" then
set the clipboard to the uformSelect
display dialog "The ICAS formatset is on
the clipboard." buttons {"close"} giving up after
2 default button 1
end if
(* script as of
ICAS uniform date and time as of:
UCN 12005P07 IDC deka(SanJose) t514
UCN 12005P07 IDC zodiac(PST) t480
(UCN calendar and IDC clock per 'ICAS in use'
at http://www.aatideas.org/itinica/licenses/index.html)
(AD common year day 037)
trad 2005 February 06 Sunday 11:32:14)
*)
===== end applescript source code =====
--
email@hidden
http://www.aatideas.org
AAT at www.aatideas.org
1090 B Street, Suite #111
Hayward, California 94541
USA
**********************************************************************
be prepared for an upgrade
to uniform scales of date and time
with AAT ICAS!
**********************************************************************
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden