Page 1 of 1

For a laptop

Posted: Fri Jul 29, 2016 10:35 pm
by Gloops
Hello everybody,
I find poptray very nice to alert me of new mails. It cannot display accentuated characters properly, but this does not seem to be the topic.
One thing was missing : when I put my laptop on standby, it did not realize when I came out of standby, and I had to wait ten more minutes before knowing about new mails, except by putting Ctrl F12 as a shortcut to retrieve the mail (options, keyboard shortcuts) and then depressing Ctrl F12 when coming back from standby.

This works good, but I feel it is better to automatize it.
To do that if you use Windows, in your scripts folder, create both following scripts, and in the startup folder of Windows put a Windows shortcut for RunChangePower.VBS -and do not forget to ask your antivirus to authorize these scripts to execute.
I automatized the fact to send Ctrl F12 when waking up, do not forget to put it in the keyboard shortcuts of Poptray.

As you see I put a 7 seconds delay to let the network activate itself, this is to adjust to your system if needed. The displayed messages are for debug purposes, as they are displayed in a hidden window they will not bother you. You will just see Poptray display a blink 7 seconds after the wake-up, meaning that it verified the mails.

RunChangePower is executed at the beginning of the Windows session, so you see the message "Monitor the standby" at that moment, and this is all.
WshShell.Run with 0 as second parameter is to execute in a hidden window.

================ RunChangePower.VBS ================

Code: Select all

 
 MsgBox("Monitor the standby")
 Set WshShell = WScript.CreateObject("WScript.Shell")
 WshShell.Run "C:\Windows\System32\cscript.exe ChangePower.vbs", 0
================ ChangePower.vbs ===================

Code: Select all

Set colMonitoredEvents = GetObject("winmgmts:")._
 ExecNotificationQuery("SELECT * FROM Win32_PowerManagementEvent")
Do
 Set strLatestEvent = colMonitoredEvents.NextEvent
 Wscript.Echo strLatestEvent.EventType 
 WScript.Echo Time
 WScript.Echo "."
 If strLatestEvent.EventType = "7" then
  Set WshShell = WScript.CreateObject("WScript.Shell")
  WScript.Sleep 7000
  WshShell.SendKeys "^{F12}"
  WScript.Echo "Updating the mails count"
 End If
Loop

Posted: Fri Jul 29, 2016 11:01 pm
by Rdsok
You may want to try PoptrayU which is an updated version of Poptray

Posted: Fri Jul 29, 2016 11:12 pm
by Gloops
Thanks. Sadly I discovered about PoptrayU only once Poptray was installed and parameterized. I have no clue about what it does more or better. Did you put any screencopies of it anywhere ?

Posted: Sat Jul 30, 2016 1:46 am
by Rdsok
I see no reason that I should post screenshots... I'm just a user that suggested you look into trying PoptrayU since it is an updated version of Poptray...

It happens to look just like Poptray... it's just been updated to support the newer versions of Windows.

If you have questions... at least look at the website for it

http://poptrayu.sourceforge.net/