Jump to content

IE.au3


Recommended Posts

Why doesn't au3 work?

I follwed directions :

Download / Install Beta & Non-Beta.

Download / Put IE_V1Compatibility_T2.0_4.au3 into beta includes.

Run with Beta.

But, it gives me the error :

Line 1458 (File "C:\Program Files\AutoIt3\beta\Include\IE.au3")

$o_object.fireEvent ("onchange")

$o_object.fireEvent ("onchange")^ERROR

Error: The requested action with this object has failed.

Link to comment
Share on other sites

Why doesn't au3 work?

I follwed directions :

Download / Install Beta & Non-Beta.

Download / Put IE_V1Compatibility_T2.0_4.au3 into beta includes.

Run with Beta.

But, it gives me the error :

Line 1458 (File "C:\Program Files\AutoIt3\beta\Include\IE.au3")

$o_object.fireEvent ("onchange")

$o_object.fireEvent ("onchange")^ERROR

Error: The requested action with this object has failed.

ie.au3 Is included in the latest Beta.

Reinstall Beta.

Link to comment
Share on other sites

  • Developers

ie.au3 Is included in the latest Beta.

Reinstall Beta.

Its cleary installed or else you don't get this error .... so why reinstall ? Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

#include <IE.au3>
#include <IE_V1Compatibility_T2.0_4.au3>

; Variables
$Username   =  ""
$Password   =  ""
$Message    =  ""
$TopicNumber = ""
$PostNumber = ""
Dim $Thread[4]  = ["http://gaiaonline.com/forum/viewtopic.php?t=" & $TopicNumber,"http://www.gaiaonline.com/forum/posting.php?mode=edit&p=" & $PostNumber,"http://www.gaiaonline.com/forum/posting.php?mode=reply&tc=1&t=" & $TopicNumber,"http://www.gaiaonline.com/forum/posting.php?mode=reply&tc=561&t=" & $TopicNumber]
$Forum    =  "http://gaiaonline.com/forum/viewforum.php?f=23"
$Main      =  "http://gaiaonline.com"
$Exit      =  1
$sid        =  ""
$sid2      =  ""

;Hotkeys
HotKeySet("^s", "Begin")
HotKeySet("^e", "Stop")

While $Exit = 1
    Sleep(100)
WEnd

Func Begin()
    If $Exit = 1 Then
        $Exit = 0
        Global $IE = _IECreate("")
        Call("Prog")
    EndIf
EndFunc

Func Stop()
    $Exit = 1
Endfunc
   
Func Prog()
    Call("Login")
    Call("Post")
EndFunc

Func Login()
    _IENavigate($IE,"http://www.gaiaonline.com/gaia/login.php?")
    $Login = _IEFormGetObjByName($IE,"loginForm")
    $User = _IEFormElementGetObjByName($Login,"username")
    $Pass = _IEFormElementGetObjByName($Login,"password")
    _IEFormElementSetValue($User,$Username)
    _IEFormElementSetValue($Pass,$Password)
    _IEFormSubmit($Login)
    $sid2 = _IEPropertyGet($IE,"locationurl")
    $sid = "&" & StringMid($sid2,37, 9999)
EndFunc
   
Func Logout()
    _IENavigate($IE,$Main)
    _IELinkClickByText($IE,"Logout")
EndFunc

Func Post()
    While $Exit = 0
        _IENavigate($IE,$Thread[2] & $sid)
        $Post = _IEFormGetObjByName($IE,"post")
        $Mess = _IEFormElementGetObjByName($Post,"message")
        _IEFormElementSetValue($Mess,$Message)
        _IEFormImageClick ($Post,"Submit","alt")
        Sleep(50000)
                _IENavigate($IE,$Thread[3] & $sid)
        $Post = _IEFormGetObjByName($IE,"post")
        $Mess = _IEFormElementGetObjByName($Post,"message")
        _IEFormElementSetValue($Mess,$Message)
        _IEFormImageClick ($Post,"Submit","alt")
        Sleep(50000)
    WEnd
EndFunc

It worked before I reinstalled windows.

Link to comment
Share on other sites

#include <IE.au3>
#include <IE_V1Compatibility_T2.0_4.au3>

