View Full Version : Waiting for exe to process

03 March 2009, 12:42 PM

Is there a way to call an external Exe file and wait for it to finish?
Right now I use ShellLaunch but that will instantly skip to the next line of code and I need to wait for some files to be created.

Any ideas?

03 March 2009, 01:16 PM
DOSCommand ?

That will wait for the application to exit and returns the exit code ( error level ) of the app.

03 March 2009, 03:50 PM
I've been using dotnet for this kind of stuff, as it gives the ability to check whether the process is over or not, but if DOSCommand can wait, then maybe its the right solution


local comandLine = ( "a -afzip -m5 -ep -dh " + "\"" + zipFileFull + "\"" + filesStr )

local winrarPath = "C:\\Program Files\\WinRAR\\WinRAR.exe"
local n_startInfo = dotnetobject "System.Diagnostics.ProcessStartInfo" winrarPath

n_startInfo.Arguments = comandLine
n_startInfo.CreateNoWindow = true

local n_process = dotnetclass "System.Diagnostics.Process"

local winrarProcess = undefined
try (
winrarProcess = n_process.Start n_startInfo
catch (
print "error launching winrar "
return false

-- sleep while winrar is zipping
do ( sleep 1 )
while ( not winrarProcess.HasExited )

-- error code returned
if not ( winrarProcess.ExitCode == 0 ) then (

print "zipping was not successful"
return false

-- close process


03 March 2009, 07:23 PM
if these files are bitmapFiles you could simply use a 32bpp dummyFile wich you copy to the new Location with name and extention and then overwrite with the new bitmap. this way you don't have to wait and can let the >process< work in the background

CGTalk Moderation
03 March 2009, 07:23 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.