Sign in to follow this  
Followers 0
SimonMag

GUI Button for process

3 posts in this topic

I have written a script that will install office xp sp3. But I have modified it so it will check to see if Winword.exe, Excel.exe or Powerpnt.exe is running. When it checks for the running process it displays a message box with a message that Word is running, with an OK button. How can i get the OK button 'greyed' out until the process has stopped running, then make the button clickable?

Here is my script:

GUICreate("Office XP SP3 Install", 300, 100)
GUICtrlCreateLabel("Please make sure Word, Excel, Powerpoint are closed", 15, 15)
GUICtrlCreateLabel("Click 'Next' to continue", 15, 35)
$Install = GUICtrlCreateButton("Next", 200, 50, 60)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $Install
        If ProcessExists("winword.exe") then
        MsgBox(16, "!!!!!!!", "Word is running, Close Word.")
        ProcessWaitClose("winword.exe")
        EndIf
        If ProcessExists("excel.exe") then
        MsgBox(16, "!!!!!!!", "Excel is running, Close Excel.")
        ProcessWaitClose("excel.exe")
        EndIf
        If ProcessExists("powerpnt.exe") then
        MsgBox(16, "!!!!!!!", "Powerpoint is running, Close Powerpoint.")
        ProcessWaitClose("powerpnt.exe")
        EndIf
        Run("\\xxxxxVOL1\Applications\SWD Build Apps\Office xp SP3\ohotfix.exe", "", @SW_MINIMIZE)
        ExitLoop
  EndSelect
WEnd

Thanks for the help.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Forget about buttons on messageboxes.

What you should really consider disabling in such case is the "Next" button, and even that isn't necessary.

If there's no winword.exe, excel.exe or powerpnt.exe process detected, there's no need to show that "Please make sure Word, Excel, Powerpoint are closed and click Next" window at all. It just adds one pointless click for the user to do. Simply skip to the next step automatically.

And if process is found, then show that window - either with disabled "Next" button and loopcheck for the processes to enable it when none are found anymore, or, like you do, pop up a warning message box when user clicks "Next" button and prevent him going to the next step (but you don't need those ProcessWaitClose for that either - if user clicks OK on msgbox and then tries to click "Next" without closing office processes, another msgbox should popup).

Edited by Siao

"be smart, drink your wine"

Share this post


Link to post
Share on other sites

Hi,

I am still having issues with this - not being a programmer and new to autoit I am finding it a bit difficult. I can't get it to grey out the button until the process is ended, Help!

Forget about buttons on messageboxes.

What you should really consider disabling in such case is the "Next" button, and even that isn't necessary.

If there's no winword.exe, excel.exe or powerpnt.exe process detected, there's no need to show that "Please make sure Word, Excel, Powerpoint are closed and click Next" window at all. It just adds one pointless click for the user to do. Simply skip to the next step automatically.

And if process is found, then show that window - either with disabled "Next" button and loopcheck for the processes to enable it when none are found anymore, or, like you do, pop up a warning message box when user clicks "Next" button and prevent him going to the next step (but you don't need those ProcessWaitClose for that either - if user clicks OK on msgbox and then tries to click "Next" without closing office processes, another msgbox should popup).

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