Contents in a TD tag consumes up five lines of text & Pa

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Alpha_AI
Pro Scripter
Posts: 61
Joined: Wed Sep 19, 2007 9:30 am

Contents in a TD tag consumes up five lines of text & Pa

Post by Alpha_AI » Fri Oct 05, 2007 6:47 am

Hello there,

I am retrieving the td tags using webrecorder, and pasting the contents into openoffice calc.

It works successfully however content in one td tag consume up five lines and when it pastes it into openoffice calc, it pastes into five cells (all in one column). Instead i want it to be pasted all in one cell.

eg.
Td contents look like this

$30/30 min
$20/hr
$40/90minutes

but i need it like this

$30/30 min, $20/hr, $40/90 minutes.

So i can get the content of the td tag but i dont know how to retrieve the content of each line. I was thinking something like check position if there is a \n. if there is a new line, then copy all characters upto \n into a new array of string and then delete the first line and repeat until no more lines left.

Any clues on how i might pull this off?

Ben

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Oct 05, 2007 8:19 am

Replace carriage return line feeds with commas?

Let>comma=,
StringReplace>data,CRLF,comma,data

That will replace all occurences of CRLF pairs in the string with a comma. Which I think is what you want.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Alpha_AI
Pro Scripter
Posts: 61
Joined: Wed Sep 19, 2007 9:30 am

Post by Alpha_AI » Fri Oct 05, 2007 8:28 am

I need to create a routine that will do this

Let>comma=,
StringReplace>data,CRLF,comma,data

only when there is text on more than one line.

How do i get the count of lines in a td tag?
or Is it possible to count the CRLF in a tag?

Ben

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Oct 05, 2007 8:38 am

>How do i get the count of lines in a td tag? or Is it
>possible to count the CRLF in a tag?

Code: Select all

Separate>data,CRLF,lines
If>lines_count>1
  Let>comma=,
  StringReplace>data,CRLF,comma,data 
Endif
Or you may just need:

Code: Select all

Position>CRLF,data,1,p
If>p>0
  ..
  .. data contains at least one CRLF pair ... 
  ..
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts