Jump to content
Sign in to follow this  
AwAke

_IE Functions related script just pauses/freezes.

Recommended Posts

AwAke

Ok so I have this function in my script, and for some reason it doesnt execute the MsgBox after executing '_IELinkClickByText($oIE, "DOWNLOAD THIS TORRENT")'.

Func _CheckTorrent()
    $sMyString = "dvdrip" 
    $link = "Download"
    $oLinks = _IELinkGetCollection($oIE)
    For $oLink in $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innerText")
        If StringInStr($sLinkText, $sMyString) Then
            _IEAction($oLink, "click")
            _IELoadWait($oIE)
        ExitLoop
    ;MsgBox(0, "Downloader", "Sorry there isnt any DVD rips available.")
    EndIf
    Next
    _IELinkClickByText($oIE, "DOWNLOAD THIS TORRENT")
    MsgBox(0, "", "")
EndFunc

However this was working just before I edited it, I have not saved it though so I cant go back. But the editing that I done was just adding a GUI and such. I dont see why this should effect it,

as the GUI is as simple as an open canvas with one button which refers to this function :|.

Thanks in advance, AwAke.

Edited by AwAke

Share this post


Link to post
Share on other sites
DaleHohm

Suggest you use SciTe debug mode to see where you are actually stalling (see my sig)

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
Authenticity

EDIT: I must read before post, min.

If it's possible to have a look also in the GUI code to see what is wrong.

Edit2: I think it's the problem with this specific, and maybe other like _IEFormSubmit. Use the function the same way but change it's last parameter (forth one) to 0 (return immediately) and call after it the _IELoadWait instead. I've experienced this behavior several times and this handles it smoothly.

Edited by Authenticity

Share this post


Link to post
Share on other sites
AwAke

EDIT: I must read before post, min.

If it's possible to have a look also in the GUI code to see what is wrong.

Yeah ofc, atm I added what DaleHohm asked, to the top of my script and it returns;

SetError($_IEStatus_Success)

