1 Screenshot

About This File

Hello Everyone :), Are you tired of searching the forum for getting both the exit code & the stdout output? Then your are in the right place!

Icon.thumb.png.2a778725e21a7b500ad144c11

With this UDF you can get the both output & exit code of the command or the console app! Or you can get the exit code of another process without having to use RunWait...

Features:

1. Simple & Lightweight (15 KB)

2. Detailed comments & description

3. Flexible functions with many optional parameters :)

A BIG THANKS TO PsaltyDS for the functions! 2 of the (main) functions in the UDF are his work :)

 

List of functions:

_Process_RunCommand: Runs a command or a executable

_Process_WaitUntil: Waits until a process starts or quits. Also returns the exit code...

_Process_GetPID: Gets the PID of the process using the name of the process

_Process_GetPath: Get the path of a process along with its arguments (if any)

_Process_GetHandle: Gets the handle of a process, will be used later to retrive the exit code

_Process_CloseHandle: Closes the Process Handle of a process

_Process_GetExitCode: Gets the exit code of a process

_Process_DebugRunCommand: Debugs a command in CMD style, see the example.


What's New in Version 1.3

Released

Added $PROCESS_DEBUG option

Changed Constant's values, they now are powers of 2 (for compatability with BitAND)

Changed _Process_RunCommand to accept $PROCESS_DEBUG, You can now debug directly using this function :)

Changed _Process_DebugRunCommand, Now you can resize it

 

Also some little cleanups ;)


2 people like this



User Feedback

You may only provide a review once you have downloaded the file.


Surya

  • 5
   1 of 1 member found this review helpful 1 / 1 member

Nice UDF

Share this review


Link to review
TheDcoder

· Edited by TheDcoder

  • 5
  


5 Stars, Please submit your reviews too :)

 

P.S Feel free to vote 3 stars :lol:

Share this review


