It is currently May 4th, 2024, 6:24 am

SOLVED Gmail unread messages tooltip text with subject list

Get help with creating, editing & fixing problems with skins
User avatar
DioVikingoMetal
Posts: 29
Joined: January 26th, 2012, 10:40 am
Location: Italy

Re: Gmail unread messages tooltip text with subject list

Post by DioVikingoMetal »

Code: Select all


Get=(?(?=.*<title>).*<title>(.*)</title>.*<modified>(.*)T(.*)Z.*<author>.*<name>(.*)</name>)

[RSS]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=#Url#
RegExp="(?siU)Gmail - Inbox for (.*)@.*<entry>#Get##Get##Get#"
DecodeCharacterReference=1

[MeasureMailCount]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=#Url#
RegExp="(?siU)<fullcount>(.*)</fullcount>"
UpdateRate=100
StringIndex=1

[MeasureAccount]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=1

[MeasureDate1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=2

[MeasureTime1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=3

[MeasureItem1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=4
DecodeCharacterReference=1

[MeasureAuthor1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=5

[MeasureDate2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=6

[MeasureTime2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=7

[MeasureItem2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=8
DecodeCharacterReference=1

[MeasureAuthor2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=9

[MeasureDate3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=10

[MeasureTime3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=11

[MeasureItem3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=12
DecodeCharacterReference=1

[MeasureAuthor3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=13

[MeterMailIcon]
Meter=IMAGE
X=2
Y=2
ImageName=mailB.png
ToolTipTitle=[MeasureAccount] @ Gmail ([MeasureMailCount]) da leggere
ToolTipText=[MeasureDate1] [MeasureTime1] [MeasureAuthor1] ~ [MeasureItem1]#CRLF#[MeasureDate2] [MeasureTime2] [MeasureAuthor2] ~ [MeasureItem2]#CRLF#[MeasureDate3] [MeasureTime3] [MeasureAuthor3] ~ [MeasureItem3]
ToolTipIcon=#SKINSPATH#\Posta\64.ico
;ToolTipWidth=300
DynamicVariables=1
LeftMouseUpAction=!Execute ["https://mail.google.com/mail/"]

and the result is... creepy

Image
Image
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Gmail unread messages tooltip text with subject list

Post by jsmorley »

You are not yet quite getting how WebParser works.

In the RegExp, you will see things like this (.*) that in effect means "capture everything into a StringIndex". So you search for text up to the point you want to start capturing data, then put (.*) and text that tells it to stop capturing when you hit it.

So <FirstName>(.*)</FirstName>.*<LastName>(.*)</LastName> would put "Jeffrey" in StringIndex 1 and "Morley" in StringIndex 2, assuming that the actual HTML was <FirstName>Jeffrey</FirstName> <LastName>Morley</LastName>.

YOU don't decide or force what data is in what StringIndex. The RegExp does that, putting one (.*) "capture" in each, and in the order they are found. A Regular Expression reads the source HTML from top to bottom, left to right, like a book.

The measure will fail if you try to re-order things by changing the RegExp to an order that isn't top to bottom, left to right, like a book. Likewise, child measures need to use the correct StringIndex number that is returned by the RegExp in the parent measure. You can't and don't need to re-order things by putting measures in a particular order, or by trying to force them to use a StringIndex that is assigned for something else.

The code below will work.

I put the measures in the same order as the information is being captured in the RegExp, however make no mistake: I didn't need to. The order of the measures is of no significance other than making it more logical to read.

I changed the StringIndex numbers on the measures to correspond to what is in the RegExp. Those (.*) things, right? Just go through the RegExp and count them...

I think it would be good if you went through this little tutorial, and created the skin it works you through. Once the basics of WebParser are clear to you, you will find you can do a lot of cool things with it. But I sense we are not making progress the way we are going.

http://rainmeter.net/cms/Tips-WebParserPrimer

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Get=(?(?=.*<title>).*<title>(.*)</title>.*<modified>(.*)T(.*)Z.*<author>.*<name>(.*)</name>)
Url=https://xxxxx:xxxxx@gmail.google.com/gmail/feed/atom

[RSS]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=#Url#
RegExp="(?siU)Gmail - Inbox for (.*)@.*<entry>#Get##Get##Get#"

[MeasureMailCount]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=#Url#
RegExp="(?siU)<fullcount>(.*)</fullcount>"
UpdateRate=100
StringIndex=1

[MeasureAccount]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=1

[MeasureItem1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=2
DecodeCharacterReference=1

[MeasureDate1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=3

[MeasureTime1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=4

[MeasureAuthor1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=5

[MeasureItem2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=6
DecodeCharacterReference=1

[MeasureDate2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=7

[MeasureTime2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=8

[MeasureAuthor2]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=9

[MeasureItem3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=10
DecodeCharacterReference=1

[MeasureDate3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=11

[MeasureTime3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=12

[MeasureAuthor3]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=13

[MeterMailIcon]
Meter=IMAGE
X=2
Y=2
ImageName=mailB.png
ToolTipTitle=[MeasureAccount] @ Gmail ([MeasureMailCount]) da leggere
ToolTipText=[MeasureDate1] [MeasureTime1] [MeasureAuthor1] ~ [MeasureItem1]#CRLF#[MeasureDate2] [MeasureTime2] [MeasureAuthor2] ~ [MeasureItem2]#CRLF#[MeasureDate3] [MeasureTime3] [MeasureAuthor3] ~ [MeasureItem3]
ToolTipIcon=#SKINSPATH#\Posta\64.ico
;ToolTipWidth=300
DynamicVariables=1
LeftMouseUpAction=!Execute ["https://mail.google.com/mail/"]
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Gmail unread messages tooltip text with subject list

Post by jsmorley »

Sorry, missed the link in the post above...

http://rainmeter.net/cms/Tips-WebParserPrimer
User avatar
DioVikingoMetal
Posts: 29
Joined: January 26th, 2012, 10:40 am
Location: Italy

Re: Gmail unread messages tooltip text with subject list

Post by DioVikingoMetal »

is it possible to change the format of date?
from 2012-01-30 (year-month-day)
to 30-01-2012 (day-month-year)

adding:
Format=%d-%m-%Y
Image
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Gmail unread messages tooltip text with subject list

Post by jsmorley »

DioVikingoMetal wrote:is it possible to change the format of date?
from 2012-01-30 (year-month-day)
to 30-01-2012 (day-month-year)
Yes, but unless you use a Lua script (and I suspect we are not ready for that just yet) you are going to have to use the RegExp to break the date into separate pieces, then create a child measure for each, and use those child measures in the ToolTip in the order you want them.

If you change the "Get" variable to:

(?(?=.*<title>).*<title>(.*)</title>.*<modified>(.*)-(.*)-(.*)T(.*)Z.*<author>.*<name>(.*)</name>)

As you can see, I am using the "-" characters between the pieces of the date to separate them into different StringIndexes. Once again, you will need to adjust all the StringIndex= settings in your measures to match what is now being returned by the parent WebParser measure.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Gmail unread messages tooltip text with subject list

Post by jsmorley »

Sorry, I wasn't thinking. There is an easier way to reorder those dates.

Leave the RegExp as it is, just let it get the date as one string / StringIndex as before.

Then in each of the child measures returning the date:

[MeasureDate1]
Measure=Plugin
Plugin=WebParser
Url=[RSS]
StringIndex=3
RegExpSubstitute=1
Substitute="(.*)-(.*)-(.*)":"\3-\2-\1"

What that will do is perform a Regular Expression Substitute http://rainmeter.net/cms/Measures-GeneralSettings on the value of the child measure, using the "-" chars to separate the pieces, and then re-order them as 3-2-1 instead of 1-2-3.
User avatar
DioVikingoMetal
Posts: 29
Joined: January 26th, 2012, 10:40 am
Location: Italy

Re: Gmail unread messages tooltip text with subject list

Post by DioVikingoMetal »

There is something wrong with the time displayed for every message in the tooltip notification: it's one hour back!
But if I control the feed reader (RSSOwl) the time is correct!
What's wrong now?

Image
Image
User avatar
DioVikingoMetal
Posts: 29
Joined: January 26th, 2012, 10:40 am
Location: Italy

Re: Gmail unread messages tooltip text with subject list

Post by DioVikingoMetal »

Quote
Image
User avatar
KreAch3R
Posts: 608
Joined: February 7th, 2011, 7:27 pm
Location: Thessaloniki, GR

Re: Gmail unread messages tooltip text with subject list

Post by KreAch3R »

OFFTOPIC
I wish I had this information so well written when I started playing with Webparser. Kudos, sir. :thumbup: You are a true inspiration.
Forget me now, continue. :)
Inactive, due to life changes. Send me a PM for any question.

Desktop DeviartArt
Image