SetError(^ ERROR

However here is my script atm;

_IEErrorHandlerRegister()
#AutoIt3Wrapper_run_debug_mode=Y
#include <IE.au3>
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <EditConstants.au3>
#Include <File.au3>
#Include <Array.au3>
#RequireAdmin
Opt("PixelCoordMode", 0)
;######### VARIABLES #########
;$title = "ĀµTorrent"
;$listcontrol = "[CLASSNN:SysListView322; INSTANCE:2]"
;######### GUI CREATION #########
GuiCreate("Downloader", 200, 100, @DesktopWidth/2, @DesktopHeight/2, -1)
GUISetState(@SW_SHOW)
$download = GuiCtrlCreateButton("Download", 10, 10, -1)
;######### MAIN LOOP ########
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $download
        _Main()
        _CheckTorrent()
        _Download()
    Case $msg = $GUI_EVENT_CLOSE 
        Exit
    EndSelect
Wend
;######### WEBSITE TORRENT DOWNLOAD #########
Func _Main()
    Global $oIE, $movie = ""
    Local $choice, $SE = "SE"
    While $movie = ""
    $movie = InputBox("Movie Downloader", "What movie would you like to download?", "", "", 250, 50, @DesktopWidth/2, @DesktopHeight/2)
    If $movie = "" Then
        MsgBox(0, "Movie Downloader", "Invalid movie name, program will now close.", 4)
        Exit
    EndIf
    Wend
    $oIE = _IECreate("http://thepiratebay.org/search/"&$Movie&"/0/99/0")
    If @Error Then
        $choice = MsgBox(4, "", "Sorry there has been an error in opening your internet explorer."&@CRLF&"Would you like to close all previous Internet Explorers which should fix the problem?")
        If $choice = 6 Then
            If ProcessExists("iexplore.exe") Then
                ProcessClose("iexplore.exe")
            EndIf
        EndIf
        $oIE = _IECreate("www.thepiratebay.org")
        _IELoadWait($oIE)
    EndIf
    WinSetState($oIE, "", @SW_MAXIMIZE)
    $oButton = _IELinkClickByText($oIE, $SE)
EndFunc

Func _CheckTorrent()
    $sMyString = "dvdrip" 
    $link = "Download"
    $oLinks = _IELinkGetCollection($oIE)
    For $oLink in $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innerText")
        If StringInStr($sLinkText, $sMyString) Then
            _IEAction($oLink, "click")
        ExitLoop
    ;MsgBox(0, "Downloader", "Sorry there isnt any DVD rips available.")
    EndIf
    Next
    _IELinkClickByText($oIE, "DOWNLOAD THIS TORRENT")
    MsgBox(0, "", "")
EndFunc

Func _Download()
    MsgBox(0, "", "")
    $pos = ControlGetPos("", "", "[CLASS:Button; INSTANCE:1]")
    ControlClick("", "", "[CLASS:Button; INSTANCE:1]")
    Sleep(500)
    MouseClick("Left", $pos[0]+20, $pos[1]+35)
    _IELoadWait($oIE)
    _IELinkClickByText($oIE, "DOWNLOAD THIS TORRENT")
EndFunc
Edited by AwAke

Share this post


Link to post
Share on other sites
Authenticity

Here, This what I meant:

Func _CheckTorrent()
    $sMyString = "dvdrip"
    $link = "Download"
    $oLinks = _IELinkGetCollection($oIE)
    For $oLink in $oLinks
        $sLinkText = _IEPropertyGet($oLink, "innerText")
        If StringInStr($sLinkText, $sMyString) Then
            _IEAction($oLink, "click")
            _IELoadWait($oIE)
        ExitLoop
    ;MsgBox(0, "Downloader", "Sorry there isnt any DVD rips available.")
    EndIf
    Next
    _IELinkClickByText($oIE, "DOWNLOAD THIS TORRENT", 0, 0)
    _IELoadWait($oIE)
    MsgBox(0, "", "")
EndFunc

Share this post


Link to post
Share on other sites
AwAke

Ah thank you, I shall test it now, Thanks for your help :). Its deeply appreciated.

Edited by AwAke

Share this post


Link to post
Share on other sites
AwAke

Thanks alot mate, now works as intended :) thanks for the help once again :lmao:

-AwAke

Share this post


Link to post
Share on other sites
DaleHohm

@AwAke, _IEErrorHandlerRegister() is defined in IE.au3, so you cannot use it before you include IE.au3.

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
AwAke

Ah I see, however I got that section working but now im stuck with something else, and besides making a new thread I thought ill pop it in here.

So sorry for bumping (A).

Eitherway this is my code;

Func _Main()
    Global $oIE, $movier
    Local $choice, $SE = "SE"
        $movie = _GUICtrlListView_GetItem($listview, 0)
    If $movie = "" Then
        MsgBox(0, "Downloader", "Please ensure there is a movie in the list first.")
        
    EndIf
    $movier = StringSplit($movie[3], " ")
    $oIE = _IECreate("http://thepiratebay.org/search/"&$Movie[3]&"/0/99/0")
    If @Error Then
        $choice = MsgBox(4, "", "Sorry there has been an error in opening your internet explorer."&@CRLF&"Would you like to close all previous Internet Explorers which should fix the problem?")
        If $choice = 6 Then
            If ProcessExists("iexplore.exe") Then
                ProcessClose("iexplore.exe")
            EndIf
        EndIf
        $oIE = _IECreate("www.thepiratebay.org")
        ;_IELoadWait($oIE)
        Sleep(1500)
    EndIf
    WinSetState($oIE, "", @SW_MAXIMIZE)
    $oButton = _IELinkClickByText($oIE, $SE)
EndFunc

I dont know what I shall put in there to get back to the GUI loop, Exit wont work ofc and neither will ExitLoop as im not in the correct loop.

Is there any quick way of doing this? Ive scanned the help file but I cant find anything atm :/.

Thanks in advance for the help :)

-AwAke

EDIT: Broke the code hehe ^^

Edited by AwAke

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.