cwem Posted March 26, 2009 Share Posted March 26, 2009 a table contains all the links to the files I would like to download. Why does the following codes not work...? #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 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted March 26, 2009 Share Posted March 26, 2009 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() .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
cwem Posted March 27, 2009 Author Share Posted March 27, 2009 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... Link to comment Share on other sites More sharing options...
cwem Posted March 28, 2009 Author Share Posted March 28, 2009 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 Link to comment Share on other sites More sharing options...
Authenticity Posted March 28, 2009 Share Posted March 28, 2009 ;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. Link to comment Share on other sites More sharing options...
cwem Posted March 28, 2009 Author Share Posted March 28, 2009 ;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.hrefBut 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 Link to comment Share on other sites More sharing options...
Authenticity Posted March 28, 2009 Share Posted March 28, 2009 Why did you give up the INetGet way? Link to comment Share on other sites More sharing options...
cwem Posted March 28, 2009 Author Share Posted March 28, 2009 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 Link to comment Share on other sites More sharing options...
cwem Posted March 29, 2009 Author Share Posted March 29, 2009 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 problemI find out the following codes can help, thx so far for your help 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") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now