Jump to content

Help showing a success/failure message


Go to solution Solved by JLogan3o13,

Recommended Posts

Hi Everyone,

I am using the RunWait command to install a program and would like to pop up a message box based on whether or not the program installed successfully.  What's the best way to do this?  I was thinking about using a select case statement based on the return value of the RunWait command (return value of 0 = install failed, return value of not 0 = install succeeded).  If this will work how do I capture the return value of the RunWait command to use in my select case statement?  I'm sure others have done something like this but couldn't find anything in the forums.  I may be just too ignorant to know what keywords to use in my search.  I greatly appreciate any help!

Link to comment
Share on other sites

  • Moderators
  • Solution

You can always do a simple If statement:

RunWait("MyApp.exe")
   If Not @error Then MsgBox(0, "", "Success!")

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Checking the exit code of the run command is a good start. If it were me, I would check the file size of the main exe I was installing, then compare it against the actual size which I hardcode. Something like:

$iFileSize = 1024 ; or whatever the size is returned by (FileGetSize / 1024) 
RunWait("MyApp.exe")
If Not @error Then 
    If (FileGetSize("PathToMainExe.exe")/1024) = $iFileSize Then
        MsgBox(0, "", "Istallation success!")
    Else
        MsgBox(16, "Error", "Install failed.")
    EndIf
EndIf
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...