Quick test please Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Quick test please

Post by PepeLapiu » 04 Dec 2021, 15:10

Hi guys.
Getting back and trying to pick back up on learning AHK for a little project I have in mind.
But before I start to get caught up on AHK, I need to know a little something.
Once my script is built and running, I will need to carry my laptop with me at all times, 24/7 with internet access.
So the script will also need to be running all the time, always doing an image search on screen all the time.

And because I will need to carry it with me all the time, I opted for a Microsoft Surface Go laptop. It's the lightest and smallest laptop I could find, for portability. I will also carry a battery bank with it as the Go internal battery doesn't last all day by itself.

The problem is that when I close the lid/keyboard, the screen goes automatically to the log in screen. I would like the screen to stay on the desktop, and have the script running with the lid/keyboard closed.

So can the script keep working and doing image searches on the desktop while the screen is on the log in page? How can I test if this can work before I get started with my project?

I looked to change the settings so that the screen would remain on the desktop with the lid closed. So far I have not been able to do that.

User avatar
mikeyww
Posts: 26600
Joined: 09 Sep 2014, 18:38

Re: Quick test please

Post by mikeyww » 04 Dec 2021, 15:17

I don't believe so, but you could check the lid settings and adjust them.

Code: Select all

Run, control /name Microsoft.PowerOptions /page pageGlobalSettings

braunbaer
Posts: 478
Joined: 22 Feb 2016, 10:49

Re: Quick test please

Post by braunbaer » 04 Dec 2021, 15:27

You can try to remove the sensor that detects that the lid is closed.

PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Re: Quick test please

Post by PepeLapiu » 04 Dec 2021, 15:36

mikeyww wrote:
04 Dec 2021, 15:17
I don't believe so, but you could check the lid settings and adjust them.

Code: Select all

Run, control /name Microsoft.PowerOptions /page pageGlobalSettings
I haven't worked with windows in a while. Here is the result I got when running your suggested command in the command prompt:

Code: Select all

C:\Users\GO>Run, control /name Microsoft.PowerOptions /page pageGlobalSettings
'Run' is not recognized as an internal or external command,
operable program or batch file.

PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Re: Quick test please

Post by PepeLapiu » 04 Dec 2021, 15:50

I found a settings page that allows me to change the computer behavior when I close the lid. I changed the "When I close the lid" setting from "Sleep" to "Do nothing" for both plugged in an on battery options. The result is that the screen no longer turns off when I close the lid, which is partly what I want. But the display still goes to Log in page.

Can a script work and look for an image on the desktop while the screen is on Log in page?

braunbaer
Posts: 478
Joined: 22 Feb 2016, 10:49

Re: Quick test please

Post by braunbaer » 04 Dec 2021, 17:20

That is hardly possible, because the image is not displayed on the desktop when the login page is shown.

But you can try if it works when you run the script on a virtual machine. A virtual machines desktop may be reachable even if the whole window of the virtual machine is minimized or hidden.

vsub
Posts: 541
Joined: 29 Sep 2015, 03:39

Re: Quick test please

Post by vsub » 05 Dec 2021, 04:48

PepeLapiu wrote:
04 Dec 2021, 15:36
mikeyww wrote:
04 Dec 2021, 15:17
I don't believe so, but you could check the lid settings and adjust them.

Code: Select all

Run, control /name Microsoft.PowerOptions /page pageGlobalSettings
I haven't worked with windows in a while. Here is the result I got when running your suggested command in the command prompt:

Code: Select all

C:\Users\GO>Run, control /name Microsoft.PowerOptions /page pageGlobalSettings
'Run' is not recognized as an internal or external command,
operable program or batch file.
This is a code that need to be run with autohotkey,not command prompt
In Cmd,you just need
control /name Microsoft.PowerOptions /page pageGlobalSettings
This will lead you to the settings(you can also type Lid in the start menu)where you choose what to happen when you close the lid

