How to extract text from textarea?

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
bugmenot666
Posts: 39
Joined: Wed Apr 08, 2009 2:01 pm

How to extract text from textarea?

Post by bugmenot666 » Tue Dec 07, 2010 5:40 pm

I'm using the iMacros Firefox addon. What I'm trying to do is copy the text and save it in a txt. But,the problem I'm facing is I can't get iMacros to get the textarea element. No matter where I click on the page I get no response. I'm hoping if you guys could help me out.

The page source from firebug:

Code: Select all

<body bgcolor="white" onload="self.focus()" linkifying="true" linkifycurrent="0" linkifymax="0" style="">
<textarea onclick="this.select();" onmouseover="this.select();" onfocus="this.select();" style="width: 380px; height: 380px;">
544191205,20100904,20101205,347
191303666,20101017,20101203,66
423266821,20101104,20101206,55
631973840,20101105,20101204,45
296457418,20101113,20101206,45
601542564,20101114,20101205,45
113562059,20101114,20101202,43
23450288,20101118,20101205,40
808923114,20101124,20101206,32
752364614,20101126,20101206,32
469679480,20101204,20101206,4
350121088,20101206,20101206,4
</textarea>
</body>
Here's the screenshot of how the page looks like:
Image

How should the code look like in the macro? Is it like this?
TAG POS=1 TYPE=TEXTAREA ATTR=TXT* EXTRACT=TXT

The text changes everyday. And as for saving it into a txt is it like this?
SAVEAS TYPE=EXTRACT FOLDER=D:\folder FILE=sometxtname.txt
Tom, Tech Support
Posts: 3601
Joined: Mon May 31, 2010 4:59 pm

Re: How to extract text from textarea?

Post by Tom, Tech Support » Fri Dec 10, 2010 10:20 pm

How should the code look like in the macro? Is it like this?
TAG POS=1 TYPE=TEXTAREA ATTR=TXT* EXTRACT=TXT
Almost, you left out a colon:
TAG POS=1 TYPE=TEXTAREA ATTR=TXT:* EXTRACT=TXT
And as for saving it into a txt is it like this?
SAVEAS TYPE=EXTRACT FOLDER=D:\folder FILE=sometxtname.txt
Correct.
Regards,

Tom, iMacros Support
bugmenot666
Posts: 39
Joined: Wed Apr 08, 2009 2:01 pm

Re: How to extract text from textarea?

Post by bugmenot666 » Mon Dec 13, 2010 6:08 am

Thanks, It worked out nicely except the lines are all connected. When it is saved to a txt it turns out like this,

Code: Select all

544191205,20100904,20101205,347191303666,20101017,20101203,66423266821,20101104,20101206,55
Is there a way to make them to break? So they would look like this instead?

Code: Select all

544191205,20100904,20101205,347
191303666,20101017,20101203,66
423266821,20101104,20101206,55
Tom, Tech Support
Posts: 3601
Joined: Mon May 31, 2010 4:59 pm

Re: How to extract text from textarea?

Post by Tom, Tech Support » Thu Dec 16, 2010 6:04 pm

Hi bugmenot666,

Since the entire TEXTAREA contents are treated as a single field, you would need to call your macro from a script to parse the contents of this field into separate lines.
Regards,

Tom, iMacros Support
Post Reply