; Variables
$Username   =  ""
$Password   =  ""
$Message    =  ""
$TopicNumber = ""
$PostNumber = ""
Dim $Thread[4]  = ["http://gaiaonline.com/forum/viewtopic.php?t=" & $TopicNumber,"http://www.gaiaonline.com/forum/posting.php?mode=edit&p=" & $PostNumber,"http://www.gaiaonline.com/forum/posting.php?mode=reply&tc=1&t=" & $TopicNumber,"http://www.gaiaonline.com/forum/posting.php?mode=reply&tc=561&t=" & $TopicNumber]
$Forum    =  "http://gaiaonline.com/forum/viewforum.php?f=23"
$Main      =  "http://gaiaonline.com"
$Exit      =  1
$sid        =  ""
$sid2      =  ""

;Hotkeys
HotKeySet("^s", "Begin")
HotKeySet("^e", "Stop")

While $Exit = 1
    Sleep(100)
WEnd

Func Begin()
    If $Exit = 1 Then
        $Exit = 0
        Global $IE = _IECreate("")
        Call("Prog")
    EndIf
EndFunc

Func Stop()
    $Exit = 1
Endfunc
   
Func Prog()
    Call("Login")
    Call("Post")
EndFunc

Func Login()
    _IENavigate($IE,"http://www.gaiaonline.com/gaia/login.php?")
    $Login = _IEFormGetObjByName($IE,"loginForm")
    $User = _IEFormElementGetObjByName($Login,"username")
    $Pass = _IEFormElementGetObjByName($Login,"password")
    _IEFormElementSetValue($User,$Username)
    _IEFormElementSetValue($Pass,$Password)
    _IEFormSubmit($Login)
    $sid2 = _IEPropertyGet($IE,"locationurl")
    $sid = "&" & StringMid($sid2,37, 9999)
EndFunc
   
Func Logout()
    _IENavigate($IE,$Main)
    _IELinkClickByText($IE,"Logout")
EndFunc

Func Post()
    While $Exit = 0
        _IENavigate($IE,$Thread[2] & $sid)
        $Post = _IEFormGetObjByName($IE,"post")
        $Mess = _IEFormElementGetObjByName($Post,"message")
        _IEFormElementSetValue($Mess,$Message)
        _IEFormImageClick ($Post,"Submit","alt")
        Sleep(50000)
                _IENavigate($IE,$Thread[3] & $sid)
        $Post = _IEFormGetObjByName($IE,"post")
        $Mess = _IEFormElementGetObjByName($Post,"message")
        _IEFormElementSetValue($Mess,$Message)
        _IEFormImageClick ($Post,"Submit","alt")
        Sleep(50000)
    WEnd
EndFunc

It worked before I reinstalled windows.

My apologies. :D I read it too fast and I thought that you were having problems with 'ie.au3' not 'IE_V1Compatibility_T2.0_4.au3.' Again.. My apologies.

Link to comment
Share on other sites

Several observations...

1) I see nothing in this code to require the use of the compatability module. It should make no difference if it is there or not

2) I cannot reproduce this because I do not have an account on this system. Can you find a way to reproduce it on a typical internet form?

3) This code line is in _IEFormElementSetValue -- you call it several times in your script. Please put some debug lines in your code to figure out which instance is causing the trouble (ConsoleWrite is a good command to learn to use when using SciTe)

4) Have you tried the _IEFormElementSetValue examples in the helpfile? Do they work for you?

4) the fireEvent logic is new to the latest versions of IE.au3 It is only beneficial if there is an onchange Javascript event routine on the element... if there is not, you can turn it off with a parameter to _IEFormElementSetValue with no impact. Without seeing the HTML code I have no way to help you here.

5) You can use _IEErrorHandlerRegister() to allow your script to continue past such errors (it generates a diagnostic message instead of aborting). I stringly recommend this, especially when developing or debugging scripts as you will be much more diagnostic information as well.

6) I don't expect IE.au3 to ever trap or anticipate every possible error condition because the user interaction with the browser to just too rich**. I have struggled with convenience functions like the onchange fireEvent as to whether it should be the default action ot not since they can sometimes cause trouble, but I have decided to leave it on as I think it will help more often than confuse.

Dale

** Edit: I want to be clear what I mean by "rich". By that I mean that there are so many ways to interact with the objects asynchronously and unpredictably. Objects that were available just the line before can be gone when you try to access them due to using browser buttons, clicking links or images, activating Javascript, closing the browser etc. Trapping for every such occurance is not feasible, which is whay I added the _IEErrorHandlerRegister in this release. I do try to acticipate as many common errors and situations as I can, but I will not get them all.

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

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...