home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 568a.lha / APIG_v1.1 / e19_preferences.rexx < prev    next >
OS/2 REXX Batch file  |  1991-09-28  |  6KB  |  166 lines

  1.  
  2. /* example using Intuition GETPREFS, see Intuition RKM for offsets */
  3.  
  4.  x = addlib('apig.library',0,-30,0)
  5.  
  6.  call set_apig_globals()
  7.  
  8.  prefs = allocmem(232)    /* allocate memory to hold preferences data */
  9.  
  10.  x = getprefs(prefs,232)  /* x = getdefprefs(prefs,232) */ 
  11.  
  12.  
  13.  /* CONSULT RKM's FOR OFFSETS USED IN GETVALUE() CALLS */
  14.  
  15.  call writeln(stdout,'0a'x "These are your Current Preferences Settings")
  16.  
  17.  fontheight   = GETVALUE(prefs,0,1,'n')
  18.  
  19.  call writeln(stdout,'0a0a'x"Font Height = " fontheight '0a'x)
  20.  
  21.  printerport  = GETVALUE(prefs,1,1,'n')
  22.  call writech(stdout,"Printer Port = ")
  23.  if printerport = 0 then 
  24.     call writeln(stdout,"PARALLEL" '0a'x)
  25.  else
  26.     if printerport = 1 then
  27.        call writeln(stdout,"SERIAL" '0a'x)
  28.  
  29.   
  30.  baudrate     = GETVALUE(prefs,2,2,'n')
  31.  call writech(stdout,"Baud Rate = ")
  32.  select 
  33.      when baudrate = 0 then call writeln(stdout,"BAUD_110" '0a'x)
  34.      when baudrate = 1 then call writeln(stdout,"BAUD_300" '0a'x)
  35.      when baudrate = 2 then call writeln(stdout,"BAUD_1200" '0a'x)
  36.      when baudrate = 3 then call writeln(stdout,"BAUD_2400" '0a'x)
  37.      when baudrate = 4 then call writeln(stdout,"BAUD_4800" '0a'x)
  38.      when baudrate = 5 then call writeln(stdout,"BAUD_9600" '0a'x)
  39.      when baudrate = 6 then call writeln(stdout,"BAUD_19200" '0a'x)
  40.      when baudrate = 7 then call writeln(stdout,"BAUD_MIDI" '0a'x)
  41.      otherwise nop
  42.  end
  43.  
  44.  keyrptspeed1 = GETVALUE(prefs,4,4,'n')
  45.  
  46.  keyrptspeed2 = GETVALUE(prefs,8,4,'n')
  47.  
  48.  keyrptdelay1 = GETVALUE(prefs,12,4,'n')
  49.  
  50.  keyrptdelay2 = GETVALUE(prefs,16,4,'n')
  51.  
  52.  doubleclick1 = GETVALUE(prefs,20,4,'n')
  53.  
  54.  doubleclick2 = GETVALUE(prefs,24,4,'n')
  55.  
  56.  enablecli    = GETVALUE(prefs,124,2,'n')
  57.  call writech(stdout,"Enable CLI = ")
  58.  if enablecli = 0 then call writeln(stdout,"OFF" '0a'x)
  59.  else call writeln(stdout,"ON" '0a'x)
  60.  
  61.  printertype  = GETVALUE(prefs,126,2,'n')
  62.  call writech(stdout,"Printer Type = ")
  63.  select 
  64.      when printertype = 0 then call writeln(stdout,"CUSTOM_NAME" '0a'x)
  65.      when printertype = 1 then call writeln(stdout,"ALPHA_P_101" '0a'x)
  66.      when printertype = 2 then call writeln(stdout,"BROTHER_15XL" '0a'x)
  67.      when printertype = 3 then call writeln(stdout,"CBM_MPS1000" '0a'x)
  68.      when printertype = 4 then call writeln(stdout,"DIAB_630" '0a'x)
  69.      when printertype = 5 then call writeln(stdout,"DIAB_ADV_D25" '0a'x)
  70.      when printertype = 6 then call writeln(stdout,"DIAB_C_150" '0a'x)
  71.      when printertype = 7 then call writeln(stdout,"EPSON" '0a'x)
  72.      when printertype = 8 then call writeln(stdout,"EPSON_JX_80" '0a'x)
  73.      when printertype = 9 then call writeln(stdout,"OKIMATE_20" '0a'x)
  74.      when printertype = 10 then call writeln(stdout,"QUME_LP_20" '0a'x)
  75.      when printertype = 11 then call writeln(stdout,"HP_LASERJET" '0a'x)
  76.      when printertype = 12 then call writeln(stdout,"HP_LASERJET_PLUS" '0a'x)
  77.      otherwise nop
  78.  end
  79.  
  80.  /* note below how the printer name is gotten                              *
  81.   * prtname = GETVALUE(prefs,128,4,'s') WILL NOT WORK, since the contents  *
  82.                                         at offset 128 is not a pointer     */
  83.  
  84.  /* instead create a pointer to prtname, and use IMPORT() to create & copy *
  85.     it into an ARexx string variable                                       */
  86.  
  87.  prtnamebuf   = d2c((c2d(prefs) + 128),4) /* create pointer to name buf     */
  88.  prtname      = import(prtnamebuf)        /* import data from buf into strg */
  89.  call writeln(stdout,"Printer Name = " prtname '0a'x)
  90.  
  91.  prtpitch     = GETVALUE(prefs,158,2,'n')
  92.  call writech(stdout,"Print Pitch = ")
  93.  select
  94.      when prtpitch = 0 then call writeln(stdout,"PICA" '0a'x)
  95.      when prtpitch = c2d('0400'x) then call writeln(stdout,"ELITE" '0a'x)
  96.      when prtpitch = c2d('0800'x) then call writeln(stdout,"FINE" '0a'x)
  97.      otherwise nop
  98.  end
  99.  
  100.  prtquality   = GETVALUE(prefs,160,2,'n')
  101.  call writech(stdout,"Print Quality = ")
  102.  select 
  103.      when prtquality = 0 then call writeln(stdout,"DRAFT" '0a'x )
  104.      when prtquality = c2d('0100'x) then call writeln(stdout,"LETTER" '0a'x)
  105.      otherwise nop
  106.  end
  107.  
  108.  
  109.  prtspacing   = GETVALUE(prefs,162,2,'n')
  110.  call writech(stdout,"Print Spacing = ")
  111.  if prtspacing = 0 then call writeln(stdout,"SIX_LPI" '0a'x)
  112.  else
  113.     if prtspacing = c2d('0200'x) then call writeln(stdout,"EIGHT_LPI" '0a'x)
  114.  
  115.  prtleftmar   = GETVALUE(prefs,164,2,'n')
  116.  call writeln(stdout,"Left Print Margin = " prtleftmar '0a'x)
  117.  
  118.  
  119.  prtrightmar  = GETVALUE(prefs,166,2,'n')
  120.  call writeln(stdout,"Right Print Margin = " prtrightmar '0a'x)
  121.  
  122.  
  123.  papersize    = GETVALUE(prefs,176,2,'n')
  124.  call writech(stdout,"Paper Size = ")
  125.  select 
  126.      when papersize = 0 then call writeln(stdout,"US_LETTER" '0a'x)
  127.      when papersize = 16 then call writeln(stdout,"US_LEGAL" '0a'x)
  128.      when papersize = 32 then call writeln(stdout,"NARROW TRACTOR" '0a'x)
  129.      when papersize = 48 then call writeln(stdout,"WIDE TRACTOR" '0a'x)
  130.      when papersize = 64 then call writeln(stdout,"CUSTOM" '0a'x)
  131.      otherwise nop
  132.  end
  133.  
  134.  paperlen     = GETVALUE(prefs,178,2,'n')
  135.  call writeln(stdout,"Paper Length = " paperlen '0a'x)
  136.  
  137.  papertype    = GETVALUE(prefs,180,2,'n')
  138.  call writech(stdout,"Paper Type = ")
  139.  if papertype = 0 then call writeln(stdout,"FANFOLD" '0a'x)
  140.  else
  141.      if papertype = 128 then call writeln(stdout,"LETTER" '0a'x)
  142.  
  143.  
  144.  lacewb       = GETVALUE(prefs,185,1,'n')
  145.  call writech(stdout,"LACE WB = " )
  146.  if lacewb = 1 then call writeln(stdout,"ON" '0a'x)
  147.  else call writeln(stdout,"OFF" '0a'x)
  148.  
  149.  
  150.  call freemem(prefs,232)
  151.  
  152. /* -------------------------------------------------------------------  */
  153.  
  154.   screendata = allocmem(346)
  155.  
  156.   x = getscreendata(screendata,346,WBENCHSCREEN,0)
  157.  
  158.   say "WorkBench Screen Width  = " GETVALUE(screendata,12,2,'n')
  159.   say "WorkBench Screen Height = " GETVALUE(screendata,14,2,'n')
  160.   say "WorkBench Screen Title  = " GETVALUE(screendata,22,4,'s')
  161.  
  162.   call freemem(screendata,346)
  163.  
  164.  exit
  165.  
  166.