cwem Posted July 1, 2009 Share Posted July 1, 2009 With help from oMBRa and Dale, I'm able to complete the follow codes. I have got 2 unresolved puzzles. 1. for the: For $i = 0 To 1 _IEFormElementCheckboxSelect ($oForm, $i, "", 1, "byIndex") Next I just don't know why nothing is checked. In fact if I increase from 1 to 3 or above, then something are checked accordingly, that means some unknown offsets are there. Ok, maybe i can just ignore the above problem, but why the last few codes of file download really puzzles me. FreeTry once said UDF may solve but after days of study, I still don't quite get why UDF can solve this problem. Can anybody tell me some hints about how to download the results automatically? thanks in advance! ============================ #include <IE.au3> #include <Array.au3> #include <File.au3> $dir = "C:\"; $murl = "http://www.hiv.lanl.gov/components/sequence/HIV/search/search.html" $element = "U" $sFile = $dir & "\Subtype_" & $element & ".xls" If FileExists($sFile) Then FileDelete($sFile) $hFile = FileOpen($sFile, 1) ; 1 = append $i = 0 $oIE = _IECreate () _IELoadWait ($oIE) _IENavigate ($oIE, $murl) $oForm = _IEFormGetCollection($oIE, 1) $oSelect = _IEFormElementGetObjByName ($oForm, "value SEQ_SAMple SSAM_subtype 1 exact") _IEFormElementOptionselect ($oSelect, "Any subtype", 0, "byText") _IEFormElementOptionselect ($oSelect, $element, 1, "byText") $targetTextObj = _IEFormElementGetObjByName ($oForm, "max") _IEFormElementSetValue ($targetTextObj, 2) $oSubmit = _IEFormElementGetObjByName ($oForm, "submit") _IEAction ($oSubmit, "click") _IELoadWait ($oIE) Do $success = WinActivate("Search Result - Windows Internet Explorer") ;Or IE.au3 V2.4-0 Warning from function _IEFormGetCollection, $_IEStatus_NoMatch --> will return, unknown reason until $success = 1 $oIE = _IEAttach ("Search Result") $oForm = _IEFormGetCollection($oIE, 1) $oButton = _IEFormElementGetCollection($oForm, 2) _IEAction($oButton, "click") For $i = 0 To 1 _IEFormElementCheckboxSelect ($oForm, $i, "", 1, "byIndex") Next $oSubmit = _IEFormElementGetObjByName ($oForm, "save_tbl") _IEAction ($oSubmit, "click") _IELoadWait ($oIE) WinWaitActive("File Download") WinActivate("File Download") ControlClick("File Download", "Do you want to open or save", "&Save") WinWaitClose("File Download") ;ControlSetText("Save As", "Save &in", "Edit1", $dir) WinActivate("Save As") ControlClick("Save As", "Save &in", "&Save") WinWaitClose("Save As") ;MsgBox(0,@error,@error) exit ================================================================== Link to comment Share on other sites More sharing options...
cwem Posted July 2, 2009 Author Share Posted July 2, 2009 ============================ WinWaitActive("File Download") WinActivate("File Download") ControlClick("File Download", "Do you want to open or save", "&Save") WinWaitClose("File Download") ;ControlSetText("Save As", "Save &in", "Edit1", $dir) WinActivate("Save As") ControlClick("Save As", "Save &in", "&Save") WinWaitClose("Save As") ================================================================== after studying AutoIt v3 Window Info, I have tried modifying the ControlClick part to: ;ControlClick("File Download", "", "[CLASS:Button; TEXT:&Save; INSTANCE:2]") ControlClick("File", "", 4427) , but the problem persists as so... Link to comment Share on other sites More sharing options...
bogQ Posted July 2, 2009 Share Posted July 2, 2009 (edited) after studying AutoIt v3 Window Info, I have tried modifying the ControlClick part to: ;ControlClick("File Download", "", "[CLASS:Button; TEXT:&Save; INSTANCE:2]") ControlClick("File", "", 4427) , but the problem persists as so... the problem is that your waiting to first win get close (note that he isnt getting closed so you have two windows and you dont need WinWaitClose("File Download") becose that win isnt gooing to close before you start download) Opt("TrayIconDebug", 1) WinWait("File Download") WinActivate("File Download") WinWaitActive("File Download") ControlClick("File Download", "", "Button2") ;ControlSetText("Save As", "Save &in", "Edit1", $dir) WinWait("Save As") WinActivate("Save As") WinWaitActive("Save As") ControlClick("Save As", "", "Button2") WinWaitClose("Save As") Edited July 2, 2009 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. 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