Sign in to follow this  
Followers 0
Maximus1

[solved] $string=_StringBetween....

9 posts in this topic

#1 ·  Posted (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 by Maximus1

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by 871

Share this post


Link to post
Share on other sites

same error :-(

Share this post


Link to post
Share on other sites

#4 ·  Posted (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.)

:blink:

Edited 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

Share this post


Link to post
Share on other sites

_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.)

:blink:

ähmmmmmm no.

how do i do this?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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])

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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)

:blink:


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

Share this post


Link to post
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
Sign in to follow this  
Followers 0