Zari Posted November 5, 2009 Share Posted November 5, 2009 I'm trying to create a simple GUI with one button that performs this action. When you click the button, it checks if IE is running. If IE is running it prompts them to close it, if it is not running, the GUI closes. $ProcessName = "iexplore.exe" If ProcessExists($ProcessName) Then MsgBox(0,"Running","Internet Explorer is open, please close.") Else Exit EndIf Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2009 Moderators Share Posted November 5, 2009 Zari,First, welcome to the AutoIt forums. Congratulations, you have written exactly what you wanted!If you want to compile this script into an .exe file, you will need to do one of 2 things:1. If you are using SciTE to write your code, use the <Tools - Compile> menu to open a dialog which will enable you compile.2. Otherwise, use Aut2Exe (which you will find in "C:\Program Files\AutoIt3\Aut2Exe" if you have a standard install) which opens another dialog to compile.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Zari Posted November 5, 2009 Author Share Posted November 5, 2009 I have compiled it, but I still need help. I can't figure out the part I posted about, one button that closes on click if IE is closed and message box if IE is open******************************************************************************************Zari,First, welcome to the AutoIt forums. Congratulations, you have written exactly what you wanted!If you want to compile this script into an .exe file, you will need to do one of 2 things:1. If you are using SciTE to write your code, use the <Tools - Compile> menu to open a dialog which will enable you compile.2. Otherwise, use Aut2Exe (which you will find in "C:\Program Files\AutoIt3\Aut2Exe" if you have a standard install) which opens another dialog to compile.M23 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 5, 2009 Moderators Share Posted November 5, 2009 Zari,The code you posted works like this:; What are we looking for? $ProcessName = "iexplore.exe" ; See if it is running If ProcessExists($ProcessName) Then ; It is running so show a MsgBox which will wait until the user presses the OK button and then continue the script after the EndIf (i.e.Exit!) MsgBox(0,"Running","Internet Explorer is open, please close.") Else ; IE is not running, exit immediately Exit EndIf ; If we arrive here from the MsgBox, the script exits because there is no more code!If you are having trouble understanding how the code works, could I suggest reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) which will help you enormously. You should also look at the excellent tutorials that you will find here and here. There are even video tutorials on YouTube if you do not like reading. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Tomb Posted November 5, 2009 Share Posted November 5, 2009 (edited) try this code #Include <GUIConstants.au3> #Include <WindowsConstants.au3> $GUI = GUICreate("", 200, 50, -1, -1) $Button = GUICtrlCreateButton("click me", 10, 10, 50, 20) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $Button Click_Func() Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func Click_Func() $ProcessName = "iexplore.exe" If ProcessExists($ProcessName) Then MsgBox(0,"Running","Internet Explorer is open, please close.") Else Exit EndIf EndFunc Edited November 5, 2009 by Tomb Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now