Jump to content

Runwait exists when process still runs


Recommended Posts

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

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 by Neutro
Link to comment
Share on other sites

Not need @ComSpec :lol:

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...