Symplystyc Posted November 12, 2007 Share Posted November 12, 2007 $oIE = _IE_Example ("basic") $file = FileOpen("test.txt", 1) $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended FileWrite("test.txt",$oLinks) FileClose($file) I thought this would open a text file and write all of the links from a given webpage on it. All I get is an empy text file. The glass is neither half empty nor half full, it is simply twice as big as it needs to be. Link to comment Share on other sites More sharing options...
Generator Posted November 12, 2007 Share Posted November 12, 2007 $oIE = _IE_Example ("basic") $file = FileOpen("test.txt", 1) $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended For $oLink In $oLinks FileWrite("test.txt",$oLink.herf & @CRLF) Next FileClose($file) Link to comment Share on other sites More sharing options...
Symplystyc Posted November 12, 2007 Author Share Posted November 12, 2007 When I run that I get errors at the & sign. If I remove the & @CRLF I get errors at the last ) If I remove the .herf after that I get no errors but an empty text file. The glass is neither half empty nor half full, it is simply twice as big as it needs to be. Link to comment Share on other sites More sharing options...
Generator Posted November 12, 2007 Share Posted November 12, 2007 Sorry, it was a typo, change herf to href Link to comment Share on other sites More sharing options...
Symplystyc Posted November 12, 2007 Author Share Posted November 12, 2007 Sorry, it was a typo, change herf to hrefthank you very much. The glass is neither half empty nor half full, it is simply twice as big as it needs to be. Link to comment Share on other sites More sharing options...
Symplystyc Posted November 12, 2007 Author Share Posted November 12, 2007 New questionWhen I do this #include <IE.au3> $oIE = _IECreate ("http://www.autoitscript.com/forum/index.php?showforum=2") WinSetState("", "", @SW_MAXIMIZE) fileopen = ("test.txt",1) $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended For $oLink In $oLinks If StringInStr($oLink.href,"http://www.autoitscript.com/forum/index.php?showtopic=") Then FileWrite("test.txt",$oLink.href & @CRLF) NextI can open the text file test.txt and see a list of all the links on that page that contain http://www.autoitscript.com/forum/index.php?showtopic=Now when I do#include <IE.au3> $oIE = _IECreate ("http://www.autoitscript.com/forum/index.php?showforum=2") WinSetState("", "", @SW_MAXIMIZE) Dim $handle $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended For $oLink In $oLinks If StringInStr($oLink.href,"http://www.autoitscript.com/forum/index.php?showtopic=") Then FileWrite($handle,$oLink.href & @CRLF) Next MsgBox( 4096,"",Ubound($handle))I know this is wrong but I'm not sure what command to use for instead of Filewrite.I then want to make a For loop that will go through each link in the $handle variable and click it. Once its clicked i have the rest of the script done. (I think) The glass is neither half empty nor half full, it is simply twice as big as it needs to be. Link to comment Share on other sites More sharing options...
Generator Posted November 12, 2007 Share Posted November 12, 2007 Not sure if this is what you wanted... #include <IE.au3> Dim $Handle[1024], $Counter=0 $oIE = _IECreate ("http://www.autoitscript.com/forum/index.php?showforum=2") WinSetState("", "", @SW_MAXIMIZE) $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended For $oLink In $oLinks If StringInStr($oLink.href,"http://www.autoitscript.com/forum/index.php?showtopic=") Then $Handle[$Counter]=$oLink.href $Counter+=1 EndIf Next For $i=0 to UBound($Handle) _IENavigate($oIE,$Handle[$i],1) Next Link to comment Share on other sites More sharing options...
Symplystyc Posted November 12, 2007 Author Share Posted November 12, 2007 (edited) Neither am I. but this is what I did #include <IE.au3> #include <File.au3> $oIE = _IECreate ("http://www.autoitscript.com/forum/index.php?showforum=2") WinSetState("", "", @SW_MAXIMIZE) Dim $handle FileOpen("test.txt",1) $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended For $oLink In $oLinks If StringInStr($oLink.href,"http://www.autoitscript.com/forum/index.php?showtopic=") Then FileWrite("test.txt",$oLink.href & @CRLF) Next _FileReadToArray("test.txt",$handle) FileClose("test.txt") so now I have the array $handle If I wanted to use $array = StringSplit($handle, " ") what would I put as the delimiters? Im not sure how the function _FileReadToArray takes a text file like http://forums.d2jsp.org/index.php?showuser=230548 http://forums.d2jsp.org/index.php?showuser=212380 http://forums.d2jsp.org/index.php?showuser=162399 http://forums.d2jsp.org/index.php?showuser=233122 http://forums.d2jsp.org/index.php?showuser=278748 http://forums.d2jsp.org/index.php?showuser=299656 http://forums.d2jsp.org/index.php?showuser=356621 and writes it as an array. I think if I knew what the delimiters were in this array I could carry on for a day or so without asking any more questions. Edited November 12, 2007 by Symplystyc The glass is neither half empty nor half full, it is simply twice as big as it needs to be. Link to comment Share on other sites More sharing options...
Generator Posted November 12, 2007 Share Posted November 12, 2007 I do think the _FileReadToArray put them into elements, so try _ArrayDisplay() or Msgbox(0,"",$handle[0]) Link to comment Share on other sites More sharing options...
Symplystyc Posted November 12, 2007 Author Share Posted November 12, 2007 I do think the _FileReadToArray put them into elements, so try _ArrayDisplay() or Msgbox(0,"",$handle[0]) Oh very nice. I dont need to use StringSplit(). The glass is neither half empty nor half full, it is simply twice as big as it needs to be. Link to comment Share on other sites More sharing options...
Symplystyc Posted November 12, 2007 Author Share Posted November 12, 2007 okay last question of the night. I need to now press the send button <input type="submit" value="Send Message" tabindex="4" accesskey="s" class='forminput' name='submit' /> heres where I'm at If $iInputSnd Then For $Send In $oFrmItm_Btn03; For each $Input found in the $oFrmItm_Btn01 collection, If $Send.type = "submit" And $Send.name = "submit" Then; if they match the following criteria ; inputs message title $binFlag = True; set the flag ExitLoop; and bail out of the loop EndIf Next EndIf Got the If but I'm not sure what the Then is. The glass is neither half empty nor half full, it is simply twice as big as it needs to be. Link to comment Share on other sites More sharing options...
Generator Posted November 12, 2007 Share Posted November 12, 2007 _IEAction($Send,"click") Link to comment Share on other sites More sharing options...
Symplystyc Posted November 12, 2007 Author Share Posted November 12, 2007 Once again, Thank You. The glass is neither half empty nor half full, it is simply twice as big as it needs to be. 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