It is currently September 29th, 2024, 7:24 pm

Reading commands

General topics related to Rainmeter.
Randy21590
Posts: 10
Joined: August 17th, 2013, 5:38 pm

Reading commands

Post by Randy21590 »

Is there a way in Rainmeter to execute an application when it reads a certain command via email? For example, there are many Rainmeter skins out there that can sync with your email account. I want to send an email to myself from my cellphone with a certain command in the subject field like "shutdown", and once it reads that it will run the application 'shutdown.bat', thus shutting down my computer remotely. Is there any way to do this?
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Reading commands

Post by moshi »

you could do that with a webparser skin that reads your GMail inbox.
then use a substitution to replace a combination of message and sender with a number.
and use an IfEqualValue and IfEqualAction to execute a command.

not reliable though as the number of measures in a skin is finite.
there really must be better tools than Rainmeter, i would not recommend it for such tasks.
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Reading commands

Post by jsmorley »

It would also be easy to do in Lua by getting the entire feed as one string via RegExp=(?siU)^(.*)$ on the WebParser measure, then parsing it in Lua and sending a bang to Rainmeter to execute the functionality. That way you only need one WebParser measure in the skin while dealing with an unlimited number of unread messages in GMail.

The issue I have with it is that to make it not just execute the command over and over again, until such time as you "read" the message in GMail itself, and thus remove it from the "unread" list you will get, is going to be reasonably complicated. There is probably some way using the <modified> tag and storing it in an external text file you read and compare before acting, but parsing and properly dealing with date strings in Lua is not trivial, and really, Moshi is right that there may be better tools for this kind of thing.
Randy21590
Posts: 10
Joined: August 17th, 2013, 5:38 pm

Re: Reading commands

Post by Randy21590 »

Thanks guys for your reply. Yes, there are better tools such as Microsoft Outlook in which I have done this in. The thing is, Outlook has to be running in order for the action to take place. Sure, I could launch it on startup but Rainmeter is part of my desktop and the action is kind of "hidden" if you know what I mean and I don't have to have a program visibly running.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: Reading commands

Post by moshi »

i'm not sure about the unlimited part.
it may display the absolute number of unread mails at the beginning, but i would guess the number of items is finite.

the Google Calendar feeds for example are limited to 25 items by default. you can increase them with a max-results parameter, but they are finite.
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Reading commands

Post by jsmorley »

Randy21590 wrote:Thanks guys for your reply. Yes, there are better tools such as Microsoft Outlook in which I have done this in. The thing is, Outlook has to be running in order for the action to take place. Sure, I could launch it on startup but Rainmeter is part of my desktop and the action is kind of "hidden" if you know what I mean and I don't have to have a program visibly running.
It is an intriguing idea, but it wouldn't be trivial to do correctly. Just using a Substitute on huge bunch of WebParser measures is probably not the way to go, since as soon as you turn on your computer, it would immediately shut down again unless you remembered to actually "read" the offending message in GMail.

Getting the <modified> tag and storing the "last" one just before you take the action, and using that file with "last trigger message timestamp" in it to ensure any message you consider acting on is "newer" than that is how I would probably attack it, since you want that part of it to be "persistent".

I may mess with it some today, just to see what it would take.
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Reading commands

Post by jsmorley »

moshi wrote:i'm not sure about the unlimited part.
it may display the absolute number of unread mails at the beginning, but i would guess the number of items is finite.

the Google Calendar feeds for example are limited to 25 items by default. you can increase them with a max-results parameter, but they are finite.
Sure, I don't know how many "unread" messages GMail actually puts into the ATOM feed in the limited detail it provides (aside from the <fullcount> tag). There would certainly be that limitation, I assume there is one, since a lot of folks have just hundreds and even thousands of unread messages when they don't bother managing their inbox.

As to the skin though, however many "unread" messages are in the feed, the Lua will handle it without breaking a sweat.
User avatar
sa3er
Posts: 152
Joined: March 2nd, 2013, 7:18 am
Location: Tehran

Re: Reading commands

Post by sa3er »

Amazing idea but yes this can be easily done using Rules in Microsoft Outlook.

As for that visibility matter:
Step 1 - Right click on outlook icon in systray and choose Hide When Minimized.
Step 2 - How to start Outlook in a minimized state
User avatar
jsmorley
Developer
Posts: 22793
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Reading commands

Post by jsmorley »

sa3er wrote:Amazing idea but yes this can be easily done using Rules in Microsoft Outlook.

As for that matter:
Step 1 - Right click on outlook icon in systray and choose Hide When Minimized.
Step 2 - How to start Outlook in a minimized state
These are the "Rainmeter" forums. Where is the fun in that? ;-)
Randy21590
Posts: 10
Joined: August 17th, 2013, 5:38 pm

Re: Reading commands

Post by Randy21590 »

jsmorley wrote:It is an intriguing idea, but it wouldn't be trivial to do correctly. Just using a Substitute on huge bunch of WebParser measures is probably not the way to go, since as soon as you turn on your computer, it would immediately shut down again unless you remembered to actually "read" the offending message in GMail.

Getting the <modified> tag and storing the "last" one just before you take the action, and using that file with "last trigger message timestamp" in it to ensure any message you consider acting on is "newer" than that is how I would probably attack it, since you want that part of it to be "persistent".

I may mess with it some today, just to see what it would take.
I haven't learned about those methods yet but I'm here to learn. Looks like I have a lot of work to do.