Jump to content
Sign in to follow this  
felanor

IE Errors

Recommended Posts

felanor

Hi everyone,

I am having this really wierd error. Best part, its intermittent. I was hoping someone could help me figure out why it was happening and what can be done to resolve the problem.

I am creating a program that will take a text file containing rapidshare links, click the premium button, select the first premium server, and proceed downloading the file with Download Accelerator Plus.

The program works great so far, so I cant complain. I just keep having this wierd error that crashes my AU3 script.

Below is the AutoIt console that errors and logs are displayed in.

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Administrator\Desktop\rapidshare.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams 
+>22:53:22 Starting AutoIt3Wrapper v.1.7.7
>Running AU3Check (1.54.6.0)  from:C:\Program Files\AutoIt3
+>22:53:22 AU3Check ended.rc:0
>Running:(3.2.2.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Administrator\Desktop\rapidshare.au3"    
C:\PROGRA~1\AutoIt3\Include\IE.au3 (169) : ==> The requested action with this object has failed.: 
$o_object.visible = $f_visible 
$o_object.visible = $f_visible^ ERROR
+>22:54:10 AutoIT3.exe ended.rc:0
+>22:54:13 AutoIt3Wrapper Finished
>Exit code: 0   Time: 51.417

Below is a duplicate of the code I am working on.

AutoItSetOption("WinTitleMatchMode", 2)

#region --- INCLUDES SECTION START ---
#include <IE.au3>
#include <GuiConstants.au3>
#include <File.au3>
#endregion --- INCLUDES SECTION END ---
#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.6 Prototype

GuiCreate("Rapidshare Rapid Downloader", 320, 120,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$file = GuiCtrlCreateInput("", 10, 10, 220, 20)
$browse = GuiCtrlCreateButton("Browse", 240, 10, 60, 20)
$download = GuiCtrlCreateButton("Download Now", 10, 40, 100, 20)
$about = GuiCtrlCreateButton("About", 120, 40, 90, 20)
$close = GuiCtrlCreateButton("Close", 220, 40, 90, 20)
$copyrite = GuiCtrlCreateLabel("© 2007 - Felanor", 120, 70, 80, 20)
$batch = GuiCtrlCreateInput("", 10, 70, 20, 20)
$batchlbl = GuiCtrlCreateLabel("Files / Batch", 40, 70, 70, 20)
$timeout = GuiCtrlCreateInput("", 210, 70, 30, 20)
$timeoutlbl = GuiCtrlCreateLabel("Seconds between batches", 250, 70, 60, 40)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $close
        Exit
    Case $msg = $browse
        GuiCtrlSetData($file, FileOpenDialog("Please Select a File With Your Download Links", "c:\", "Text Files (*.txt)|All Files (*.*)"))
    Case $msg = $about
        MsgBox (0, "About...", "This program was written by Felanor for use with downloading files through rapidshare with Download Accelerator Plus. All rights reserved. © 2007 - Felanor")
    Case $msg = $download
        $time = GuiCtrlRead($timeout)
        $time *= 1000
        Send("#m")                                                          
        $document = FileOpen (GUICtrlRead($file),0)
        $lines = _FileCountLines(GuiCtrlRead($file))
        $times = 0
        For $x = 1 To $lines
            If $times = GuiCtrlRead($batch) Then
                $times = 0
                Sleep ($time)
            EndIf
            BlockInput(1)
            $line = FileReadLine($document)
            download($line)
            BlockInput(0)
            $times += 1
        Next
        FileClose($document)
    Case Else
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---
#region --- FUNCTIONS SECTION START ---
Func download ($URL)
        $IEBROWSER = _IECreate($url, 0, 1, 1)
        _IELoadWait($IEBROWSER)
        Send("{tab 14}{space}")
        _IELoadWait($IEBROWSER)
        Send("{tab 15}{enter}")
        If WinWaitActive("Download Accelerator Plus - Update Notification","", 3) = 1 Then Send("!{F4}")
        WinWaitActive("Download Accelerator Plus")
        Send("{space}")
        Sleep (50)
        WinWaitActive("Download Accelerator Plus")
        Send("{space}")
        _IEQuit($IEBROWSER) 
EndFunc;download
#endregion --- FUNCTIONS SECTION END ---

Any help that can be provided would be greatly appreciated.

Thanks,

~Felanor

Share this post


Link to post
Share on other sites
DaleHohm

The code in this area is very simple (see below). The only suggestion I can offer is that in some cases, the InternetExploere.Application automation object created is in a strange state. Odd things have happened to some folks in the past when there is an iexplore.exe process on the system that is hanging for some reason. Windows, by default, manages many IE instances through a single iexplore.exe and if that process misbehaves, new browser creation has trouble as well.

The only thing I can see you can do about this would be to instantiate a user COM error handler with _IEErrorHandlerRegister(). Once the error handler is registered, the COM error will no longer cause your code to terminate, but rather will set @error and you'll have a set of global variables available that tell you more about the error (see the helpfile for more info). You can also create your own error handler in this context and handle the condition there instead of wating for the error condition to be returned to your main code stream.

If it is critical that you full automate this, see here for a technique to force the start of a new iexplore.exe instance: #396060

Dale

Local $o_object = ObjCreate("InternetExplorer.Application")
    If Not IsObj($o_object) Then
        __IEErrorNotify("Error", "_IECreate", "", "Browser Object Creation Failed")
        SetError($_IEStatus_GeneralError)
        Return 0
    EndIf
    
    $o_object.visible = $f_visible

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  

×