Quantcast
Channel: AutoIt v3 - Developer Chat
Viewing all articles
Browse latest Browse all 750

Run / RunWait and Exit Codes

$
0
0

Just a small question for the learned masses if i may

 

I have a script that uses command line to access Winrar and MultiPar and ive run into this scenario

 

I currently use RunWait like this

$ProcessPID = RunWait(@ComSpec & ' /c ' & @TempDir & '\Sup\par2j.exe' & ' r ' & '"' & $aParFile[$i] & '"', "", @SW_HIDE)

and then i access $ProcessPID for all the exit codes of which there are many to provide error support for all the command programs i am using.

 

So i made all the script, then i realised that i couldn't cancel the process and further investigation it looks like i will have to completely rewrite to be able to halt the process

and use Run to be able to do it.

 

The downside is i lose all that error support built in to the programs as i cant access it from Run

and only give basic support like this

                ProcessWait($ProcessPID)                 $sOutput = ""                 While 1                     $sOutput = StdoutRead($ProcessPID)                     If StringInStr($sOutput, "Password", 2) > 0 Then ; Monitoring Window for specific text during test process                         MsgBox(64, "Password Error", "Archive Is Passworded")                         Exit                     ElseIf StringInStr($sOutput, "No files extracted", 2) > 0 Then ; Monitoring Window for specific text during test process                         MsgBox(64, "Archive Error", "Archive Extraction Failed")                         Exit                     EndIf                 WEnd

This is a shame because the support is already there and i cant access it.

 

So the question i would like to ask is..

 

Can Run be made to return the $PID and if you set a flag then it returns the exit codes from the programs?

 

There probably is a horrendously complicated answer but i would interested to hear why or why not.

 

Thanks for your time


Viewing all articles
Browse latest Browse all 750

Latest Images

Trending Articles



Latest Images