DigDeep Posted August 10, 2017 Share Posted August 10, 2017 I am facing an issue with one of my file to run properly. If I am using the way, even though I give RunWait, this gets completed within the Sleep time I am giving and it does not wait for the Player.exe process to exit and end up. due to which I am getting a false result because Splash message ends in 20 seconds and Player.exe still runs. Is there a way to get this in While loop or other way that the Splash should stay until Player.exe process is running or Splash goes off 10 seconds after the Process ends? SplashTextOn("Testing", "File Version Update", 480, 100, 10, 20, 16, "Verdana") $File = 'C:\Temp\Player.exe' RunWait(@ComSpec & ' /c "' & $File & '" /update', "", @SW_HIDE) Sleep(20000) SplashOff() I also tried as per below but it does not work. Select Case $PID = ProcessExists('player.exe') Select Case $PID = 0 SplashTextOn("Testing", "File Version Update", 480, 100, 10, 20, 16, "Arial") RunWait(@ComSpec & ' /c "' & $File & '" /update', "", @SW_HIDE) While $PID = 0 $PID = ProcessExists('player.exe') WEnd Sleep(20000) SplashOff() Case Else EndSelect EndSelect Link to comment Share on other sites More sharing options...
Neutro Posted August 10, 2017 Share Posted August 10, 2017 (edited) Hi @DigDeep, Look at the help file for the RunWait function: Quote Some programs will appear to return immediately even though they are still running; these programs spawn another process - you may be able to use the ProcessWaitClose() function to handle these cases. Try this: SplashTextOn("Testing", "File Version Update", 480, 100, 10, 20, 16, "Verdana") $File = 'C:\Temp\Player.exe' Run(@ComSpec & ' /c "' & $File & '" /update', "", @SW_HIDE) ProcessWaitClose("Player.exe") SplashOff() Edited August 10, 2017 by Neutro Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water! Link to comment Share on other sites More sharing options...
Trong Posted August 14, 2017 Share Posted August 14, 2017 Not need @ComSpec SplashTextOn("Please waiting....", "Application Updating....", 480, 60, -1, -1, 32) Global Const $FileExecute = @ProgramFilesDir & '\My Program Folder\MyApp.exe' Global Const $FileUpdater = @ProgramFilesDir & '\My Program Folder\MyUpdater.exe' Global Const $iUpdateCommandLine = '/update' Global Const $iVersion = FileGetVersion($FileExecute) RunWait('"' & $FileUpdater & '" ' & $iUpdateCommandLine, Null, @SW_HIDE) SplashOff() If FileGetVersion($FileExecute) <> $iVersion Then ConsoleWrite("Update OK!" & @CRLF) Else ConsoleWrite("Update ERROR!" & @CRLF) EndIf Regards, Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now