home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sysset12.zip / setting.cmd < prev    next >
OS/2 REXX Batch file  |  2000-06-02  |  1KB  |  60 lines

  1. /**/
  2. call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  3. call SysLoadFuncs
  4. parse arg object setting loword hiword .
  5. parse upper var loword loword
  6. if object = '' | setting = '' then do
  7.   say
  8.   say 'Usage: SETTING object setting [loword] [hiword]'
  9.   return
  10. end
  11. sysset = '<SYSSET>'
  12. object = '<'object'>'
  13. inikey = setting
  14. select
  15.   when loword = 'ON' then
  16.     num = 1
  17.   when loword = 'OFF' then
  18.     num = 0
  19.   otherwise
  20.     num = loword
  21. end
  22. if hiword \= '' then
  23.   num = 65536 * hiword + num
  24. setup = 'SETOBJECT='object';SETPARAM='setting
  25. call querysetting
  26. if loword \= '' then do
  27.   call setsetting
  28.   call querysetting
  29. end
  30. return
  31.  
  32. querysetting:
  33.   call charout , 'Querying' setting 'state: '
  34.   if SysSetObjectData(sysset, setup';QUERYVAL='inikey) \= 0 then do
  35.     oldnum = strip(SysIni('USER', 'Sysset', inikey), , d2c(0))
  36.     call SysIni 'USER', 'Sysset', inikey, 'DELETE:'
  37.     oldhiword = oldnum % 65536
  38.     oldloword = oldnum // 65536
  39.     if oldhiword \= 0 then
  40.       call charout , oldhiword':'
  41.     select
  42.       when oldloword = 1 then
  43.         say '1 (ON)'
  44.       when oldloword = 0 then
  45.         say '0 (OFF)'
  46.       otherwise
  47.         say oldloword
  48.     end
  49.   end; else
  50.     say 'Failure'
  51.   return
  52.  
  53. setsetting:
  54.   call charout , 'Setting' setting 'to' num': '
  55.   if SysSetObjectData(sysset, setup';SETVAL='num) \= 0 then
  56.     say 'Success'
  57.   else
  58.     say 'Failure'
  59.   return
  60.