Sign in to follow this  
Followers 0
cwem

retreive all the files from links inside a table

9 posts in this topic

a table contains all the links to the files I would like to download. Why does the following codes not work...? :D

#include <IE.au3>

$oIE = _IECreate ()

_IELoadWait ($oIE)

_IENavigate ($oIE, "http://genome.tbdb.org/annotation/genome/tbdb/MultiDownloads.html")

$oTable = _IETableGetCollection ($oIE, 0)

$oAs = _IETagNameGetCollection ($oTable, "A")

For $oA In $oAs

InetGet($oA)

Next

Share this post


Link to post
Share on other sites



What doesn't work? You don't get the files? Try filling in the second parameter for InetGet()

InetGet ( "URL" [,"filename" [, reload [, background]]] )

Also make sure _IETagNameGetCollection() is giving you back what you thinks, add a MsgBox("", "", $oA) before your InetGet()

Share this post


Link to post
Share on other sites

What doesn't work? You don't get the files? Try filling in the second parameter for InetGet()

Also make sure _IETagNameGetCollection() is giving you back what you thinks, add a MsgBox("", "", $oA) before your InetGet()

But I want to get the default file names defined by the server side... If I specify/rename it myself one by one, then I'm not autoit...

Share this post


Link to post
Share on other sites

After changing into the following codes, while there are 524 number of links, but when I use MsgBox to print them out, they are all null, is that my code's problem?

#include <IE.au3>

#include <Array.au3>

#include <File.au3>

#include <FF.au3>

$dir = "C:\";

$oIE = _IECreate ()

_IELoadWait ($oIE)

_IENavigate ($oIE, "http://genome.tbdb.org/annotation/genome/tbdb/MultiDownloads.html")

$oTable = _IETableGetCollection ($oIE, 0)

;$aTableData = _IETableWriteToArray ($oTable)

; _ArrayDisplay($aTableData)

$oLinks = _IELinkGetCollection ($oTable)

;$iNumLinks = @extended

;MsgBox(0, "Link Info", $iNumLinks & " links found")

For $oLink In $oLinks

;MsgBox(0, "Link Info", $dir & StringMid($oLink,StringInStr($oLink,"/",2,-1)+1) )

;Exit

;InetGet($oLink.href, $dir & StringMid($oLink,StringInStr($oLink,"/",2,-1)+1))

IF ($oLink <> "") Then

MsgBox(0, "Link Info", $oLink )

EndIf

Next

Share this post


Link to post
Share on other sites

;MsgBox(0, "Link Info", $dir & StringMid($oLink,StringInStr($oLink,"/",2,-1)+1) )

;InetGet($oLink.href, $dir & StringMid($oLink,StringInStr($oLink,"/",2,-1)+1))

It's an elusive mistake ;]

$oLink -> $oLink.href

But you did use it right in the first argument of INetGet.

Share this post


Link to post
Share on other sites

;MsgBox(0, "Link Info", $dir & StringMid($oLink,StringInStr($oLink,"/",2,-1)+1) )

;InetGet($oLink.href, $dir & StringMid($oLink,StringInStr($oLink,"/",2,-1)+1))

It's an elusive mistake ;]

$oLink -> $oLink.href

But you did use it right in the first argument of INetGet.

Thanks a lot, after fixing the problems, the following codes generate 40 links to download which matches what i see on screen, however, fail to proceed to download page it's far better now but the current problem becomes the endless pop up problem. Is there any workaround?

#include <IE.au3>

#include <Array.au3>

#include <File.au3>

#include <FF.au3>

$dir = "C:\";

$murl = "http://www.broad.mit.edu/annotation/genome/mycobacterium_tuberculosis_spp/MultiDownloads.html"

$oIE = _IECreate ()

_IELoadWait ($oIE)

_IENavigate ($oIE, $murl)

$oTable = _IETableGetCollection ($oIE, 1)

$aTableData = _IETableWriteToArray ($oTable)

;_ArrayDisplay($aTableData)

$oLinks = _IETagNameGetCollection ($oTable, "a")

;$oLinks = _IELinkGetCollection ($oTable)

$iNumLinks = @extended

;MsgBox(0, "Link Info", $iNumLinks & " links found")

For $oLink In $oLinks

$hwnd = _IEPropertyGet($oIE, "hwnd")

;MsgBox(0, "Link Info", $dir & StringMid($oLink,StringInStr($oLink,"/",2,-1)+1) )

;Exit

_IEAction($oLink, "click")

;ControlSend($hwnd, "", "", "!s")

Next

Share this post


Link to post
Share on other sites

Why did you give up the INetGet way?

Share this post


Link to post
Share on other sites

Why did you give up the INetGet way?

Because I'm unable to identify a way to use INetGet to save files by its default names and I have to switch to _IEAction but then I encountered the pop-up problem

Share this post


Link to post
Share on other sites

Because I'm unable to identify a way to use INetGet to save files by its default names and I have to switch to _IEAction but then I encountered the pop-up problem

I find out the following codes can help, thx so far for your help :D

autoit = WIN32OLE.new("AutoItX3.Control")

autoit.WinWait("File Download", "Do you want to open or save", 3)

autoit.ControlClick("File Download", "Do you want to open or save", "&Save")

autoit.WinWait("Save As", "Save &in", 3)

autoit.ControlSetText("Save As", "Save &in", "Edit1", "path\\filename.ext")

autoit.ControlClick("Save As", "Save &in", "&Save")

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