home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / EDGE1_704.DMS / in.adf / Edge_Rexx.lha / LearnToKey.edge < prev    next >
Encoding:
Text File  |  1993-10-27  |  797 b   |  45 lines

  1. /*
  2. ** $VER: LearnToKey.edge 1.0 (Thursday 30-Sep-93 19:49:49)
  3. **
  4. ** Record and bind to a key a macro named as the key.
  5. **
  6. ** Written by Thomas liljetoft
  7. */
  8.  
  9.  
  10. options results
  11.  
  12. /* get users error report level */
  13. 'getenvvar' _ge_errlevel
  14. errlevel = result
  15.  
  16. 'requestkey'        /* get key sequence */
  17.  
  18. if RC = 0 then
  19.     do
  20.     parse var result 'KEY="' key '" Q="' qual '" QM="' qualmask '"'
  21.  
  22.     /* remove all spaces and create a filename */
  23.  
  24.     filename = key"_"compress(qual)"_"compress(qualmask)
  25.  
  26.     /* add the key with the filename as the command, in ram: */
  27.  
  28.     keyboard '"'key'"' Q '"'qual'"' QM '"'qualmask'"' '"ram:'filename'"'
  29.  
  30.     if RC = 0 then
  31.         do
  32.  
  33.         /* if the key was succesfully added, start learning */
  34.         learn '"ram:'filename'"'
  35.         
  36.         end
  37.  
  38.     end
  39.  
  40. if RC >= errlevel then
  41.     do
  42.     fault
  43.     requestnotify result
  44.     end
  45.