Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for defprn2.rex

(view source code of defprn2.rex as plain text)

  1. /* Check for command line arguments (none required) */
  2. If Arg( 1, "E" ) Then Call Syntax
  3.  
  4. /* Initialize W32Funcs */
  5. Call RxFuncAdd "w32loadfuncs", "W32Util", "w32loadfuncs"
  6. Call w32loadfuncs
  7.  
  8. /* Read default printer and port from registry */
  9. handle  = w32RegOpenKey( "HKEY_CURRENT_USER", "Printers" )
  10. printer = w32RegQueryValue( handle, "DeviceOld" )
  11. Call w32RegCloseKey handle
  12.  
  13. /* Parse printer name and port from registry string */
  14. Parse Value printer With defprn",".","defport":".
  15.  
  16. /* Display the result */
  17. Say
  18. Say "Default printer is "||defprn||" on "||defport
  19.  
  20. /* Normal program termination */
  21. Exit 0
  22.  
  23.  
  24. Syntax:
  25. 	Say
  26. 	Say "DefPrn.rex,  Version 2.00 for Windows"
  27. 	Say "Display default printer name and port"
  28. 	Say
  29. 	Say "Usage:  <REXX>  DEFPRN.REX"
  30. 	Say
  31. 	Say 'Where:  "<REXX>" is your Rexx interpreter, like REGINA.EXE'
  32. 	Say "                 or REXX.EXE, whichever is installed"
  33. 	Say
  34. 	Say "This script uses Patrick McPhee's W32Funcs library"
  35. 	Say "http://www.interlog.com/~ptjm/"
  36. 	Say
  37. 	Say "Written by Rob van der Woude"
  38. 	Say "http://www.robvanderwoude.com"
  39. 	Exit 1
  40. Return
  41.  

page last modified: 2024-04-16; loaded in 0.0091 seconds