Sign in to follow this  
Followers 0
Regency

Extracting a word from a webpage source

9 posts in this topic

i have my prog pull up a page but i need it to pull a string from inside a sentance. like..

SUCCESS: answer_result="saloonsPrince"

I need to pull out SaloonsPrince

with out the " "

anyone have any idea, i thought about using the html body read, but then cant figure out how to only read the "" stuff..

anyone got ideas?

Share this post


Link to post
Share on other sites



i have my prog pull up a page but i need it to pull a string from inside a sentance. like..

SUCCESS: answer_result="saloonsPrince"

I need to pull out SaloonsPrince

with out the " "

anyone have any idea, i thought about using the html body read, but then cant figure out how to only read the "" stuff..

anyone got ideas?

Read it all into a string, then pull out what you want with StringRegExp(), or using other string manipulation functions like StringInStr() and StringMid().

:P


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

#3 ·  Posted (edited)

$read = _IEBodyReadText($Test)
$string = _StringBetween($read,""",""","")
MsgBox('','',$string)

this was my idea...

but i keep getting zeor, as it saying the data isnt processing..

anyone got any ideas on why?

EDIT:

It wont always be saloonsprince it changes in time, i just need it to read between the " " maybe thats better explination?

Edited by Regency

Share this post


Link to post
Share on other sites

$read = _IEBodyReadText($Test)
$string = _StringBetween($read,""",""","")
MsgBox('','',$string)

this was my idea...

but i keep getting zeor, as it saying the data isnt processing..

anyone got any ideas on why?

EDIT:

It wont always be saloonsprince it changes in time, i just need it to read between the " " maybe thats better explination?

You specified text between "," and NUL. Perhaps you meant _StringBetween($read, '"', '"'). Note the double quotes are enclosed in single quotes. You can specify a literal double quote by doubling it up inside the outer quotes, but that results in four double quotes in a row, like this: _StringBetween($read, """", """").

Just looking for anything between double quotes is pretty broad, and you are likely to get more hits than you want.

:P


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

Well, actually the thing i posted before is from the source and is the only thing on the page. which what you told me to do only made my text empty,as i would think that means it getting nothing when looking inbetween the "".

Correct?

Share this post


Link to post
Share on other sites

Well, actually the thing i posted before is from the source and is the only thing on the page. which what you told me to do only made my text empty,as i would think that means it getting nothing when looking inbetween the "".

Correct?

I think you missed that _StringBetween() returns an array. Your result is in $string[0].

:P


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

I aint gunna lie, i am so lost.. i cant make this work even with the addition of the [0] it now throws a error

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

#include<ie.au3>
#Include <String.au3>
Global $string[0]
$Test = _IECreate("",0,1,1,0)
_ieloadwait($test)
$read = _IEBodyReadText($Test)
$string[0] = _StringBetween($read,'"','"')
MsgBox('','',$string[0])oÝ÷ ÚØZ¶Ì!jØ ¢Öî¶+dyêmº0xzºè¬@ÈM«­¢+Ø¥¹±Õ±Ðí¥¹ÔÌÐì(%¹±Õ±ÐíMÑÉ¥¹¹ÔÌÐì((ÀÌØíQÍÐô}%
ÉÑ ÅÕ½ÐìÅÕ½Ðì°À°Ä°Ä°À¤)}¥±½Ý¥Ð ÀÌØíÑÍФ(ÀÌØíÉô}%   ½åIQáÐ ÀÌØíQÍФ(ÀÌØíÍÑÉ¥¹ô}MÑÉ¥¹   Ñݸ ÀÌØíÉ°ÌäìÅÕ½ÐìÌäì°ÌäìÅÕ½ÐìÌäì¤)5Í ½à ÌäìÌäì°ÌäìÌäì°ÀÌØíÍÑÉ¥¹lÁt¤

fixed it, my nub mistake :P thanks for the help

Edited by Regency

Share this post


Link to post
Share on other sites

#include<ie.au3>
#Include <String.au3>
Global $string
$Test = _IECreate("",0,1,1,0)
_ieloadwait($test)
$read = _IEBodyReadText($Test)
$string = _StringBetween($read,'"','"')
MsgBox('','',$string[0])

You're misunderstanding how an array works.

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