Sign in to follow this  
Followers 0
damian666

Can i attach to a integrated browser object with _IEattach?

13 posts in this topic

#1 ·  Posted (edited)

i started to experiment with a autoit application, with a integrated browser object.

now i know i can attach to a allready existing ie instance, but i cant sem to get it to work on a

integrated browser object.

so is it possible at all?

or do i have to have a outside IE open for that?

thanx in advance guys.

Damian666

Edited by damian666

and proud of it!!!

Share this post


Link to post
Share on other sites



i started to experiment with a autoit application, with a integrated browser object.

now i know i can attach to a allready existing ie instance, but i cant sem to get it to work on a

integrated browser object.

so is it possible at all?

or do i have to have a outside IE open for that?

thanx in advance guys.

Damian666

Dog ate your help file...? :)

Look at the $s_mode parameter of _IEAttach() in the help file.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

no, i even looked at it man :)

but when i look at the output window in scite, i get the error it cant find a match.

--> IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch

i done it like this

_IEAttach($oIE, "http://www.mysite.com/index.php")

any idea?

Damian666


and proud of it!!!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

ooooh wait a sec... now i see it, i have to use the handle instead of the title :)

sorry for that :) that quarter just hit the spot now.

then to make the most of it, can you tell me this, the helpfile shows a lot of ways to click on links by index and text.

but i found a link that doesnt respond to a click by this manners, is it possible to determine a link by the "href" ?

and what about checking for a text on a link that differs everytime?

and is not always there?

Thanx for your help man, and again, sorry for my stupidity : >

Damian666

Edited by damian666

and proud of it!!!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

no, i even looked at it man :)

but when i look at the output window in scite, i get the error it cant find a match.

--> IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch

i done it like this

_IEAttach($oIE, "http://www.mysite.com/index.php")

any idea?

Damian666

Why do you have $oIE in there if you are reading your help file?

Let's try this one more time... quoting from your still mysteriously missing help file, under _IEAttach():

_IEAttach

#include <IE.au3>

_IEAttach ( $s_string [, $s_mode = "Title" [, $i_instance = 1]] )

Parameters

$s_string String to search for (for "embedded" or "dialogbox", use Title sub-string or HWND of window)

$s_mode Optional: specifies search mode

Title = (Default) sub-string of main document title

WindowTitle = sub-string of full window title (instead of document title)

URL = sub-string or url of the current page

Text = sub-string in text from the body of the current page

HTML = sub-string in html from the body of the current page

HWND = hwnd of the browser window

Embedded = title sub-string or hwnd of of the window embedding the control

DialogBox = title sub-string or hwnd of modal/modeless dialogbox

Instance = $s_string is ignored, one browser reference returned (by matching instance number) from all available browser instances

$i_instance Optional: 1-based index into group of browsers or embedded browsers matching $s_string and $s_mode. See Remarks.

No more help for you until you take the dog to vet and get your help file back.

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

because i posted a wrong example, here is what i have now man...

_IEAttach("My Gui", "embedded")

which works, as you see, i have gone even further, and put my dog down, the stupid animal must not eat my helpfile

damian666

p.s. i dont want any code help in the way you do it for me, but some pointers, now i have put my dog down :)

Edited by damian666

and proud of it!!!

Share this post


Link to post
Share on other sites

_IEAttach("My Gui", "embedded")

which works, as you see, ...

If that is working, what is question now?

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

this is my question now...

then to make the most of it, can you tell me this, the helpfile shows a lot of ways to click on links by index and text.

but i found a link that doesnt respond to a click by this manners, is it possible to determine a link by the "href" ?

and what about checking for a text on a link that differs everytime?

and is not always there?

and to show that i really got my helpfile back, here is some code :)

Func Button2Click();==>login
    $oIE = _IECreate($s_Url, 1)
    _IEAttach("http://www.mysite/index.php", "url")
    
; get pointers to the login form and username and password fields
    $o_form = _IEFormGetObjByName($oIE, "loginf")
    $o_login = _IEFormElementGetObjByName($o_form, "username")
    $o_password = _IEFormElementGetObjByName($o_form, "password")
    $o_submit = _IEFormElementGetObjByName($o_form, "Submit")

; Set field values and submit the form
    _IEFormElementSetValue($o_login, "name")
    _IEFormElementSetValue($o_password, "log")
    _IEAction($o_submit, "click")
    _IELoadWait ($oIE)
EndFunc

Func Button3Click();==>start bot
    
    $oIE = _IEAttach("http://mysite.com/game/battle.php", "url")
    
    While $exit = "off"
        Call("steps")
        
        If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then
            WinSetState("mysite- Game - Windows Internet Explorer", "", @SW_HIDE)
        EndIf
        
        If GUICtrlRead($Checkbox1) = $GUI_UNCHECKED Then
            WinSetState("mysite - Game - Windows Internet Explorer", "", @SW_SHOW)
        EndIf
    
        $town = _IELinkClickByText($oIE, "Attack")
        $island = _IELinkClickByText($oIE, "Search")
        
        $oLinks = _IELinkGetCollection ($oIE)
        $iNumLinks = @extended
