Jump to content

Question about For..In..Next


Damein
 Share

Recommended Posts

So I have a script that reads the links for a website and saves the links I want to a txt file.

Now, I can start the saving of the links fine, but I want to stop before I reach the end of the links.

For example:

There are 144 links on a page.

I start saving links at link # 23, but I want to stop at link #40, not 144.

This is what I have so far:

#include <IE.au3>

Global $Count, $state, $oLink, $oLinks

$file = "Linkss.txt"

$oIE = _IECreate ("http://www.oneplace.com/ministries/paws-and-tales/listen/broadcast-archives.html")
$oLinks = _IELinkGetCollection ($oIE)
$iNumLinks = @extended
While $state = 0
For $oLink In $oLinks
    $Count += 1
    If $count > 22 Then
FileWriteLine($file, $oLink.href)
MsgBox(0, "Test", "Current count is: " & $Count & @CRLF & "Current link is: " & $oLink.href)
EndIf
If $Count > 39 Then
    MsgBox(0, "Test", "Count has reached end!")
    $state = 1 ; Here is where I am trying to break the loop
EndIf
Next
WEnd

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

ExitLoop

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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...