Abnormal numbering for A Links

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

Abnormal numbering for A Links

Post by Alpha_AI » Fri Oct 05, 2007 10:38 am

Hello there,

I am going through a webpage and taking down all the links so that i can use the macroscheduler to visit each link.

I was successful with getting each and but the links are a different story for this website.

example:
First A link that i need is: A13
second is: A17
Third is: A20
Fourth is: A22
Fifth is: A26

I cant use simple addition (+3) to take the A links
and near each link however is a tag and it can be retrieved via simple addition.
Is there anyway if i can magically go up or down one or two listitems in the combobox to get the link tag that i need using code.

I hope i made myself clear.

Kind regards,
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 10:59 am

Instead of using the drop down on the toolbar, try it with Tools/Tag Extraction Wizard instead. Do you get the same results?

Regardless of what these say what happens if you write code that loops through, incrementing by one each time - say from 1 thru 10. Pop up a message box to show the value of each one returned.

Really to do what you want you don't need to use the tag extraction tools - you just want to write some code.
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 3:54 pm

Thanks for your response marcus,

I stepped through each iteration with the debugger starting from the first link that i want which was A14 and stopped at the last Link which was A48

The following had text in it which is what im after:
A14,A18,A22,A26,A29,A33,A36,A40,A44,A48.

So the simple addition wont work.
Other ALinks inbetween that list of numbers are all empty.
eg.
A15=
A16=
A17=

so i think something like this should handle it.
pseudo-code
If A15 is equal to nothing then Links[%counter%]=
otherwise Links[%counter%]=A15


If>A15=
Links[%Counter%]=
ELSE
Links[%Counter%]=A15
ENDIF

I'll try it out tommorow.
Many thanks for your huge help.

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 3:56 pm

Indeed. Just loop through all, but skip any that are blank.
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 » Sat Oct 06, 2007 4:34 am

ok so i gave it a go and yes it works, i can get the links that way.

Im using this to pull information off some profiles setup on a website and pasting it into openoffice calc.

Since most websites on a lot of sites allow their customers to not show some of their profile information or hide a field it if they havent any information into the field contents, it causes more code to handle the situation.

Im trying to go for a consistent way of doing it as if it was to pull of the content from all profiles on one particular site or any site if ever needed.

SRT>TDTAGS
Let>NumTimesToLoop=21
Let>TotalCount=0
Let>Counter=0
Let>Index=80
Label>StartOfTDLoop
//Let>B6_SIZE=4098
LibFunc>hIE,ExtractTag,r,%IE[0]%,,TD,Index,0,MYNAME
MidStr>r_6,1,r,MYNAME
Let>Values[%Counter%]=%MYNAME%
Add>Counter,1
Add>Index,4
If>Counter=NumTimesToLoop,FinishTDLoop
Goto>StartOfTDLoop
Label>FinishTDLoop


Let>NumTimesToLoop=21
Let>Counter=0
Label>StartOfSecondTDLoop
SetFocus>Untitled1 - OpenOffice.org Calc

//Check if the contents is a phone number
If>%Counter%=8
Position>(,Values[8],1,CurvedBrackPos
Position>-,Values[8],1,MinusPos
if>{(%CurvedBrackPos%0) AND (%MinusPos%TotalCount,1
ENDIF
ENDIF

//Check if the contents is a website address
If>%Counter%=10
Position>.com,Values[10],1,DotComPos
if>%DotComPos%=0
Press TAB
Add>TotalCount,1
ENDIF
ENDIF

//Check if the contents is on more than one line
If>%Counter%=11
Let>data=Values[11]
Separate>data,CRLF,lines
If>lines_count>1
Let>comma=,
StringReplace>data,CRLF,comma,Values[11]
Endif
ENDIF


eg. Phone Numbers | Email Address

It checks to see what the content is, if the column is supposed to be phone numbers and the contents is an email address then we hit tab to move onto the next field which is 'email address' (which means there mustnt be any phone number in the current profile).

This is fine for contents where i have to detect ( and - for phone numbers and @ for emails.
but for other detections there is problems:
eg.

State | Country

So im in the state column and contents appear to country, so i should I hit tab
then enter it but how does a computer distinguish a state from a country without
the computer knowing all the states belonging to a country.

I need a better way. This way could cause some inconsistency data and cause to much rewrites of code IMHO.

Any clues?

Ben

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