Computing.Net > Forums > Programming > script question

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

script question

Reply to Message Icon

Name: cykage
Date: April 18, 2005 at 17:33:58 Pacific
OS: xp
CPU/Ram: na
Comment:

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?



Sponsored Link
Ads by Google

Response Number 1
Name: DRY_GIN_
Date: April 21, 2005 at 01:20:04 Pacific
Reply:

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 executed

if 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=nothing

now 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 Function

as 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 function

and so on

I hope i got your question right...


have no idea why i came to this planet


0
Reply to Message Icon

Related Posts

See More


Batch file help dynamic memory question



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: script question

scripting question www.computing.net/answers/programming/scripting-question/8089.html

Scripting question www.computing.net/answers/programming/scripting-question/3931.html

FTP scripting question www.computing.net/answers/programming/ftp-scripting-question/13725.html