Friday, 19 April 2013

Finding Total number of Unread emails present in Gmail Inbox

1. Finding Total number of Unread emails present in Gmail Inbox


Our objective is to find how many unread emails are there in our Gmail Inbox.
This can be done if we can get number out of Inbox (xxx) string.

Steps to follow:
1.Log onto Gmail
2.From Inbox Page, get text Inbox (xxx) in a variable
3.Capture xxx in a variable. It would give exact number of unread emails.

// If we add Inbox(569) link in OR then we get below hierarchy.

'browser("Inbox (569) - sumitraut01@gmai").Page("Inbox (569) - sumitraut01@gmai").Link("Inbox (569)")

//The problem here is our code would not work if number of unread mail is not 569.This problem can be solved easily if Descriptive Programming is used

//Code given below makes our script generic:
//I have used Regular expression and Descriptive Programming here. 

//^Inbo= any  string sarting with Inbo.
//.* anything

dim Inboxstring
Inboxstring=browser("title:=^Inbo.*").Page("title:=^Inbo.*").Link("innertext:=^Inbo.*").GetROProperty("innertext")
// Inbox string has value Inbox (xxx)

totalstring=split(Inboxstring)
countm=totalstring(1)

//Countm now  has value (xxx)

newcountm=replace(countm,"(","")
//newcountm has value  xxx)

newcountm2=replace(newcountm,")","")
//newcountm2 has value  xxx
Print  newcountm2





No comments:

Post a Comment

Spring Boot : Exception Handler 14