Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > microsoft.public.scripting.vbscript > #11331
| From | Gloops <gloops@zailes.invalid.org.invalid> |
|---|---|
| Newsgroups | microsoft.public.scripting.vbscript |
| Subject | EventType |
| Date | 2016-07-06 17:54 +0200 |
| Organization | Serveur de salon |
| Message-ID | <nlj9iu$498$1@usenet.pasdenom.info> (permalink) |
Hello everybody,
I have a program that monitors my mails, but it is not aware that the
machine went to sleep and came back. So, I have to wait ten more minutes
before it looks for mail. I wake it up with keys ^{F12}, but this could
be well automatized.
With a script from
https://msdn.microsoft.com/en-us/library/aa394362(v=vs.85).aspx
I could monitor the machine state :
Set colMonitoredEvents = GetObject("winmgmts:")._
ExecNotificationQuery("SELECT * FROM Win32_PowerManagementEvent")
Do
Set strLatestEvent = colMonitoredEvents.NextEvent
Wscript.Echo strLatestEvent.EventType
WScript.Echo Time
WScript.Echo "."
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "^{F12}"
Loop
The only problem is that I could not test the values of the eventtype.
It displays 4 when entering suspend, 18 when waking up the machine, and
7 when it is ready.
So, PopTray receives the keys at a few seconds of distance (18 and 7),
and tells me it is busy (without speaking of updating the mail count
when being unable to display it).
"If strLatestEvent.EventType = 7 then"
is never realized, and I could not get it to string with Cstr.
Any idea how to test that ?
I am OK that giving a name that begins with str to a variable that has
no chance to be a string is a strange idea : I just added the two lines
for the sendkeys, and some more display to evaluate the time.
Back to microsoft.public.scripting.vbscript | Previous | Next — Next in thread | Find similar
EventType Gloops <gloops@zailes.invalid.org.invalid> - 2016-07-06 17:54 +0200 Re: EventType Gloops <gloops@zailes.invalid.org.invalid> - 2016-07-06 18:27 +0200
csiph-web