Jump to content

Recommended Posts

Posted

Hello Im new to AutoIT and would appreciate any suggestions you could give me.

Im trying to write a program that can use and save information off of the internet. My idea is that I will use INetGetSource to get the source and then use AutoIT to extract the info I need. The first problem I am having is I can get INetGetSource to save to a variable but not to a file. The second problem Is I will only need a couple pieces of data off each website and there would be a lot of info to sift through once I get the html source. Im sure I could can write a program to do this but I cant help to think that some of you more expensed programmers might know a trick to just get the info off the webpage that I need. For example on one website I will be look to see if they a have a couple of books that I am looking for and if they do the only info I what to save to a file is the book authors name which changes with each new search. I could use any ideas you might have.

Thanks!

Posted

Im trying to write a program that can use and save information off of the internet.

I've done similar, Use INetGet() to save the whole html page as a file, then FileOpen() to begin reading the file

$file = FileOpen("c:\web.html",0)
$outFIle = FileOpen("c:\output.txt",2)

While 1
$line = FileReadLine($file)
if @error then
exitloop
endif

if StringInStr($line, "Author:") THen
FIleWriteLine($outFile, $line)
EndIf

Wend

This will open a file for reading and a file for writing, then loop through every line of the web.html looking for ones that say Author:, and saving them out to another file.

YOu probably dont want to search for Author, you will need to look at the actual web.html and skim it in a plaintext editor to see where the data you need will lie as a template.

Posted

Thank You! Youre my hero thats exactly what I need!!

I've done similar, Use INetGet() to save the whole html page as a file, then FileOpen() to begin reading the file

$file = FileOpen("c:\web.html",0)
$outFIle = FileOpen("c:\output.txt",2)

While 1
$line = FileReadLine($file)
if @error then
exitloop
endif

if StringInStr($line, "Author:") THen
FIleWriteLine($outFile, $line)
EndIf

Wend

This will open a file for reading and a file for writing, then loop through every line of the web.html looking for ones that say Author:, and saving them out to another file.

YOu probably dont want to search for Author, you will need to look at the actual web.html and skim it in a plaintext editor to see where the data you need will lie as a template.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...