Re: [Wtr-general] Need to fetch the ID

2007-06-12 Thread Željko Filipin

Hi Sapna,

You should really read something about Regular Expressions. You can start
here.
http://www.rubycentral.com/book/tut_stdtypes.html
There is chapter named Regular Expressions.

For now, try this (Bret left it in comment at my blog).

(ie.link(:text, RE: Check Copy Request).href =~ /id=(.*)/)[1]

Zeljko
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

[Wtr-general] Need to fetch the ID

2007-06-11 Thread sapna
Hi,

I had posted this question earlier but did not get any information. So wanted 
to put the question again. Need help on this. Below is the HTML code. 

1 I want to check whether the mail is read or unread depending on the mail 
icon(first line of HTML)
2 Want to fetch the id generated (id=1303) depending on which I will click on 
the message link and that would take me to read message window.

img src=/AppsUIWeb/Themes/TopTabMenu/Images/mailopen.gifnbsp;6/8/2007
/tdtd
a 
href=/AppsUIWeb/SelfService/MessageDetail.aspx?id=1303messageToUser=TrueRE: 
Check Copy Request/a
/tdtd

Thanks in advance.

Regards
Sapna
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general


Re: [Wtr-general] Need to fetch the ID

2007-06-11 Thread Željko Filipin

On 6/11/07, sapna [EMAIL PROTECTED] wrote:


a
href=/AppsUIWeb/SelfService/MessageDetail.aspx?id=1303messageToUser=TrueRE:
Check Copy Request/a



Sapna,

To find id of that link you have to know some other attribute of that link.
I will assume that you know text RE: Check Copy Request

This is how you can get href attribute of that link.

irb ie.link(:text, RE: Check Copy Request).href
=
file:///C:/AppsUIWeb/SelfService/MessageDetail.aspx?id=1303messageToUser=True

This will extract 1303.

irb m = /id=(1303)/.match(ie.link(:text, RE: Check Copy Request).href)
= #MatchData:0x2d147b8

irb m[1]
= 1303

For more information see class MatchData (
http://phrogz.net/ProgrammingRuby/ref_c_matchdata.html)

Zeljko
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] Need to fetch the ID

2007-06-11 Thread sapna
Hi Zeljko,

I have a quesion on the code you sent me. Kindly find the question below the 
code.

This will extract 1303.

irb m = /id=(1303)/.match(ie.link(:text, RE: Check Copy Request).href)
= #MatchData:0x2d147b8

Q: Here I mention the id but I want to fetch automatically because the id keep 
changing for every message replied. Hope my explaination is fine.

irb m[1]
= 1303
___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general