Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for tasklist.cmd

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

  1. /*
  2.  浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様
  3.    TaskList                                          last update: 31/07/99  
  4.    (C) 1997 - 1999, Rob van der Woude                                       
  5.    Shows program names and types as OS/2's Tasklist does.                   
  6.    May be redirected to file or any standard input.                         
  7.    Use /? parameter to show help screen.                                    
  8.    Use /A parameter to show "All" active processes.                         
  9.    Use /C parameter to show "all" in Continuous output.                     
  10.  藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様
  11. */
  12.  
  13. /* Initialize RexxUtil */
  14. call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  15. call SysLoadFuncs
  16.  
  17. if left( strip( strip( translate( arg( 1 ) ) ), "L", "/" ), 1 ) = "?" then do
  18. 	call SysCls
  19. 	say ""
  20. 	say " TaskList"
  21. 	say "   displays a list of active programs"
  22. 	say ""
  23. 	say " Usage:"
  24. 	say "   TASKLIST [ /All | /Continuous ]"
  25. 	say ""
  26. 	say " The /A option will also display otherwise invisible processes."
  27. 	say " The /C option will do the same AND pause after each screen."
  28. 	say ""
  29. 	say " Press any key . . ."
  30. 	call SysCurState "OFF"
  31. 	call SysGetKey "NOECHO"
  32. 	exit
  33. end
  34.  
  35. /* Initialize RexxLib */
  36. call RxFuncAdd "RexxLibRegister", "RexxLib", "RexxLibRegister"
  37. call RexxLibRegister
  38.  
  39. /* Definities */
  40. progtype.  = ""
  41. ptype.0    = 7
  42. ptype.1    = "OS/2 full screen"
  43. ptype.2    = "OS/2 window"
  44. ptype.3    = "PM"
  45. ptype.4    = "DOS or Win-OS/2 full screen"
  46. ptype.5    = "unknown"
  47. ptype.6    = "unknown"
  48. ptype.7    = "DOS or Win-OS/2 window"
  49. all        = 0
  50. if left( strip( strip( translate( arg( 1 ) ) ), "L", "/" ), 1 ) = "A" then do
  51. 	all = 1
  52. end
  53. continuous = 0
  54. if left( strip( strip( translate( arg( 1 ) ) ), "L", "/" ), 1 ) = "C" then do
  55. 	continuous = 1
  56. 	all        = 1
  57. end
  58.  
  59. /* Find active processes */
  60. call DosSwitchList "progtitle.", , , , "progtype.", "progvisible."
  61. if progtitle.0 > 0 then do
  62. 	call SysCls
  63. 	screentitle = " Active programs:                                          "||date( "E" )||"    "||time( "N" )
  64. 	say screentitle
  65. 	say ""
  66. 	i = 0
  67. 	do j = 1 to progtitle.0
  68. 		if progvisible.j = 4 | all = 1 then do
  69. 			i = i + 1
  70. 			say "   Programma description   :  "||progtitle.j
  71. 			type  = progtype.j
  72. 			ctype = ptype.type
  73. 			if type = 0 then ctype = "System"
  74. 			if progvisible.j <> 4 then ctype = "System"
  75. 			say "   Program type            :  "||ctype
  76. 			say ""
  77. 			if i = 7 & continuous = 0 then do
  78. 				say " Press any key . . ."
  79. 				call SysCurState "OFF"
  80. 				call SysGetKey "NOECHO"
  81. 				call SysCls
  82. 				say screentitle
  83. 				say ""
  84. 				i = 0
  85. 			end
  86. 		end
  87. 	end
  88. 	if i > 0 & continuous = 0 then do
  89. 		call SysCurPos 23, 0
  90. 		say " Druk op een toets . . ."
  91. 		call SysCurState "OFF"
  92. 		call SysGetKey "NOECHO"
  93. 	end
  94. end
  95.  

page last uploaded: 2017-07-06, 12:37