Jump to content

Recommended Posts

Posted (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()
Exit
Thanks,

Billy

Edited by snn
Posted

It's good that you got it working without using Dale's IE.au3

What you are looking for is: $oIE.quit

Anyway, 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
Posted

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 :)

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...