And you cannot run ahk that scan the screen for something specific while you are on the lock screen
AHK is literally looking at what you currently see and if that is the lock screen,it will not do what you want(it's like taking a screenshots and looking at specific area for pixels of specific color)

I never tried if PixelSearch can work when the screen is just off

This cmd command can turn off your screen without going to the lock screen

Code: Select all

powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)
You can also create a .bat file with that code(Notepad=>Paste=>Save as=>Save as type=>All Files=>Name.bat

Or with Autohotkey

Code: Select all

Loop
{
Sleep,1000
If SubStr(A_TimeIdleMouse,1,-3) < 5
{
MsgBox,4,Screen Off,Turn off the screen?,10
IfMsgBox,Yes
{
SendMessage,0x112,0xF170,2,,Program Manager
Sleep,5000
}
IfMsgBox,TIMEOUT
{
SendMessage,0x112,0xF170,2,,Program Manager
Sleep,5000
}
IfMsgBox,No
Break
}
}
ExitApp
If your mouse is not active for seconds,it will display a message box asking you if you want to turn off the screen or not
Yes will turn if off
No will exit the script
No answer for 10 seconds will turn off the screen

RussF
Posts: 1242
Joined: 05 Aug 2021, 06:36

Re: Quick test please

Post by RussF » 05 Dec 2021, 16:21

This is purely theoretical and I haven't tested it, but this MIGHT work. If you are the only user on the laptop and you change your password to nothing (blank, empty i.e. no password) and then disable Windows 10 lockscreen with instructions here:

https://www.howtogeek.com/270493/how-to-disable-the-lock-screen-in-windows-10/

in addition to the power settings you have already tried.

In theory, if there is no lock screen, and no password to require a login, your desktop should remain visible.

Of course, this takes ANY security away from your laptop. The risk is yours.

Russ

braunbaer
Posts: 478
Joined: 22 Feb 2016, 10:49

Re: Quick test please

Post by braunbaer » 06 Dec 2021, 05:24

Instead of making image searches, you can also save the full screen contents to the clipboard and analyze the text that is saved (send ^a^c). That should work regardless of the screen display being on.

If you don't find there the information you need, you can also save the page to a file (send ^s) and then read the file and try to analyze the html text.


PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Re: Quick test please

Post by PepeLapiu » 15 Dec 2021, 23:40

Thank you all for your help. I'm going to try your suggestions as soon as I get home.
Now, I wish I would have seen your replies earlier. I don't know why I was not notified.

If your tricks don't solve the problem, I'll see if I can write a script that would log in as soon as the log in screen comes up. But I'm not sure if the screen keeps going back to the log in if it detects the lid is closed.
If all else fails, I'll just carry the screen and keyboard/lid seperately.

Again, thank you all very much for your generous help.

PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Re: Quick test please

Post by PepeLapiu » 16 Dec 2021, 13:40

RussF wrote:
05 Dec 2021, 16:21
This is purely theoretical and I haven't tested it, but this MIGHT work. If you are the only user on the laptop and you change your password to nothing (blank, empty i.e. no password) and then disable Windows 10 lockscreen with instructions here:

https://www.howtogeek.com/270493/how-to-disable-the-lock-screen-in-windows-10/

in addition to the power settings you have already tried.

In theory, if there is no lock screen, and no password to require a login, your desktop should remain visible.

Of course, this takes ANY security away from your laptop. The risk is yours.

Russ
Thank you! It worked perfectly, easily, and exactly as needed. This takes a big burden off of my shoulders.
I was going to build a little wooden sleeve to carry in my backpack with two slots in it to store the screen and keyboard separately. But your trick solved the problem!

RussF
Posts: 1242
Joined: 05 Aug 2021, 06:36

Re: Quick test please  Topic is solved

Post by RussF » 16 Dec 2021, 14:35

I'm glad it worked! Quite honestly, I wasn't sure if it would. Now, just don't let that device out of your sight. ;)

Russ

PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Re: Quick test please

Post by PepeLapiu » 18 Dec 2021, 17:23

RussF wrote:
16 Dec 2021, 14:35
I'm glad it worked! Quite honestly, I wasn't sure if it would. Now, just don't let that device out of your sight. ;)

Russ
Just a little update for posterity's sake. It no longer works. Well, it works for a while than for some reason the desktop goes to the log in screen.
So I set everything to do nothing. When I close the lid, do nothing, when I am away for too long, do nothing, and so on... And I got rid of the password. All that did is prevent tmremove the password from the log in screen, but it didn't remove the log in.

RussF's trick worked for a while, but when I get up in the morning, it's back on the log in page. I just have to restart the computer to remove the log in screen. That seems to work but only until the next morning.

The keyboard/cover is Bluetooth and it goes to sleep after a while. It's possible it reverts to the log in screen once the cover goes to sleep.

I'll have to see if the setting sticks with the keyboard removed or turned off completely. Or I'll just get a script that keeps login back in every time the log in screen comes on.
That script would also turn the screen back on if it turns off, and beep at me to let me know if internet is lost.
Or maybe a script that moves the mouse around a little every few minutes to keep the puter awake. Or to restart the puter every few hour or so. I'll have to see what works.

RussF
Posts: 1242
Joined: 05 Aug 2021, 06:36

Re: Quick test please

Post by RussF » 19 Dec 2021, 07:32

Well, I did stipulate that my idea was pure theoretical. :?

I have PCs (Windows 10 Pro) set up in our manufacturing facility with no keyboard or mouse attached - they are managed purely by remote access. We use them as status boards that track and display jobs as they pass through our shop. There are two users on each - an admin account and a standard account. The standard account has no password. All display and sleep options are turned off. If the device is restarted either manually or due to power loss or Windows update, they always default to the last user to have signed in. Since it is always the standard user and there is no password for it, the PC just boots right to the desktop and auto-runs the job monitoring system. If I need to do something via the admin account, I have to log off the standard user, select admin, enter password and sign in. If I restart at that point, the login screen is presented and I have to choose the standard user again. From that point forward, it always defaults to the standard user again and you never see the login screen.

If you only have the one user, there is no choice to be made, and Windows SHOULD just go to the desktop of your user.

Did your device go to the login screen while it was open or closed?

Since it is a Micro$oft product, the hardware could be more tightly meshed with the OS and it could be part of their goal to take all control of our devices away from us - because, well, THEY know what we need and want better than WE do!

It's possible that you may have to go back to your plan of keeping the keyboard detached and using it in tablet mode. If you are carrying it around, you will probably have to fashion some sort of protective sleeve to prevent unwanted touches to the screen (just make sure to give it plenty of ventilation.)

Best of luck!

Russ

PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Re: Quick test please

Post by PepeLapiu » 19 Dec 2021, 09:58

RussF wrote:
19 Dec 2021, 07:32
Did your device go to the login screen while it was open or closed?
I close the lid, put it away with charger on, and when I open it later on (in the morning) the log in screen is on.

I'm just going to build a little sleeve out of wood with two compartments. For the keyboard and tablet to be stored separately. I figure the sleeve will help provide more shielding against damage anyways. It will be carried with me 24/7 in a backpack.

PepeLapiu
Posts: 324
Joined: 19 Jun 2020, 14:06

Re: Quick test please

Post by PepeLapiu » 29 Dec 2021, 00:54

Problem solved!
And all by accident too. The battery on my Bluetooth keyboard just died, so th e keyboard was turned off. And when turned off, it doesn't trigger anything when closed. So I just have to turn off the keyboard before closing it is all.

Post Reply

Return to “Ask for Help (v1)”