Jump to content

Extracting a word from a webpage source


Regency
 Share

Recommended Posts

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?

Link to comment
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
Link to comment
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?

Edited by Regency
Link to comment
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
Link to comment
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?

Link to comment
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
Link to comment
Share on other sites

#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
Link to comment
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.

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