Sign in to follow this  
Followers 0
Ram

Getting particular Text from website

13 posts in this topic

#1 ·  Posted (edited)

Hi,

I am doing a small project where I have to enter some data to a text box in a website using the Internet explorer and I click submit which generates a list of data in a new page. Now I want to get a particular text from the generated list in new page. Is this possible if so How do I go about doing it?

As of now my script enters data and clicks the submit button to get the list of data in a new page. I have to do the get text part.

To make it easier I have attached jpg to show what needs to be extracted from the website. post-19232-1187140058_thumb.jpg

Can anyone let me know how do I go about doing this?

Awaitng your response!

Edited by Ram

Share this post


Link to post
Share on other sites



Picture doesn't help much... need to see the HTML source of the page.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Picture doesn't help much... need to see the HTML source of the page.

Dale

Attached HTML source page.. Please take a look at it.. Thanks!

matching.html

Edited by Ram

Share this post


Link to post
Share on other sites

Attached HTML source page.. Please take a look at it.. Thanks!

matching.html

All of the content is enclosed in <PRE> tags - there is therefore no structure to help you.

Suggest you use _IEBodyReadText and then String* commands or _String* UDFs to pull what you want.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

All of the content is enclosed in <PRE> tags - there is therefore no structure to help you.

Suggest you use _IEBodyReadText and then String* commands or _String* UDFs to pull what you want.

Dale

Thanks Dale. Can you please give me an example.. it would be really helpful?

Share this post


Link to post
Share on other sites

Thanks Dale. Can you please give me an example.. it would be really helpful?

I'm sure it would be. Can you give us an example of what you've tried so far?

Take a look in the helpfile first please - there are examples there. Try some code and then post your questions with your code.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

I'm sure it would be. Can you give us an example of what you've tried so far?

Take a look in the helpfile first please - there are examples there. Try some code and then post your questions with your code.

Dale

I gave it a try but couldn't help me out..Here is what I did..

$oIE = _IECreate("http://www.leoastro.com/mat_frm.htm")
$sText = _IEBodyReadText ($oIE)
MsgBox(0, "Test", $sText)

but I get 0 in message box. What is wrong here?

Share this post


Link to post
Share on other sites

Could be Frames involved... try _IEDocReadHTML($oIE) instead and it will shoulw you the full source. If there are Frames, then you'll need to learn about _IEFrameGetObjByName as well.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Could be Frames involved... try _IEDocReadHTML($oIE) instead and it will shoulw you the full source. If there are Frames, then you'll need to learn about _IEFrameGetObjByName as well.

Dale

Yep you are right.. The website is done in frames. So I did it this way

$oFrame = _IEFrameGetObjByName ($oIE, "matching")
$sText = _IEBodyReadText($oFrame)
MsgBox(0, "Body Text", $sText)

I got the whole page in the message box but how do I pick a particular word from the object created?

Edited by Ram

Share this post


Link to post
Share on other sites

Good. So now you need to parse your string to pull what you want. There are many ways to do this, but start with StringInStr to find it and StringMid to pull it out.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Good. So now you need to parse your string to pull what you want. There are many ways to do this, but start with StringInStr to find it and StringMid to pull it out.

Dale

Thanks Dale for your great help... Here is what I did..

$oFrame = _IEFrameGetObjByName ($oIE, "matching")
$sText = _IEBodyReadText($oFrame)
$var4 = StringMid($sText, 8751, 2)
MsgBox (0, "0", $var4)

The above code is suitable for one single data but when I'm using for different set of data the value that I'm getting to the message box is not in the same position. So I get blank space or different charecter in the msgbox. So what should I do with regards to this scenario... Is it possible to find particular string and then use stringMid? If so how do I go about doing?

Awaiting your response!

Edited by Ram

Share this post


Link to post
Share on other sites

Yes, as I mentioned in the previous reply "StringInStr to find it and StringMid to pull it out"

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Yes, as I mentioned in the previous reply "StringInStr to find it and StringMid to pull it out"

Dale

Oops sorry Dale.. I thought I had put the script that I tried.

$oFrame = _IEFrameGetObjByName ($oIE, "matching")
$sText = _IEBodyReadText($oFrame)

$a = StringInStr($sText, "Marks")
MsgBox (0,"0",$a);-- This comes out with a value where ever the particular text is situated.

Sleep (900)

$var = StringMid("$a", 2, 2)
MsgBox (0,"0",$var);-- Doesn't give the right message?

Is there anything that I have missed? Let me know..

Thanks Dale!

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