Jump to content

How can I open an Internet file in AutoIt, scan a line, then do something if the line reads 1, and do something else if the line reads 2?


sandman
 Share

Recommended Posts

Sorry for the long title. Let's give an example...

I want to look in a file called home.txt on GeoCities and see what the first line reads. If this first line reads yes, then the script will execute a program. If the first line reads no, then the script will exit. NOTE: This file is on the internet.. not on my hard drive.

I'm pretty sure that this is possible, but how would I go about doing this?

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

So how do I have the script identify what is in that line and then execute something (probably if statement)?

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

So how do I have the script identify what is in that line and then execute something (probably if statement)?

$url = ;Put URL of file here
$file = InetGet($url)
$read = FileRead($file)
$check1 = ;Put what you want to check for here
$check2 = ;Put what you want to check for here
If $read = $check1 Then
    ;Put what you want to happen here
ElseIf $read = $check2 Then
    ;Put what you want to happen here
EndIf
Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

Okay... one more thing. If there is a URL in that file, how do I have the script automatically download the file(s)?

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

  • Moderators

$url = ;Put URL of file here
$file = InetGet($url)
$read = FileRead($file)
$check1 = ;Put what you want to check for here
$check2 = ;Put what you want to check for here
If $read = $check1 Then
    ;Put what you want to happen here
ElseIf $read = $check2 Then
    ;Put what you want to happen here
EndIf
Might want to re-read InetGet() and it's parameters... you probably meant to use _InetGetSource().

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Okay... one more thing. If there is a URL in that file, how do I have the script automatically download the file(s)?

Are you kidding? 1st, break down logically how you think it would happen, then try something, then... and ONLY then, if you still need help, show what you've tried and explain where you think it may be failing at.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Might want to re-read InetGet() and it's parameters... you probably meant to use _InetGetSource().

No I meant the file's URL, I guess I should have been more specific.

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
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...