home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / keybusbr.zip / KeybUSBR.CMD < prev    next >
OS/2 REXX Batch file  |  1999-07-21  |  4KB  |  76 lines

  1. /* KeybUSBR - switches between US and BR 274 keyboards
  2.  
  3.    Use it if you like it. Don't if you don't. No legalese.
  4.  
  5.    (c) 1999 Marcus C. de Geus
  6.             marcus@degeus.com
  7.             http://www.degeus.com
  8.  
  9.    **************************************************/
  10.  
  11.  
  12. signal on Halt                                                                   /* handle halt condition */
  13.  
  14. if (\LoadREXXUtils()) then                                                       /* if we cannot load the REXX utilities */
  15. do
  16.  call Halt                                                                       /* quit */
  17. end
  18.  
  19. parse source . . ProgSpec                                                        /* get ProgSpec */
  20. SourceDir = filespec('D',ProgSpec)||filespec('P',ProgSpec)                       /* the source directory name */
  21.  
  22. QueueName = rxqueue('CREATE')                                                    /* get a queue name */
  23. call rxqueue 'SET',QueueName                                                     /* prepare the queue */
  24.  
  25. 'keyb | rxqueue '||QueueName                                                     /* call KEYB and send the output to the queue */
  26.  
  27. parse pull  . . . Keyboard                                                       /* get the data we want */
  28. call rxqueue 'DELETE',QueueName                                                  /* get rid of the queue */
  29.  
  30. if (Keyboard = 'BR.') then                                                       /* if we have a BR keyboard */
  31. do
  32.  'keyb US'                                                                       /* switch to the US keyboard */
  33.  call syssetobjectdata '<KEYB_US_BR274>','ICONFILE='||SourceDir||'keybisus.ico'  /* and change the icon */
  34. end
  35. else                                                                             /* if we've got a US keyboard */
  36. do
  37.  'keyb BR 274'                                                                   /* switch to the Brazilian keyboard */
  38.  call syssetobjectdata '<KEYB_US_BR274>','ICONFILE='||SourceDir||'keybisbr.ico'  /* and change the icon */
  39. end
  40.  
  41. call Halt                                                                        /* quit */
  42.  
  43.  
  44. /***************************************************************/
  45.  
  46. LoadREXXUtils: procedure                                                         /* loads the REXX utilities library */
  47.  
  48. Result = 1                                                                       /* start with a good result */
  49.  
  50. if rxfuncquery('SysLoadFuncs') then                                              /* if it is not already loaded */
  51. do
  52.  if (rxfuncadd('SysLoadFuncs','RexxUtil','SysLoadFuncs') >< 0) then              /* if we cannot add it */
  53.  do
  54.   call beep 333,333                                                              /* signal */
  55.   say 'Error : Cannot register Rexx Utilities library'                           /* report */
  56.   Result = 0                                                                     /* bad result */
  57.  end
  58.  else                                                                            /* if we can add it */
  59.  do
  60.   if (SysLoadFuncs() = 0) then                                                   /* if we cannot load it */
  61.   do
  62.    say 'Error : Cannot load Rexx Utilities library'                              /* report */
  63.    Result = 0                                                                    /* bad result */
  64.   end
  65.  end
  66. end
  67.  
  68. return Result                                                                    /* end of LoadREXXUtils */
  69.  
  70.  
  71. /***************************************************************/
  72.  
  73. Halt:                                                                            /* handle halt condition */
  74.  
  75. exit                                                                             /* that's all, folks! */
  76.