Sign in to follow this  
Followers 0
Olsson

IE window, clicking

7 posts in this topic

Hi,

I have been looking around and trying to understand how I can make a window containing IE object, and in this window - click. I want it to click and handle itself, within this window, without disturbing me, when I'm using the computer. Any code examples or special functions I should look at? I would love to get some help with this!

Thanks,

Olsson

Share this post


Link to post
Share on other sites



Hi,

This is possible with the IE Library.

Consult the help file for the _IE* functions.

This code generates a page that links to useful references and tools.

#include <IE.au3>
$oIE = _IE_Introduction ("basic")

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

The IE Library has what you need. Search the forums, it has loads of examples of simple and complex operations.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

Thank you for the replies!

I'm stuck at the same error as I've been on previously;

While using StringInStr() I get the following error:

Return $o_object.document.body.innerText
Return $o_object.document^ ERROR

G:\Program\AutoIt3\Include\IE.au3 (2241) : ==> Variable must be of type "Object".:

Using

$oIE = ObjCreate("Shell.Explorer.2")

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Well, I might just be stupid, but I can't find what I'm looking for =/

#include <IE.au3>
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 900, 580, 192, 114)
GUISetBkColor(0xFFFFFF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$oIE = ObjCreate("Shell.Explorer.2")
GUICtrlCreateObj($oIE, 169, 1, 730, 580)

$oIE.navigate("google.com")

;~ $oIE = _IE_Example ("basic")
$oLink = _IEGetObjByName ($oIE, "AutoItImage")
_IEAction ($oLink, "click")
_IELoadWait ($oIE)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

gives me:

>"G:\Program\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "G:\Program\AutoIt3\Examples\Olsson\asd.au3"    
G:\Program\AutoIt3\Include\IE.au3 (2709) : ==> Variable must be of type "Object".:
If IsObj($o_object.document.GetElementsByName($s_Id).item($i_index)) Then
If IsObj($o_object.document^ ERROR
>Exit code: 1   Time: 0.307

I figured out my own stupid mistake. Thanks anyways. (You have to declare the object; GUICtrlCreateObj($oIE, 169, 1, 730, 580)

Edited by Olsson

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Using more of the _IE functions will help you here. You are trying to access elements on the page before it is loaded. _IENavigate takes care of that for you (by implicitly calling _IELoadWait).

Try this:

#include <IE.au3>
#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 900, 580, 192, 114)
GUISetBkColor(0xFFFFFF)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$oIE = _IECreateEmbedded()
GUICtrlCreateObj($oIE, 169, 1, 730, 580)

_IENavigate($oIE, "google.com")

After that you will get warnings in your code because there is not element with an ID of AutoItImage on the page.

Dale

Edited by DaleHohm

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