Jump to content

Process Tree termination.


Testy
 Share

Recommended Posts

Hi guys,

I have one that has me stumped. It will not run "Run("C:\AMFAM\SOFSTAGE\sofstage.exe update prod reconfig")" after killing the SOFSTAGE.EXE I see a second instance pop up but it goes away.

Case $Button3r1
    MsgBox(8192, "PC Reconfig", "Running C:\AMFAM\SOFSTAGE\sofstage.exe update prod", 10)
    Run("C:\AMFAM\SOFSTAGE\sofstage.exe update prod")
    WinWaitActive("AmFam PC")
    MsgBox(8192, "Error Check", "The reconfig will close and restart; Stopping the Sofstage Process tree", 10)
    _EndTree("SOFSTAGE.EXE")
    sleep(120)
    Run("C:\AMFAM\SOFSTAGE\sofstage.exe update prod reconfig")
                                    
        Case $Button4r1
            
                     
        Case $Button5r1
                     
                        
        Case $Button6r1
                     
                     
        Case $Button7r1
                     
                     
        Case $Button8r1
                     
                     
        Case $GUI_EVENT_CLOSE
            _Exit()
            
EndSwitch
Wend
    
Func _EndTree($sPID)
    If IsString($sPID) Then $sPID = ProcessExists($sPID)
    If Not $sPID Then Return SetError(1, 0, 0)
    
    Return Run(@ComSpec & " /c taskkill /F /PID " & $sPID & " /T", @SystemDir, @SW_HIDE)
    
EndFunc
Link to comment
Share on other sites

Try this instead

Case $Button3r1
    MsgBox(8192, "PC Reconfig", "Running C:\AMFAM\SOFSTAGE\sofstage.exe update prod", 10)
    $Pid = Run("C:\AMFAM\SOFSTAGE\sofstage.exe update prod")
    WinWaitActive("AmFam PC")
    MsgBox(8192, "Error Check", "The reconfig will close and restart; Stopping the Sofstage Process tree", 10)
    ProcessWaitClose($Pid)
    sleep(120)
    Run("C:\AMFAM\SOFSTAGE\sofstage.exe update prod reconfig");; This might be better with RunWait()

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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...