/*\ This is some examples on how to use the ARexx interface offered by Mayland
\*/

Options Results
Address 'MaylandRexx'

/* Add a command that'll `Dir Sys:', use the current time, and set it to each tuesday */
 AddDays Tuesday Command '"Dir Sys:"'
 Say 'Command added each tuesday at' Left(Time('n'),5)

/* Add an event to this date, but every month, this year! (at 18 o'clock) */
 SecondsToDate
 DATESTR = RESULT
 PATTERN = Word(DATESTR,1) '0' Word(DATESTR,3) '18 00'
 AddDate PATTERN Before 0 After 2*60 Message '"I will return in a month"'
 Say 'Event added the 'Word(PATTERN,1)'th of each month (only this year !)'

/* Add an event in ten minutes */
 SecondsToDate Date('I')*24*60*60 + Time('S') + (60*10) + 30
 PATTERN = RESULT
 AddDate PATTERN After 24*60 Message '"Så er der the!"' BePolite DeleteAfterUse
 Say "You'll be reminded at" SubWord(PATTERN,4,2) "(in ten minutes!)"

/* Say the time'n'date (nicely!) */
 SecondsToDate
 DATESTR = RESULT
 Say 'It is ' Word(DATESTR,1)'-'Word(DATESTR,2)'-'Right(Word(DATESTR,3),2) 'at' Word(DATESTR,4)':'Word(DATESTR,5)

/* Tell how many seconds since 1-1-78 */
 DateToSeconds
 Say RESULT 'seconds have passed since 1-1-78...'

/* The date in half a year */
 RESULT = Date('E')
 Parse Var RESULT DATE '/' MONTH '/' YEAR
 DateToSeconds DATE MONTH+6 YEAR
 SecondsToDate RESULT
 Say 'In EXACTLY half a year, the date will be' SubWord(RESULT,1,3)

Exit