;MsgBox(0, "Link Info", $iNumLinks & " links found")
        
        If $iNumLinks = 13 Then
            _IELinkClickByIndex($oIE, 9)
        EndIf
        
        If $iNumLinks = 14 Then
            _IELinkClickByIndex($oIE, 10)
        EndIf
        
        If $iNumLinks = 15 Then
            _IELinkClickByIndex($oIE, 11)
        EndIf
        
        If $iNumLinks = 16 Then
            _IELinkClickByIndex($oIE, 12)
        EndIf
        
        If $iNumLinks = 17 Then
            _IELinkClickByIndex($oIE, 13)
        EndIf
            
    WEnd
    
    WinClose("mysite - Game - Windows Internet Explorer", "")
    Exit

EndFunc

Func steps()
    $html = _IEBodyReadHTML($oIE)
;MsgBox(0, "Debugwindow", $html)
    $steps = _StringBetween($html, '<td height="23" valign="middle" class="silverborder"><span class="style3">', 'Remaining</span></td>')
    GUICtrlSetData($Input2, $steps[0])
    MsgBox(0, "Debugwindow", $steps[0])
EndFunc

in the last function, i try to read a certain value thats in a sort of a label in the webpage, but it des not show...

in the debug window i get nothing, very weird.

and about the href, i want to know if its even possible, because the text on that link is different all the time, because it uses

time notation in it, and its not the same as on my system, so i cant use the time function either.

thats why i want to know if i can determine it by href.

please give me some pointers

:)

damian666

Edited by damian666

and proud of it!!!

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

also note that i have given up on the embedded one, it opens a second window, and i dont know how to catch that in my GUI so, i searched, and it seems it cant be done :)

Damian666

p.s. how the hell do i make the codebox in autoit code? when i push that AI button, it doesnt do anything???

Edited by damian666

and proud of it!!!

Share this post


Link to post
Share on other sites

please anybody, a little help here?

how do i find that piece of text, better yet, the 4 digits in front of it...

Damian666


and proud of it!!!

Share this post


Link to post
Share on other sites

I read the full post, but I don't understand what your question is. Please summarize your situation and ask again.

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

Share this post


Link to post
Share on other sites

ok, thanx for replying man, your the IE man :)

i wanted to have a integrated browser object, but my first problem is, that the site i login to, opens another window.

so question 1 is, can i catch that window back in my GUI?

secondly, i want to retrieve some text from the site, statistics. but i cant seem to find the label or whatever it is which defines the place of the text.

now i have to read in the html, and put it in a textfile, and read from there, did that all alone :), and that works, but i like my code clean, and this is not clean.

so question 2 is, how can i retrieve text from a site, without the need for a txtfile? and better yet, how do i retrieve text that changes, because it is statistics, it changes, so i cant check for the whole string.

And then i want to know why i cant click on a link on the site, its proberly because its javascript, but i cant seem to find a name to use getobjbyname and then (IEAction click) on it...

so my third question is , can i click a link defined by href?

and then my last question, which is about the post system here, how the hell do i use the autoit button for posted code??? :)

Thanx for your time man

Damian666

btw, debugbar is awesome :P


and proud of it!!!

Share this post


Link to post
Share on other sites

ok, thanx for replying man, your the IE man :)

i wanted to have a integrated browser object, but my first problem is, that the site i login to, opens another window.

so question 1 is, can i catch that window back in my GUI?

Not really. There are things that can be done with event monitoring, but AutoIt's implementation will not allow you to intercept events and cahnge their outcome. You would be best off dynamically modifying the code of the initial page so that it does NOT open a new window (for example, changing a target= value to _self in a form).

secondly, i want to retrieve some text from the site, statistics. but i cant seem to find the label or whatever it is which defines the place of the text.

now i have to read in the html, and put it in a textfile, and read from there, did that all alone :), and that works, but i like my code clean, and this is not clean.

so question 2 is, how can i retrieve text from a site, without the need for a txtfile? and better yet, how do i retrieve text that changes, because it is statistics, it changes, so i cant check for the whole string.

See _IEPropertyGet and innerText

And then i want to know why i cant click on a link on the site, its proberly because its javascript, but i cant seem to find a name to use getobjbyname and then (IEAction click) on it...

so my third question is , can i click a link defined by href?

If it is really a link (<A>) then use _IELink* functions

and then my last question, which is about the post system here, how the hell do i use the autoit button for posted code??? :)

It is broken and has been for a long time. Jon is aware of it but it was apparently difficult to maintain accross IPB upgrades. Use the code button and then change the code keyword to autoit.

Thanx for your time man

Damian666

btw, debugbar is awesome :P

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0