Sign in to follow this  
Followers 0
lordsprinkles

Trying to shutdown Easy PHP and delete the directory

3 posts in this topic

I've been trying to automate the shutdown and removal of Easy PHP for a few hours now with no luck. It's like a cockroach. I'd eventually like to run this on a computer that will be locked so I'm trying to only use commands that fall in that category.

  • It doesn't react to WinClose() at all.
  • I tried nuking it with ProcessClose() and that works but when I try to delete the file directory afterwards Windows is still holding onto something in the folder directory. I have to restart the machine to get Windows to release the directory so it can be deleted (restarting the computer every time is not an optimal solution).
  • I've tried running ControlSend() using the "!{f4}" command and I get the issue other people were having where it closes the active window instead of the one I'm sending to. This script will be run on a computer that is locked so I can't use Send() with "!{f4}", correct?

 

EasyPHP hides out in the system tray while running so I call WinSetState() to bring up in the task bar. Once it's in the task bar, I've just been throwing different functions at it to try and shut it down. I've commented out the ProcessClose() code while I'm trying different solutions. 

If ProcessExists("EasyPHP-12.1.exe") Then
   WinSetState("[CLASS:#32770]", "", @SW_RESTORE)
   ControlSend("[CLASS:#32770]", "", "[CLASS:ListBox; INSTANCE:1]", "!{f4}")
   ;ProcessClose("EasyPHP-12.1.exe")
      ;Msgbox(0, "EasyPHP Terminated", @extended, 2)
   ;ProcessWaitClose("EasyPHP-12.1.exe")
EndIf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Did you try to use Send("{LALT}" & {ENTER} & "{UP}" & {ENTER}) after executing winsetstate()?

Edited by hiho

Share this post


Link to post
Share on other sites

That doesn't quite work for Easy PHP as it doesn't have the usual "File" menu options listed. However, I did find a solution while testing out your suggestion.

First, I tried using ControlFocus() before calling ControlSend() to pass in "!{f4}" but that didn't work. Next I tried sending the command "!e". "ALT + e" opens a little menu that has the "Exit" option available but I wasn't having any luck activating the "Exit" option from that menu. Just for the heck of it, I passed in "!{f4}" while the "!e" menu was open and it asked if I wanted to shutdown EasyPHP!

Using "!e" to open that little menu before I send "!{f4}" gave focus to the window, where ControlFocus() was failing to. I feel like it's a hack to make up for failings in the other functions, but it does work.

If ProcessExists("EasyPHP-12.1.exe") Then
   WinSetState("[CLASS:#32770]", "", @SW_RESTORE)
   ;ControlFocus("[CLASS:#32770]", "", "[CLASS:ListBox; INSTANCE:1]")
   ControlSend("[CLASS:#32770]", "", "[CLASS:ListBox; INSTANCE:1]", "!e")
   ControlSend("[CLASS:#32770]", "", "[CLASS:ListBox; INSTANCE:1]", "!{f4}")
   ControlSend("[CLASS:#32770]", "&Yes", "[CLASS:Button; INSTANCE:1]", "!y")
EndIf

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