home *** CD-ROM | disk | FTP | other *** search
/ Backpacker 1 (Norsk) / backpacker.iso / pc / data / misc / start.dxr / 00028_PC_dateH.ls < prev    next >
Encoding:
Text File  |  1995-02-28  |  1.6 KB  |  72 lines

  1. on PC_dateH
  2.   global YY, MM, DD
  3.   set YY to 2001
  4.   set MM to random(12)
  5.   set DD to random(28)
  6.   set K to the long date
  7.   set TTL to []
  8.   set n to 0
  9.   set m to 1
  10.   repeat while n <= length(K)
  11.     set n to n + 1
  12.     set CN to charToNum(char n of K)
  13.     if (CN >= 48) and (CN <= 57) then
  14.       nothing()
  15.       next repeat
  16.     end if
  17.     set fig to value(char m to n - 1 of K)
  18.     if not voidp(fig) and (char m to n - 1 of K <> EMPTY) and (n > 1) then
  19.       append(TTL, fig)
  20.     end if
  21.     set m to n + 1
  22.   end repeat
  23.   if getAt(TTL, 1) < 35 then
  24.     set DD to getAt(TTL, 1)
  25.     set YY to getAt(TTL, 2)
  26.   else
  27.     set DD to getAt(TTL, 2)
  28.     set YY to getAt(TTL, 1)
  29.   end if
  30.   set K to the short date
  31.   set TL to []
  32.   set n to 0
  33.   set m to 1
  34.   repeat while n <= length(K)
  35.     set n to n + 1
  36.     set CN to charToNum(char n of K)
  37.     if (CN >= 48) and (CN <= 57) then
  38.       nothing()
  39.       next repeat
  40.     end if
  41.     set fig to value(char m to n - 1 of K)
  42.     if not voidp(fig) then
  43.       append(TL, fig)
  44.     end if
  45.     set m to n + 1
  46.   end repeat
  47.   repeat with n = 1 to count(TL)
  48.     set TEST to getAt(TL, n)
  49.     if (TEST = YY) or ((TEST + 1900) = YY) or (TEST = DD) then
  50.       deleteAt(TL, n)
  51.       set n to n - 1
  52.     end if
  53.   end repeat
  54.   if count(TL) = 1 then
  55.     set MM to getAt(TL, 1)
  56.   else
  57.     repeat with n = 1 to count(TL)
  58.       set TEST to getAt(TL, n)
  59.       if (TEST = YY) or ((TEST + 2000) = YY) or (TEST = DD) then
  60.         deleteAt(TL, n)
  61.         set n to n - 1
  62.       end if
  63.     end repeat
  64.     if count(TL) = 1 then
  65.       set MM to getAt(TL, 1)
  66.     end if
  67.   end if
  68.   if YY < 100 then
  69.     set YY to YY + 2000
  70.   end if
  71. end
  72.