0

I'm automatically launching some python scripts that take screenshots and analysing screen content using pyautogui module. When my pc is in standby mode, the script run but take a screenshot of the standby mode. Are there any solution to take a screenshot of the window content even if the pc is on standby mode.

I appreciate your help. Thank you.

SmallX
  • 89
  • 7

1 Answers1

1

I don't think such thing is possible in sleep mode, meanwhile you can prevent your computer from going into standby mode by referring to this :

The main idea is using SetThreadExecutionState function, for example, in your python terminal you can run :

import ctypes
ctypes.windll.kernel32.SetThreadExecutionState(0x80000002)
input('{Press enter to exit}')
ctypes.windll.kernel32.SetThreadExecutionState(0x80000000)
Younes
  • 391
  • 2
  • 9
  • Thank you Younes for your response, I already force it to not go to standby mode. But the problem is that this pc is used like a server many users can use it. If one of them force it to standby mode my scripts should work. So i need an idea for that. – SmallX Jan 28 '21 at 10:08
  • 1
    Preventing manual Sleep through script is such a tedious task .. assuming the server is on windows and has many users, you can maybe remove their access to Sleep/Shutdown functionnalities no ? Something like : [Win Pro/Win Enterprise tip](https://www.howtogeek.com/248742/how-to-prevent-specific-users-from-shutting-down-windows/#:~:text=In%20the%20Group%20Policy%20window,item%20and%20double%2Dclick%20it.) – Younes Jan 28 '21 at 10:29
  • Yes this is a good idea ! I will see how and if it is possible to set it up. Thanks again :) – SmallX Jan 28 '21 at 10:45