home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / utility / text / htext.lzh / hypertext / Rexx / startht.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1990-12-23  |  1.4 KB  |  48 lines

  1. /* this macro will make *sure* HT has been started in resident mode. */
  2. /* it is basically a support routine for other higher level routines */
  3. /* to call on to make sure that they can send messages to HT         */
  4.  
  5. if ~show('L',"rexxsupport.library") then
  6.  call addlib("rexxsupport.library", 10, -30, 0)
  7.  
  8.  
  9.  /* You may want to change this stem variable to reflect where you have put
  10.   * HT in your system.    Basically what happens is that we check each of
  11.   * these locations, and if HT exists, and it is not a directory, we try
  12.   * to run.  I'm sure this isn't 100% foolproof, but then you aren't a
  13.   * fool, right ? :)
  14.   */
  15.  ht_name.1 = "df0:ht"
  16.  ht_name.2 = "df0:c/ht"
  17.  ht_name.3 = "df1:ht"
  18.  
  19.  if ~show(P, HT) then do
  20.    select
  21.      when Exists(ht_name.1) & Word(StateF(ht_name.1), 1) == FILE then id = 1
  22.      when Exists(ht_name.2) & Word(StateF(ht_name.2), 1) == FILE then id = 2
  23.      when Exists(ht_name.3) & Word(StateF(ht_name.3), 1) == FILE then id = 3
  24.      otherwise id = 1
  25.     end
  26.    address command "run "ht_name.id "-r"
  27.   end
  28.  else do
  29.    address HT RESIDENT
  30.    exit 0
  31.   end
  32.  
  33.  
  34. /* here we just loop waiting for HT to start.  We bail out if it takes HT
  35.  * too long to have started.  This is basically just sanity checking, in
  36.  * case something is acting weird
  37.  */
  38.  count = 0
  39.  do until show(P, "HT")
  40.    call Delay(10)
  41.    count = count + 1
  42.    if count > 70 then do
  43.      say "Timed out waiting for HT to start up."
  44.      exit 5
  45.     end
  46.  end
  47.  
  48.