Link to review
  • Similar Content

    • Eddi96
      Logoff users in CMD with ID
      By Eddi96
      Hey guys!
      I need your help again. So I am working on a Project with which I can Logoff a User in a Terminal-Server (Windows Server 2012 R2), logged in as Admin. Then backup the users partition and log him back in. Sounds pretty easy for you guys, right? So my problem is... I seem to not be able to get the User ID. You can see and display the ID in a textfile with:
      Run("query user>>c:\users\example\desktop\helpmeguys.txt") This line just writes a textfile of "query user" on the desktop. This is an example on what it looks like:
       BENUTZERNAME          SITZUNGSNAME       ID  STATUS  LEERLAUF   ANMELDEZEIT
      >wg                                  console                       2  Aktiv                     17    25.07.2016 08:19

      What I need right now is the ID. Any Idea on how to read it off of the Textfile?
      Please give me examples because I am still a rookie!
       
      With kind regards
      Eddi96
       
       
    • FMS
      Commandline function
      By FMS
      Hello,
      I've made a GUI that can send multiple commands.
      The way I'm doing this at the moment is whit "send" commands.
      also first go to the right directory where the "to be used" program sits
      And send from there the commandline argument whit parameters.
      Here is a example of the way I'm using it now:
      Func restart_app($xip) Run("C:\WINDOWS\system32\cmd.exe") WinWaitActive("C:\WINDOWS\system32\cmd.exe") Sleep(50) send("cd\" & "{ENTER}") Sleep(50) send("cd Tools" & "{ENTER}") Sleep(50) send("pskill \\" & $$xip & " -u username -p pass /accepteula app.exe" & "{ENTER}") EndFunc This way is working and I got no problems whit this.
      Also I realy think there is a mush better and way to do the same and maybe a little bit less error free
      (even better if this is hidden for the user :))
      On this forum I could not find anything related to this subject (or I was not looking in the right direction) and hope somebody knows a better way
      Is there a way where u can send the arguments and parameters directly in 1 line to the commandpromt whitout using "send" to commandprompt?
      Thanks in advanced

      ps: I also tried :
      ShellExecute("pskill", "\\" & $xip & " -u username -p pass /accepteula app.exe")

      But din't work
    • milky
      Dos to Word Application
      By milky
      Hello,
      I wrote a small AutoIt App which takes DOS formatted textfiles and forwards them to MS Word. I searched a lot for a programm which does this, but I didn't find one.
      The reason for it is an old DOS program, which is used a lot, even today. The user wanted to print the output of that programm with some other font-size, font-style and so on... We used WinPrint, but this is a printing only app, so no formatting can be done afterwards...
      The solution was, to print with the DOS prgramm to an file, e.g. C:\12345\output.txt ... then read this file, convert it to unicode, put this into word with some pre-defined font / page size and so on ... and then the user can re-format or print it now.
      Here is the main function of the Dos2Word programm I wrote:
      Func Convert2Word() ; keine datei da... If Not FileExists($sFilePath) Then Return ; noch in Beaarbeitung... If _WinAPI_FileInUse($sFilePath) Then Return ; nun aber... Local $sFilePathTemp = $sFilePath & "_" & _WinAPI_CreateGUID() & ".txt" FileMove($sFilePath, $sFilePathTemp, $FC_OVERWRITE) ; open word and create new document Local $oWord = _Word_Create() If @error Then ErrorExit("Fehler bei _Word_Create()") Local $oDoc = _Word_DocAdd($oWord) If @error Then ErrorExit("Fehler bei _Word_DocAdd()") ; seite definieren With $oDoc.PageSetup .PageHeight = $sPageHeight .PageWidth = $sPageWidth .TopMargin = $sTopMargin .BottomMargin = $sBottomMargin .LeftMargin = $sLeftMargin .RightMargin = $sRightMargin EndWith ; schrift und absatz With $oDoc.Range .Font.Name = $sFontName .Font.Size = $sFontSize EndWith With $oDoc.Range.ParagraphFormat .SpaceBefore = 0 .SpaceAfter = 0 .LineUnitBefore = 0 .LineUnitAfter = 0 .LineSpacingRule = 0 EndWith Local $hFile = FileOpen($sFilePathTemp, BitOR($FO_READ, $FO_BINARY)) Local $iError Local $iLine = 1 Do Local $sLine = FileReadLine($hFile, $iLine) $iError = @error $iLine += 1 ; ignore special escape line of cm.exe If StringLeft($sLine, 2) = Chr(27) & Chr(64) Then $sLine = StringTrimLeft($sLine, 2) $oDoc.Range.insertAfter(_WinAPI_MultiByteToWideChar($sLine, $sCodePage, 0, True) & @CRLF) Until $iError <> 0 ; und am ende löschen, sofern gewünscht FileClose($hFile) If $sFilesDelete <> "0" Then FileDelete($sFilePathTemp) EndFunc ;==>Convert2Word The Homepage of the program is here: https://mcmilk.de/projects/Dos2Word/

      The full source code and precompild signed binaries for 32bit and 64bit systems are also there, the License is GPLv2
      With best regards, Milky
      Maybe someone finds it useful too
    • TheDcoder
      Is it a Good Idea?: $CmdLineRaw as a Macro
      By TheDcoder
      Hello! I am back with another IIAGI? (Is it a Good Idea?)
       
      I think $CmdLineRaw is more like a macro than a "special" variable (which cannot be changed)... So making ti @CmdLineRaw would make more sense and there will 1 less exception to variables , I know that you were wondering about the $CmdLine "special" array... I didn't forgot it, but I don't think a macro can be a array, so I just ignored it... Maybe removing the $CmdLine and changing $CmdLineRaw to @CmdLine would be nice if you ask me .
       
      Think before choosing! TD
       
      P.S Feel free to disagree with me, I want hear your opinion as well .
    • TheDcoder
      Process UDF, Get both the output & the exit code!
      By TheDcoder
      Hello Everyone , Are you tired of searching the forum for getting both the exit code & the stdout output? Then you are in the right place!

      With this UDF you can get the both output & exit code of the command or the console app! Or you can get the exit code of another process without having to use RunWait...
      Features:
      1. Simple & Lightweight (15 KB)
      2. Detailed comments & description
      3. Flexible functions with many optional parameters
      A BIG THANKS TO PsaltyDS for the functions! 2 of the (main) functions in the UDF are his work
       
      List of functions:
      Downloads:

      Version Archive - Google Drive
       
      Hope it may help you, TD
       
      P.S Icon made by Freepik from www.flaticon.com, Modified by TheDcoder