Maximus1 Posted July 12, 2010 Posted July 12, 2010 (edited) hi i want to download a website and only need some information from it. when i let it run, the data gets loeded to the file but _stringbetween can`t set $string and i get an error : Return $string[0] ^ ERROR here is my code, can you tell me what i`ve done wrong?? #include <IE.au3> #include <String.au3> #include <Array.au3> #include <INet.au3> $a="000001" $file="temp.txt" $Stringleft = "<title>" $Stringright = "</title>" $source=INetGet("http://www.heise.de",""& $file,0,0) $string=_StringBetween($file,$Stringleft,$Stringright) Return $string[0] Edited July 12, 2010 by Maximus1
StandardUser Posted July 12, 2010 Posted July 12, 2010 (edited) You misplaced the string to search variable in _StringBetween($file,$Stringleft,$Stringright), should be _StringBetween($source,$Stringleft,$Stringright) Edit: Nope, InetGet returns handle or number of bytes, so you should read temp.txt with FileRead and then pass it to StringBetween or use InetRead and convert return value to string Edited July 12, 2010 by 871
PsaltyDS Posted July 12, 2010 Posted July 12, 2010 (edited) same error :-(_StringBetween() returns an array, did you display it with _ArrayDisplay to see what you had? (And display $source to check what you had to begin with.) Edited July 12, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Maximus1 Posted July 12, 2010 Author Posted July 12, 2010 _StringBetween() returns an array, did you display it with _ArrayDisplay to see what you had? (And display $source to check what you had to begin with.) ähmmmmmm no.how do i do this?
semedboy Posted July 12, 2010 Posted July 12, 2010 hi i want to download a website and only need some information from it. when i let it run, the data gets loeded to the file but _stringbetween can`t set $string and i get an error : Return $string[0] ^ ERROR here is my code, can you tell me what i`ve done wrong?? #include <IE.au3> #include <String.au3> #include <Array.au3> #include <INet.au3> $a="000001" $file="temp.txt" $Stringleft = "<title>" $Stringright = "</title>" $source=INetGet("http://www.heise.de",""& $file,0,0) $string=_StringBetween($file,$Stringleft,$Stringright) Return $string[0] Hi, you can't use "return" unless you have a function.... #include <IE.au3> #include <String.au3> #include <Array.au3> #include <INet.au3> $a="000001" $file="temp.txt" $Stringleft = "<title>" $Stringright = "</title>" $source=INetGet("http://www.heise.de",""& $file,0,0) $string=_StringBetween($file,$Stringleft,$Stringright) MsgBox(0,"",$string[0]) *semedboy 0x5748415420444F20594F552057414E543F
StandardUser Posted July 12, 2010 Posted July 12, 2010 Tried this, works #include <IE.au3> #include <String.au3> #include <Array.au3> #include <INet.au3> $a="000001" $file="temp.txt" $Stringleft = "<title>" $Stringright = "</title>" INetGet("http://www.heise.de",""& $file,0,0) $source= FileRead("temp.txt") $string=_StringBetween($source,$Stringleft,$Stringright) MsgBox(0,"", $string[0])
Maximus1 Posted July 12, 2010 Author Posted July 12, 2010 Tried this, works #include <IE.au3> #include <String.au3> #include <Array.au3> #include <INet.au3> $a="000001" $file="temp.txt" $Stringleft = "<title>" $Stringright = "</title>" INetGet("http://www.heise.de",""& $file,0,0) $source= FileRead("temp.txt") $string=_StringBetween($source,$Stringleft,$Stringright) MsgBox(0,"", $string[0]) ha thanks. :-) it can be so easy.... ok you see i`m new to autoit and programming.
PsaltyDS Posted July 12, 2010 Posted July 12, 2010 it can be so easy.... Very easy: #include <IE.au3> $oIE = _IECreate("http://www.autoitscript.com", 0, 0) $sTitle = _IEPropertyGet($oIE, "title") MsgBox(64, "Title", "Title = " & $sTitle) _IEQuit($oIE) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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