Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for listobj.cmd

(view source code of listobj.cmd as plain text)

  1. /* ListObj  version 1.2             */
  2. /* List all WPS object names        */
  3. /* (C) 1997-1999, Rob van der Woude */
  4. /* Latest revision 1999/03/13       */
  5.  
  6. /* Initialize RexxUtil if necessary */
  7. if RxFuncQuery( "SysLoadFuncs" ) <> 0 then do
  8. 	call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  9. 	call SysLoadFuncs
  10. end
  11.  
  12. /* Initialize RexxLib if necessary and if available */
  13. if RxFuncQuery( "RexxLibRegister" ) = 0 then do
  14. 	rexxlib = 1
  15. end
  16. else do
  17. 	rexxlib = 0
  18. 	call RxFuncAdd "RexxLibRegister", "RexxLib", "RexxLibRegister"
  19. 	call RexxLibRegister
  20. 	if RxFuncQuery( "RexxLibRegister" ) = 0 then rexxlib = 1
  21. end
  22.  
  23. /* Check for /P (pause) command line parameter */
  24. parse upper arg "/"option .
  25. if option = "?" then call Syntax
  26. pause = 0
  27. if left( option, 1 ) = "P" then pause = 1
  28.  
  29. /* Check text screen size and position cursor if necessary */
  30. parse value SysTextScreenSize( ) with rows cols
  31. parse value SysCurPos( ) with x y
  32. if x = rows - 1 then do
  33. 	x = rows - 2
  34. 	call SysCurPos x, 0
  35. end
  36.  
  37. /* Read a list of objects from OS2.INI */
  38. call SysIni "USER", "PM_Workplace:Location", "ALL:", "object."
  39.  
  40. /* Sort the list if RexxLib is available */
  41. if rexxlib = 1 then call ArraySort "object."
  42.  
  43. /* Display the formated list on screen */
  44. call SysCls
  45. say
  46. say " "||object.0||" WPS Objects:"
  47. say
  48. j = 0
  49. do i = 1 to object.0
  50. 	say "   "||object.i
  51. 	j = j + 1
  52. 	/* Pause at full screen */
  53. 	if pause = 1 & j = rows - 6 then do
  54. 		call AnyKey
  55. 		j = 0
  56. 	end
  57. end
  58.  
  59. /* Pause at the end if there was anything */
  60. /* left to display after the last pause   */
  61. if pause = 1 & j > 0 then call AnyKey "End"
  62.  
  63. EXIT
  64.  
  65.  
  66. /* Pause at full screen */
  67. AnyKey: procedure expose object.
  68. 	say
  69. 	say " Press any key . . ."
  70. 	call SysCurState "OFF"
  71. 	answer = translate( SysGetKey( "NOECHO" ) )
  72. 	if translate( arg( 1 ) ) <> "END" then do
  73. 		call SysCls
  74. 		say
  75. 		say " "||object.0||" WPS Objects:"
  76. 		say
  77. 	end
  78. return answer
  79.  
  80.  
  81. /* Display help */
  82. Syntax: procedure
  83. 	call SysCls
  84. 	say
  85. 	say " ListObj  Version 1.2"
  86. 	say " Display all WorkPlace Shell object names"
  87. 	say
  88. 	say " (C) 1997-1999, Rob van der Woude"
  89. 	say
  90. 	say
  91. 	say " Usage:  LISTOBJ  [ /P | /? ]"
  92. 	say
  93. 	say "         /P       pause at full screen"
  94. 	say "         /?       display this help screen"
  95. 	exit
  96. return
  97.  

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