Jump to content

Recommended Posts

Posted (edited)

My friends want to run an exe file and then close it, but the program does not shut down.

$aOpenFiles = FileOpenDialog("", @ProgramFilesDir & "\", "Exe File (*.exe)", 3)
If @error Then
    ConsoleWrite("No select" & @CRLF)
Else
ConsoleWrite("Ok. select" & @CRLF)
EndIf

$RunCount = 2

For $i = 1 To $RunCount
$aRunw = RunWait($aOpenFiles)
Sleep(500)
ProcessWaitClose($aRunw)
Sleep(100)
Next

 

Edited by youtuber
Posted (edited)

RunWait returns the exit code, not the PID.  You just need that on it's own, without the sleeps or ProcessWaitClose...or change RunWait to Run.  Some processes also spawn additional processes, so you might have to get, and then wait, for that PID, but that's probably not the case here.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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.
×
×
  • Create New...