Jump to content

Another way around?,


walle
 Share

Recommended Posts

I need to find a new way of downloading my .torrent files. i've been using

$oLink = _IELinkGetCollection($oIE, 43) to collect the link/adress

and then opened it in a new window. But the fact is that the link isn't

always the 43:rd, something 44, or even 45.

Downloading the file by pressing the dl.gif triggers the internet explorer

security blocking.

Is there another way?

If $msg = $ButtonSearch Then
$Search2 = GUICtrlRead($Search)
$url = "http://www.swedvdr.org/browse.php"
$oIE = _IECreate($url, 0,0)
$oForm = _IEFormGetCollection($oIE, 0)
$oSearchInput = _IEGetObjByName($oIE, 'Search')
_IEFormElementSetValue($oSearchInput , $Search2)
_IEFormSubmit($oForm)
;_IEImgClick ($oIE, "DL.gif", "src")
$oLink = _IELinkGetCollection($oIE, 43)
$sURL = $oLink.href
ConsoleWrite("Debug: $sURL = " & $sURL & @LF)
$oIE = _IECreate($sURL, 0,0); Open a new window/link
Link to comment
Share on other sites

The straight-forward solution is to get the whole collection and loop through it looking for the right one. So what's unique about that link that would allow you to identify it from the others?

:)

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
Link to comment
Share on other sites

The straight-forward solution is to get the whole collection and loop through it looking for the right one. So what's unique about that link that would allow you to identify it from the others?

:)

It contains .torrent at the end of the adress.

Example: Autoit.2007.torrent

Link to comment
Share on other sites

  • Moderators

If you have the link, have you tried just InetGet?

Edit:

P.S.

This topic description reminds me of a really bad "personals" add :)

"Lonely cowboy looking for a Rich/Dumb/Great Bodied woman *** Must have fishing boat"

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

This loops though the collection object of all links and looks for ".torrent" in the URLs:

$colLinks = _IELinkGetCollection($oIE)
ConsoleWrite("Debug: Total links in collection = " & @extended & @LF)

$i = 0
For $oLink In $colLinks
    $sURL = $oLink.href
    If StringInStr($sURL, ".torrent") Then
        ConsoleWrite("Debug: " & $i & ": $sURL = " & $sURL & @LF)
        $i += 1
    EndIf
Next
ConsoleWrite("Debug: Number of .torrent links = " & $i & @LF)

:)

Edit: Oops, I Next'd when I should've EndIf'd... :">

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
Link to comment
Share on other sites

Thanks, exactly what i'm looking for. Just one thing, can't get the

Next statement to work =/

"Next" statement with no matching "For" statement.: "

#Include <Inet.au3>
#include <IE.au3>
$url = "http://www.swedvdr.org/browse.php"
$oIE = _IECreate($url, 0)
$oForm = _IEFormGetCollection($oIE, 0)
$colLinks = _IELinkGetCollection($oIE)
ConsoleWrite("Debug: Total links in collection = " & @extended & @LF)

$i = 0
For $oLink In $colLinks
    $sURL = $oLink.href
    If StringInStr($sURL, ".torrent") Then
        ConsoleWrite("Debug: " & $i & ": $sURL = " & $sURL & @LF)
        $i += 1
    Next

Next
ConsoleWrite("Debug: Number of .torrent links = " & $i & @LF)
Edited by walle
Link to comment
Share on other sites

I'm sorry for my stupidity, didn't saw that easy misstake =/

Anyway, last question for today. After reciving the .torrent link I'm trying

to open it in a new windows, but without success. Here is the code

Once again, thx! :)

Edit: Wail searching after a .torrent file, It only search for the exact name. Like Autoitscript.2007.Thebest.torrent.

Is it possible, in a easy way, to get it to search for any substring in the text. Like only Thebest, or autoitscript?

like Opt("WinTextMatchMode", 2) :P

If $msg = $ButtonSearch Then
$Search2 = GUICtrlRead($Search)
$url = "http://www.swedvdr.org/browse.php"
$oIE = _IECreate($url, 0,0)
$oForm = _IEFormGetCollection($oIE, 0)
$oSearchInput = _IEGetObjByName($oIE, 'Search')
_IEFormElementSetValue($oSearchInput , $Search2)
_IEFormSubmit($oForm)
$colLinks = _IELinkGetCollection($oIE)
ConsoleWrite("Debug: Total links in collection = " & @extended & @LF)

$i = 0
For $oLink In $colLinks
    $sURL = $oLink.href
    If StringInStr($sURL,$Search2 & ".torrent") Then
        ConsoleWrite("Debug: " & $i & ": $sURL = " & $sURL & @LF)
        $i += 1
    EndIf
Next
ConsoleWrite("Debug: Number of .torrent links = " & $i & @LF)
$oIE = _IECreate($sURL, 0); Open a new window/link ; This part ?! <---------------------------
Edited by walle
Link to comment
Share on other sites

I think you pasted my code in without understanding it. It was only intended as a demo, but it does use StringInStr() to find ".torrent" in the link. But then it only prints the link to the console as a demo.

This finds the first .torrent link, and then opens it:

$colLinks = _IELinkGetCollection($oIE)

$sURL = ""
For $oLink In $colLinks
    $sURL = $oLink.href
    If StringInStr($sURL, $Search2 & ".torrent") Then ExitLoop
Next

If $sURL <> "" Then 
    $oIE_2 = _IECreate($sURL, 0); Open a new window/link
Else
    MsgBox(16, "Error", "No '.torrent' links found.")
EndIf

:)

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
Link to comment
Share on other sites

  • 1 month later...

I think you pasted my code in without understanding it. It was only intended as a demo, but it does use StringInStr() to find ".torrent" in the link. But then it only prints the link to the console as a demo.

This finds the first .torrent link, and then opens it:

$colLinks = _IELinkGetCollection($oIE)

$sURL = ""
For $oLink In $colLinks
    $sURL = $oLink.href
    If StringInStr($sURL, $Search2 & ".torrent") Then ExitLoop
Next

If $sURL <> "" Then 
    $oIE_2 = _IECreate($sURL, 0); Open a new window/link
Else
    MsgBox(16, "Error", "No '.torrent' links found.")EndIf

Edit: Working, the problem lay within the cookies....

Edited by walle
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...