Jump to content

<IE.au3> _IECreate


Recommended Posts

I'm not good about web programming and connections from client to sever. Now, I'm having a problem when use _IECreate function.

I'm playing a webgame, and this game can be play in multi mode. It mean I can open and sign in more than one ID at the time!

But, I can't do that with _IECreate.

an example:

I signed in an ID(id1), open a new IE by myself (click on IE icon :)), Navigate to webgame site, sign in(id2) ~> ok, I play 2 ID at the time. id1 and id2

I signed in an ID(id1), use _IECreate to open a new IE, Navigate to webgame site ~> I cant sign in, cuz this IE contain previous ID(id1). I was compelled to sign out for sign in new account

Can someone explain for me why? And how to overcome this problem?

Edited by trandatnh
Link to comment
Share on other sites

A single iexplore.exe can control many browser instances. Cookies/Session State is shared accross all browsers running out of the same process.

Here is how I force the creation of a new browser process when I need one:

#include <IE.au3>

$oIE = _IECreateNew("www.autoitscript.com")

Func _IECreateNew($s_url = "about:blank")
    ; Create an IE browser in a new process, attach to it and navigate to spcified URL
    ; Returns browser object on success
    ; Returns 0 on failure and sets @error to 1 (timeout waiting for browser)  or 2 (attach failed)
    
    Local $s_random, $h_IEhandle, $o_IE
    
    $s_random = "about:blank-" & Random(1000000, 9999999, 1)
    Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe " & $s_random)

    If Not WinWait($s_random, "", 60) Then ; Expected IE window did not appear
        Return SetError(1, 0, 0)
    EndIf

    $h_IEhandle = WinGetHandle($s_random, "")
    $o_IE = _IEAttach($h_IEhandle, "hwnd")
    
    If Not IsObj($o_IE) Then ; attach failed
        Return SetError(2, 0, 0)
    EndIf
    
    _IENavigate($o_IE, $s_url)
    Return $o_IE
EndFunc

My routine for this used to be a lot more complex until I found the trick of using a random string with about:blank

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Thank Dale for your reply and your IE.au3 lib. I tried to use it. And it works so good.

Hope I don't disturb to you, but I still have some question and my English is not good enough to read and understand all of Autoit Help file.

My problem is

After I click a button, a pop-up appear. Question: how can I control that pop-up?

thank Dale again!

Edited by trandatnh
Link to comment
Share on other sites

That is IE's pop-up

Here is code of button

<button id="i167" name=":submit" value="出兵" onclick="var wcall=wicketSubmitFormById('actionForm', '?x=Goyqg*H6M3WGHkeSG*WX5fInhnwvtVVKiL75z-DSWNxjD0HmgKj-ga*N9dSoSBLKyoHhVa3UfdfFHnlWJsiWo407qVkhikLpPjkBeYHCbyN*SOhulP77QK*uqYyRUJIj', ':submit' ,null,null, function() {return Wicket.$$(this)&amp;&amp;Wicket.$$('actionForm')}.bind(this));;; return false;" type="button">
            Click Me
        </button>

And here is code op the pop-up appear after click above button

<form id="cf" action="?x=9Fnh2bYmXJm9Cas-KScUK98DxMEYDNT4Q0JbMBuWFnQ5HjnaSkvgLxDriChuMRwW" target="_parent" method="post"><div style="display:none"><input type="hidden" name="cf_hf_0" id="cf_hf_0" />

Can you give me an example?

Link to comment
Share on other sites

I could :) but I don't know what is the title for example, or it's completely unnecessary... It's probably can be managed by some _IE* functions like _IEGetObjById() if applicable. Depend on the case.... The examples are all there in the help file.

Edited by Authenticity
Link to comment
Share on other sites

I could :) but I don't know what is the title for example, or it's completely unnecessary... It's probably can be managed by some _IE* functions like _IEGetObjById() if applicable. Depend on the case.... The examples are all there in the help file.

In this case can't use _IE* functions, cuz I don't have "Object variable of an InternetExplorer.Application".

=.="

another way?

Link to comment
Share on other sites

In this case can't use _IE* functions, cuz I don't have "Object variable of an InternetExplorer.Application".

=.="

another way?

Please see _IEAttach with the "dialogbox" parameter.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

^^!

That way cant be use :|

how much for time sleep?

if we set time is not enough ~> error

if we set time is so much ~> loadwait better than.

(*I often or always write with wrong grammar, can u or every one help me to improve E writing skill ?(:cry:)*)

Edited by trandatnh
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...