Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

How to Know If the Screen(Monitor) is On or Off?

$
0
0
Hi


There's something I tried to do in the past, in AutoIt, and have not succeeded yet.

I decided to give it one more try.


Here's what it is:


When I work on my computer, I sometimes have to go for an hour or 2.

When I need to go, I leave my PC On, but I turn off the Screen, manually, by pressing its Power Button.
When I come back, I turn the screen On again(again, manually, via the Power Button of the screen), and continue.


I do not use any Power Settings, nor any ScreenSaver, etc.

This means that when I go, I turn off my screen, but everything keeps working and all is good.


Now to my question:
I would like to be able to check, programatically, If the screen is On or Off.

I use a screen that is connected with a DVI cable, which I know that has a "returning channel" back to the computer,
and in that returning channel, the screen also tells the computer if it's On or Off.


Now I just need a piece of code, that will tell me True/False regarding On/Off of my screen.



In my previous attempt, guinness wrote me this:

View Postguinness, on 31 July 2012 - 02:14 PM, said:

Search WMI and Win32_DesktopMonitor, it might provide a solution.


After reading about Win32_DesktopMonitor, I found that:
The Win32_DesktopMonitor class, has a uint16 Availability field,
which among its flags, contains a:
"7 (0x7) Power Off" bit.


Looks good.


To generate the code for querying WMI, I used GEOSoft's Scriptomatic:
http://autoit.mvps.org/files/ai_scriptomatic.zip


I then ran it on my computer,
twice:
First time when the screen is On,
Second time when the screen is Off.

The value of the Availability field when the screen was On, was 3,
and the value when the screen was Off, was also 3..
No change in the field's value, between On and Off..



What I deicded to check now,
Is If this only happens to me(3 returning both when On and when Off), or to everyone.


If it only happens to me, then maybe I can change something in my configuration, to make it work.
(for example change to antoher screen model, change OS, etc..)

But everyone gets 3, both when On and Off,
then it means it's simply not working, and therefore changing my screen/OS will not help :)


Can you guys try it too?

Using scriptomatic, to check the Win32_DesktopMonitor class.

It will really help me.


Thank you
Zohar

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>