snn Posted October 15, 2007 Share Posted October 15, 2007 (edited) I'm trying to make a GUI with admin / mod cp controls & a simple close function, the mod & admin functions are working fine since I've already coded a website for it. What I can't get is the close function for IE, I have $oIE.close but it doesn't work...can anyone tell me what the command for a IE window is to close the window? Here's the error: Line: -1 Error: The requested action with this object has failed. Here's the script: #include <GUIConstants.au3> $oIE = ObjCreate("Shell.Explorer.2") $Form1 = GUICreate ( "My Program Title", 800, 600) $Fil = GUICtrlCreateMenu("File") $MenuItem2 = GUICtrlCreateMenuItem("Admin CP", $Fil) $MenuItem3 = GUICtrlCreateMenuItem("Mod CP", $Fil) $MenuItem1 = GUICtrlCreateMenuItem("Close", $Fil) $GUIActiveX = GUICtrlCreateObj ( $oIE,0,2,800,600 ) GUISetState ();Show GUI TrayItemDelete(0) $oIE.navigate("http://trs.mydomain.net/index.php") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect Select Case $msg = $MenuItem1 $oIE.navigate("window.close()") EndSelect Select Case $msg = $MenuItem2 $oIE.navigate("http://trs.mydomain.net/admin/index.php") EndSelect Select Case $msg = $MenuItem3 $oIE.navigate("http://trs.mydomain.net/mod/index.php") EndSelect Wend GUIDelete() ExitThanks, Billy Edited October 15, 2007 by snn Link to comment Share on other sites More sharing options...
Nahuel Posted October 15, 2007 Share Posted October 15, 2007 It's good that you got it working without using Dale's IE.au3 What you are looking for is: $oIE.quitAnyway, here's the alternative and easier way using IE.au3. I also fixed the way you use Select ... case.. EndSelect and how you exit the browser:#include <GUIConstants.au3> #include <IE.au3> $oIE = _IECreateEmbedded() $Form1 = GUICreate ( "My Program Title", 800, 600) $Fil = GUICtrlCreateMenu("File") $MenuItem2 = GUICtrlCreateMenuItem("Admin CP", $Fil) $MenuItem3 = GUICtrlCreateMenuItem("Mod CP", $Fil) $MenuItem1 = GUICtrlCreateMenuItem("Close", $Fil) $GUIActiveX = GUICtrlCreateObj ( $oIE,0,2,800,600 ) GUISetState ();Show GUI TrayItemDelete(0) _IENavigate($oIE,"http://trs.mydomain.net/index.php") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $MenuItem1 Exit Case $msg = $MenuItem2 _IENavigate($oIE,"http://trs.mydomain.net/admin/index.php") Case $msg = $MenuItem3 _IENavigate($oIE,"http://trs.mydomain.net/mod/index.php") EndSelect Wend Link to comment Share on other sites More sharing options...
snn Posted October 15, 2007 Author Share Posted October 15, 2007 Thank you very much. I used to work with Dale's IE.au3, because my friend (mmavipc) showed me how, I used koda and it gave me a simple internet explorer page, and I've worked from there 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