pattern extraction from html code

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
nebben
Newbie
Posts: 4
Joined: Sun Sep 25, 2005 5:32 pm

pattern extraction from html code

Post by nebben » Sun Sep 25, 2005 7:31 pm

hi,

html code:
firm AreceiverUS$ 99,0
firm BrecorderUS$ 129,0
firm CtunerUS$ 79,0

how can you extract the price?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sun Sep 25, 2005 8:28 pm

This code demonstates how to extract the price once you have identified a line with a price and put it into a variable. You can probably use ReadLn to get the line, and maybe looking for the $ sign can identify a line with a price but without seeing the file that's hard to say.

Let>myline=firm AreceiverUS$ 99,0
//find the $ sign
Position>$,%myline%,1,DollPos
//find the next DollPos,1
//set the length of the extract
Sub>LtPos,2
MidStr>%myline%,DollPos,LtPos,ThePrice
MessageModal>%ThePrice%

nebben
Newbie
Posts: 4
Joined: Sun Sep 25, 2005 5:32 pm

write the entire page

Post by nebben » Sun Sep 25, 2005 10:21 pm

As you do not know the line, how can you write the whole code of the site into a variable? Then look for the positions.

the script should be like:

1. go to url
2. extract price reciever

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Mon Sep 26, 2005 12:11 am

Look at HTTPRequest in the Help, that's the command you need to grab the source of the webpage to a variable or a file.

Can you post the URL? It's hard to help much more without seeing the source.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Extracting data from HTML

Post by adroege » Mon Sep 26, 2005 9:03 pm

I have done this, and the best method using Macro Scheduler is to use VBscript with RegEx (Regular Expressions) to match and extract patterns in data files. Regular expressions takes some study and lots of practice to get right, so don't expect it to be a quick fix.

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