Sign in to follow this  
Followers 0
ITSky8

About Kill and Start Process

5 posts in this topic

Hello!

Why the KillSoft and StartSoft function doesn't work? What's missing? Please help to check, thanks!

Func KillSoft() ;Function to Kill the Software

ProcessClose("ClickApp.exe")

$PID1 = ProcessExists("ClickApp.exe") ; Will return the PID or 0 if the process isn't found.

If $PID1 Then ProcessClose($PID1)

EndFunc

Func StartSoft() ;Function to Start the Software in case it is not running

$PID2 = ProcessExists("ClickApp.exe") ; Will return the PID or 0 if the process isn't found.

If $PID2 = 0 Then

Sleep(3000)

Run("C:\AutoITApp\ClickApp.exe")

EndIf

EndFunc

Share this post


Link to post
Share on other sites



What do you mean by it doesn't work?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hello!

The ClickApp.exe cannot be killed, the steps to Kill ClickApp.exe is checked by PixelGetColor, once the ClickApp.exe pop up error dialog, then Kill it. and detected the ClickApp.exe is not running, then go to StartSoft, the StartSoft also cannot call the ClickApp.exe to start again, why? What's wrong?

Hello!

Why the KillSoft and StartSoft function doesn't work? What's missing? Please help to check, thanks!

Func KillSoft() ;Function to Kill the Software

ProcessClose("ClickApp.exe")

$PID1 = ProcessExists("ClickApp.exe") ; Will return the PID or 0 if the process isn't found.

If $PID1 Then ProcessClose($PID1)

EndFunc

Func StartSoft() ;Function to Start the Software in case it is not running

$PID2 = ProcessExists("ClickApp.exe") ; Will return the PID or 0 if the process isn't found.

If $PID2 = 0 Then

Sleep(3000)

Run("C:\AutoITApp\ClickApp.exe")

EndIf

EndFunc

Edited by ITSky8

Share this post


Link to post
Share on other sites

Hello!

Found the problems, and now it's working. Thx!

Share this post


Link to post
Share on other sites

Hello!

The ClickApp.exe cannot be killed, the steps to Kill ClickApp.exe is checked by PixelGetColor, once the ClickApp.exe pop up error dialog, then Kill it. and detected the ClickApp.exe is not running, then go to StartSoft, the StartSoft also cannot call the ClickApp.exe to start again, why? What's wrong?

I have noticed issues with ProcessClose() so try this instead, it should fix the opening and closing issue (wont open if it is still running)

If ProcessExists($PID1) Then Run("taskkill /F /T /IM " & $PID1, "", @SW_HIDE)

func get_quote()
   local $quote 
   switch random(1, 3, 1)
    case 1
     $quote = '"' & "A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, " & _
       "design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give " & _
       "orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, " & _
       "fight efficiently, die gallantly. Specialization is for insects." & '"' & " Robert A. Heinlein"
    case 2
     $quote =  '"' & "Within each of us lies the power of our consent to health and sickness, to riches and poverty, to freedom " & _
       "and to slavery. It is we who control these, and not another." & '"' & " Richard Bach (Illusions)"
    case 3
     $quote ='"' & "Don't handicap your children by making their lives easy." & '"' & " Robert A. Heinlein"
   EndSwitch
   MsgBox(0, "Quote for the moment", $quote & @CRLF)
EndFunc

get_quote()

Share this post


Link to post
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
Sign in to follow this  
Followers 0