home *** CD-ROM | disk | FTP | other *** search
/ The AGA Experience 2 / agavol2.iso / rexx / help.rexx < prev    next >
OS/2 REXX Batch file  |  1995-06-28  |  4KB  |  122 lines

  1. /****************************************************************************
  2.  *                                                                          *
  3.  * $VER: Help 1.12 (12 Jun 1995)
  4.  *                                                                          *
  5.  *       Written by Freddy Ariës, with modifications by Robbie Akins        *
  6.  *                                                                          *
  7.  * Just a simple menu, for those who can't remember under which function    *
  8.  * key they have stored a certain function.                                 *
  9.  *                                                                          *
  10.  * This script will output a requester on the Scion window, in which it     *
  11.  * will display the current settings of Scion's function keys.              *
  12.  * It requires a version of Scion Genealogist >= 4.04, as well as           *
  13.  * rexxreqtools.library, which in turn needs reqtools.library (>=2.0)       *
  14.  * and rexxsyslib.library.                                                  *
  15.  *                                                                          *
  16.  * For this script to be of any use to you, you will have to add the        *
  17.  * Help.rexx command to the list of function keys that you have set in      *
  18.  * the ScionPrefs program (eg. under F1 or F10).                            *
  19.  *                                                                          *
  20.  * 1 June 1995: added "stripstring" option, and handling of long results    *
  21.  *              - Robbie Akins                                              *
  22.  *                                                                          *
  23.  ****************************************************************************/
  24.  
  25. options results
  26. NL = '0A'x
  27. PSCR = 'SCIONGEN'; /* public screen to open the requesters on */
  28. versionstr = "1.12"
  29.  
  30. /* stripstring: 1 = strip directory path from string, 0 = don't strip */
  31. stripstring.1 = 0
  32. stripstring.2 = 0
  33. stripstring.3 = 0
  34. stripstring.4 = 0
  35. stripstring.5 = 0
  36. stripstring.6 = 0
  37. stripstring.7 = 0
  38. stripstring.8 = 0
  39. stripstring.9 = 0
  40. stripstring.10 = 0
  41.  
  42. if ~show('l','rexxreqtools.library') then do
  43.   if exists('libs:rexxreqtools.library') then
  44.     call addlib('rexxreqtools.library',0,-30,0)
  45.   else do
  46.     say "Unable to open rexxreqtools.library"
  47.     exit
  48.   end
  49. end
  50.  
  51. /* These few lines were stolen from Peter Billings - thanks Peter ;-) */
  52. if ~show('P','SCIONGEN') then do
  53.   TermError('I am sorry to say that the SCION Genealogist' || NL ||,
  54.     'database is not available. Please start the' || NL ||,
  55.     'SCION program BEFORE using this script!')
  56. end
  57.  
  58. myport = "SCIONGEN"
  59. address value myport
  60.  
  61. /*
  62.  * Now let's get funky... (get the current function key settings) ;-)
  63.  */
  64.  
  65. do i=1 to 10
  66.   GETFUNKEY i
  67.   fun.i = TruncString(StripPath(RESULT, i))
  68. end
  69.  
  70. rtn = rtezrequest('Current Scion Function Keys: '||NL||,
  71.       NL||' F1  = '||fun.1||,
  72.       NL||' F2  = '||fun.2||,
  73.       NL||' F3  = '||fun.3||,
  74.       NL||' F4  = '||fun.4||,
  75.       NL||' F5  = '||fun.5||,
  76.       NL||' F6  = '||fun.6||,
  77.       NL||' F7  = '||fun.7||,
  78.       NL||' F8  = '||fun.8||,
  79.       NL||' F9  = '||fun.9||,
  80.       NL||' F10 = '||fun.10||,
  81.       '','_Ok','Help v'||versionstr||' by F.Ariës & R.Akins','rt_pubscrname = '||PSCR)
  82. EXIT
  83.  
  84. TermError:
  85. parse arg str
  86.   rtezrequest(str,'E_xit','Help Message:','rt_pubscrname = '||PSCR)
  87. EXIT
  88.  
  89. /*
  90.  * Procedure to strip the directory path from the string.
  91.  * It will cut off the entire left part of the string, until (and including)
  92.  * the path name, only leaving the filename.
  93.  * If you don't want the path to be left off, use the stripstring flags
  94.  */
  95. StripPath: PROCEDURE EXPOSE stripstring.
  96. parse arg str, ix
  97. if stripstring.ix then /* test by Robbie Akins */
  98. do
  99.   p = lastpos('/', str)
  100.   if p > 0 then ret1 = delstr(str,1,p)
  101.   else ret1 = str
  102.   p = lastpos(':', ret1)
  103.   if p > 0 then retstr = delstr(ret1,1,p)
  104.   else retstr = ret1
  105. end
  106. else
  107.   retstr = str
  108. return retstr
  109.  
  110. /*
  111.  * Procedure to truncate long strings and add ellipsis (...) at the end
  112.  * Written by Robbie Akins
  113.  */
  114. TruncString: PROCEDURE
  115. parse arg trstr
  116. if length(trstr) > 60 then
  117.   rtnstr = trim(left(trstr, 60))||"..."
  118. else
  119.   rtnstr = trstr
  120. return rtnstr
  121.  
  122.