Sunday, October 20, 2024

2024-10-20 - Screen Off solution / script

 Screen Off solution / script

    Okay, so I use my laptop on battery to run a Zoom meeting once a week for an hour. This isn't a problem but I would like to somehow preserve some of the battery life of my laptop if I can help it. I remember being trained on this and the guy that showed me how to do this said that he just turns the brightness of his screen way down for the meeting since once it starts recording and uploading to the cloud, there's almost no need to touch anything until the meeting is over. But I have never been satisfied with just turning the brightness way down. On my laptop, the brightness goes way down but it is still pretty bright and if I close the lid, the screen will turn off but the laptop will heat up a lot more, which is bad for the battery, and the GPD Pocket 3 does not have a keyboard shortcut for turning the screen or trackpad on or off. 
    Remember that my solution to turn my trackpad on or off came down to creating a PowerShell script that turned the HID device in Device Manager for the keyboard on and off and to revert back and fourth each time I double-click it depending on what it did before, turning it or turning it off. Well, that would not work so well for this problem, which is why it has taken me a year to figure out how to solve this issue. You see, if I write a script that turns the device in Device Manager on or off, then all that needs to happen is that I activate the script to turn it off and then that's it, I can't turn it back on because I could never hope to be so lucky that the mouse will be right over the same sport and I can just double click again and get my screen back. And the major inconvenience of plugging in a second screen just to maybe get my screen back is not a solution. This needs to be a way of turning off the screen without losing the ability to turn it back on. So how do I do that? 
    And then an idea intrigued me. I was thinking today as I was in the middle of this Zoom meeting today and thought, what if I used the keyboard shortcuts to turn the screen brightness down as usual but then if there was another screen brightness control like in Intel Display settings or something, I could also turn that down too. So I went about looking for any discrete video driver settings that might have an extra brightness control there and I would just use both controls for each Zoom meeting. I found the driver settings but alas, the only brightness controls were for if you were watching a video, the driver would artificially brighten or darken any video automatically going forward according to your selection. But I don't want that. 
    I was researching this online when I googled something about a script to power off the screen but keyboard shortcut revives it. And after some digging, I found an old program someone had written about called NIRCMD. The site said that it worked for everything from I think Windows 2000 all the way up to 10. And I thought, is there any possibility that if it worked with 10 that it might still possibly work with 11? SO I downloaded it and in .batch, wrote a script with the simple line:

nircmd.exe monitor off

    I downloaded it, and it came with a copy called NIRCMD and another called NIRCMDC, and the difference between those is that NIRCMD will run with a CMD, but NIRCMDC is the console option that will simply run silently or in the background. And the trick that lead me to this old program was that the pressing of any keyboard key will reactivate the screen. So I took the risk, but not until after creating a restore point, then I placed the NIRCMD.EXE file in my System32 folder, created a notepad file with the single line of code requesting NIRCMD to activate along with the NIRCMD command to turn the screen off, saved it, changed the file extension to .bat, double-clicked it, the screen turned off and then I pressed a keyboard key and it came back. 
    Fun side note, I was at home when I did this and had a second screen plugged in as my main screen, and this screen turned off when I activated this script. Signal was lost and the external screen was getting ready ti power off. So I am sure it will turn off all screens built in and otherwise. 
    I can't believe it! A lot of the time I at least run these things by my instructor to see what he thinks, if he has any ideas, and I have talked to him about this over the past year, but even he didn't have any ideas. So this was done in one day without his involvement at all in any way, shape or form. 
    A friend raised the point that any power savings from simply turning the screen off is not likely to result in that much savings, but if before the meeting I am at 100% battery and at the end of it I am in the 40s, I feel like turning the screen all the way off for that whole time could save me more than 10% which is what I am hoping for. Because I will often use my laptop before I go home and recharge it and would like to have the option of using it for the next few hours without concern that it will die if I am not quick with whatever I do.  

This has been Truncat3d 00000000111100010100110______________end of line

No comments:

Post a Comment

2025-07-10 - Active Directory 5.0 - Group Policy Foundations: Understanding Domain Admins and User Accounts / Setting up Remote Access

  Why You Use TESTLAB\Administrator Across Multiple Machines — And Why You Need Separate Domain Users When you join a workstation to an Act...