Jump to content

Recommended Posts

Hello, I wonder why PSlist waits for some input even when it has finished already?

If I run it like this
pslist.exe -s 2
in task manager mode for 2 seconds (so I have the CPU load numbers for processes) it never ends unless a key is pressed. This is useless if I want to call it from another script and have output in a file like this
pslist.exe -s 2 >procs.txt
because it never finishes! Anybody has an idea if anything else can be done except killing a process after some time?
Edited by Briefmich
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By TheAutomator
      Hi everyone  ,
      i'm trying to make some sort of full screen console window where some of the text must be non-editable like windows CMD.exe.
      Text already typed before pressing enter or the working folder 'C:\...>' is read only in CMD.exe and I want to know if mimicking this behavior in an edit control is possible.
       
      My attempt to make a console makes all the [A-Za-z0-9] keys a hotkey and the main edit control is set to read only.
      Every time the user types something the hotkey function is triggered, the cursor in the edit control is set to the end of the text and the character you typed is added to the edit.
      If you try to press the {backspace} key when you are at the edge of some text that is read only nothing happens.
       
      This works but I guess it is not the best or most clean way to make something like this..
      Can someone give me some advice or help me make a better function for having full control over text in the edit control?
       
      kind regards, 
      TheAutomator
       
      #include <GuiEdit.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form = GUICreate("Console", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $DS_SETFOREGROUND), $WS_EX_TOPMOST) GUISetBkColor(0x000000) $Console = GUICtrlCreateEdit('Loading...', 32, 32, @DesktopWidth-15, @DesktopHeight - 64, BitOR($ES_READONLY,$WS_VSCROLL), 0) GUICtrlSetFont(-1, 28, 400, 0, 'OCR A Extended') GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetCursor (-1, 2) _GUICtrlEdit_SetMargins( -1, $EC_RIGHTMARGIN, Default, 49) GUISetState(@SW_SHOW) ;################################################################################################################## Global $keys = 'abcdefghijklmnopqrstuvwxyz _ABCDEFGHIJKLMNOPQRSTUVWXYZ' ;################################################################################################################## For $_ = 1 To StringLen($keys) HotKeySet( StringMid($keys,$_,1), 'keypress') Next For $_ = 0 To 9 HotKeySet($_, 'keypress') HotKeySet('{numpad'&$_&'}', 'keypress') Next HotKeySet('{bs}','Keypress') HotKeySet('{enter}','Enter') _GUICtrlEdit_AppendText($Console, @CRLF&'Type a command:') $MIN = StringLen(GUICtrlRead($Console)) + 1 $MAX = $MIN ;################################################################################################################## Func Keypress() Local $key = @HotKeyPressed If StringLen($key) = 1 Then _GUICtrlEdit_AppendText($Console, $key) $MAX += 1 ElseIf StringRegExp($key,'\{numpad[0-9]\}') Then _GUICtrlEdit_AppendText($Console, StringMid($key,8,1)) $MAX += 1 ElseIf $key = '{bs}' Then If $max = $min then Return Else Local $len = StringLen(GUICtrlRead($Console)) _GUICtrlEdit_SetSel($Console, $len - 1, $len) _GUICtrlEdit_ReplaceSel($Console, '') $MAX -= 1 EndIf EndIf EndFunc Func Enter();handle typed commands when ENTER is pressed: Switch StringStripWS(StringLower(StringMid(GUICtrlRead($Console),$min,$max)),8) Case '' Beep(1000,50) Case 'clear' GUICtrlSetData($Console,'Command:') $MIN = StringLen(GUICtrlRead($Console)) + 1 $MAX = $MIN Return Case 'quit' Quit() Case Else _GUICtrlEdit_AppendText($Console, @CRLF&@TAB&'Unknown command!') EndSwitch _GUICtrlEdit_AppendText($Console, @CRLF&'Type a command:') $MIN = StringLen(GUICtrlRead($Console)) + 1 $MAX = $MIN EndFunc ;============================================================= Func Quit() _GUICtrlEdit_AppendText($Console, @CRLF&@TAB&'Goodbye...') Sleep(1500) Exit EndFunc While True If GUIGetMsg() = $GUI_EVENT_CLOSE Then Quit() EndIf WEnd
×
×
  • Create New...