Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I don't know too much about scripting, but here's my question. I want to create a script that goes through URLs (Each URL is the same except for a number, which I want to use a loop for) and I want it to log a string on each page. Would something like this be simple in say.. JavaScript?

if you will run this from your computer just create simple visual basic script (vbs)
file
if you double click on it it will be executedif you talking about some web site where you want to insert this script to html when is a different story
but visual basic script you can also use in ASP page on web server
best way to write scrpts for local computer is microsoft excel where you could insert button and write visual basic script for this button and script will put all results you want into excel
so in case of visual basic of all 3 kinds of programs (VBS,ASP, Excel VB) it would be something like that
Set http = CreateObject("Microsoft.XmlHttp")
for i = 1 to 1000
link = "http://www.webside/page" & i & ".htm"
http.open "GET", link, False
http.send ""
body = http.responseText
next
set http=nothingnow you need to extract something from the "body" of the page and add it somethere
you can use this usefull function to extract something by mask:
Function extst(st, prm1, prm2)
extst = ""
p1 = InStr(1, st, prm1, vbTextCompare) + Len(prm1)
If p1 < 1 Then Exit Function
p2 = InStr(p1 + Len(prm1), st, prm2, vbTextCompare)
If p2 < p1 Then Exit Function
extst = Mid(st, p1, p2 - p1)
End Functionas an example
extracted = extst(body,"a href='","'")
will extract content of the first url on that page.and last step will be to save information
in case of excel you will just add it to some cells
or if you want to write to the file you can use something like that:st = "some text i want to save"
CreateObject("Scripting.FileSystemObject").CreateTextFile("LogFIle.txt",true).white(st)
or if you want to append to the end of the file use OpenTextFile functionand so on
I hope i got your question right...
have no idea why i came to this planet

![]() |
Batch file help
|
dynamic memory question
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |