Jump to content

Multiple IE Shell.Explorer in GUI


Recommended Posts

This is not an AutoIt issue, however I thought I would check if someone may have an idea for a solution to my problem.

I want to open 2 instances of IE side by side inside a GUI, but they will load the same page. So far I have this code and it works perfectly in terms of AutoIt. It loads the GUI with 2x 500x500px pages side by side.

The browsers will navigate to the page harvested from the facebook apps page and the flash will start loading in both browsers. The first browser completes the flash loading and the lobby is displayed.

The problem is that the second IE completes the flash loading then says it has connected to a server, however it does not load the lobby like the first browser does.

When I load the game in a real Internet Explorer window it works fine. I can have multiple tabs and browser instances open all with a unique harvested url (same as the one loaded into ie.navigate), each one will be playing a different table as expected.

Could the problem be caused by the activex object only loading 1 instance nomatter how many times i call ObjCreate() ? If so is there any way around this, and if not does anyone have any other ideas ?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Window()

Func Window()
    Local $oIE[2], $GUIActiveX[2], $msg

    $oIE[0] = ObjCreate("Shell.Explorer.1")
    $oIE[1] = ObjCreate("Shell.Explorer.1")
    GUICreate("Poker Bot", 1000, 500, 0, 0, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    $GUIActiveX[0] = GUICtrlCreateObj ($oIE[0], 0, 0, 500, 500)
    $GUIActiveX[1] = GUICtrlCreateObj ($oIE[1], 500, 0, 500, 500)
    GUISetState() ;Show GUI
    $oIE[0].navigate(PokerLink())
    $oIE[1].navigate(PokerLink())

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
        EndSelect
    WEnd

    GUIDelete()
EndFunc

Func PokerLink()
    Local $sLink, $aLinks
    If InetGet("http://apps.facebook.com/texas_holdem", "tmp", 1, 0) == 0 Then
        MsgBox(0, "Download Error", "Cannot download the poker page.")
        MsgBox(0, "Download Error", "Please login to http://www.facebook.com using Internet Explorer and tick the 'Remember Me' checkbox.")
        Exit
    Else
        $aLinks = StringRegExp(FileRead("tmp"), '"(http://facebook\.poker\.zynga\.com/poker/launch\.php.+?)"', 2)
        FileDelete("tmp")
        If IsArray($aLinks) And $aLinks[1] Then
            $sLink = StringReplace($aLinks[1],"&amp;","&")
            Return $sLink
        Else
            MsgBox(0, "Download Error", "Cannot find poker link.")
            MsgBox(0, "Download Error", "Please login to http://www.facebook.com using Internet Explorer and tick the 'Remember Me' checkbox.")
            Exit
        EndIf
    EndIf
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

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