J0ker Posted July 12, 2007 Share Posted July 12, 2007 Hi, I heard a while ago about a internet protection using _InetGet.What I'm trying to do at the start of my program is: 1. Read a variable in a .txt file hosted on a website (ex: www.mywebsite.com/file.txt) 2. If the variable is equal to something then do something The things with _InetGet is that it download the file. Is there a function that will only "read" in the file and retrieve a value? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 12, 2007 Moderators Share Posted July 12, 2007 Anything wrong with the function that's 2 functions under that one in the help file? (_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 More sharing options...
J0ker Posted July 12, 2007 Author Share Posted July 12, 2007 (edited) Anything wrong with the function that's 2 functions under that one in the help file? (_InetGetSource())From the help file:Gets the source from an URL without writing a temp file.#include <INet.au3>_INetGetSource ( $s_URL )Well If I get the source, how can I read it?SmOke, I'm trying to do something similar as you did with your first Encoder. The internet protection that let you control your program anywhere. Edited July 12, 2007 by J0ker Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 12, 2007 Moderators Share Posted July 12, 2007 From the help file:Well If I get the source, how can I read it?SmOke, I'm trying to do something similar as you did with your first Encoder. The internet protection that let you control your program anywhere.Try it out, I just tested it on one of my sites, and it read the text file fine. 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 More sharing options...
J0ker Posted July 12, 2007 Author Share Posted July 12, 2007 (edited) Try it out, I just tested it on one of my sites, and it read the text file fine.Yep I just tried it too and it works well. It's easy if there's only 1 word but how can I deal with a txt file full of text (How can I retrieve a specific info in there)?Let's say I want to check the 12th character and display it in a msg box. How could I do that knowing that there's no space between my characters and it's seem just like a big number.Convert it into a string and then analyse it?1312425436476575687698569877897 Edited July 12, 2007 by J0ker Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 12, 2007 Moderators Share Posted July 12, 2007 Yep I just tried it too and it works well. It's easy if there's only 1 word but how can I deal with a txt file full of text (How can I retrieve a specific info in there)? Let's say I want to check the 12th character and display it in a msg box. How could I do that knowing that there's no space between my characters and it's seem just like a big number. Convert it into a string and then analyse it?Are you kidding? There are tons of ways with the string functions. Here's the easiest one to understand:$sString = '1312425436476575687698569877897' $sMid = StringMid($sString, 12, 1) MsgBox(0, '', $sMid) 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 More sharing options...
J0ker Posted July 13, 2007 Author Share Posted July 13, 2007 (edited) Thanks ! I don't know why this is happening but even if the text file doesnt exist , it return a value. I cant set an @error because it always return something and I dont know why: #include <INet.au3> $Txt= _INetGetSource('www.mywebsite.com/file.txt') $sString = String($Txt) $sMid = StringMid($sString, 3, 1) MsgBox(0, "", $sMid)oÝ÷ Ù:òr§)බ¸§È½©nz{¦mê⵩pk++zÛ«§!j¶µêÞ½éâ~Ø^·_W¡ë'µìb²ÖjYhØb²Èxz0r¥tµ©Þ®º+§¶Æ×âçhzÉí{¬´@ÈLò¢ëkÊØZµ«¢+Ø¥¹±Õ±Ðí%9йÔÌÐì(ÀÌØíQáÐô}%9ÑÑM½ÕÉ ÌäíÝÝܹµåÝͥѹ½´½¥±¹ÑáÐÌäì¤()5Í ½à À°ÅÕ½ÐìÅÕ½Ðì°ÀÌØíQáФ It return: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>mywebsite.com</title> <link rel="shortcut icon" href="http://static.hitfarm.com/template/qing/images/qing.ico" type="image/x-icon" /> </head> <frameset cols="1,*"> <frame name="hftop" src="/top.php?d=mywebsite.com" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" noresize="noresize" /> <frame name="hfdisplay" src="/landing.php?d=mywebsite.com" scrolling="auto" frameborder="0" marginwidth="0" marginheight="0" noresize="noresize" /> <noframes> <body> <p>This page requires frames</p> </body> </noframes> </frameset> </html> It's why my String is working but like I said above, How can I set an @error when the txt file doesnt exist on the site? Edited July 13, 2007 by J0ker Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 13, 2007 Moderators Share Posted July 13, 2007 I'm not going to refer to my signature... but I should... #include <INet.au3> $Txt= _INetGetSource('http://www.putinanactuallinkthatdoesntworkorthatisntredirectedtoadifferentpartofthesiteifitdoesntexist.com/Doh.txt') MsgBox(0, @error, $Txt) 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now