![]() Nb_cycles = options.duration if options. Help="Duration (in s) or negative value for infinite" HelpFormatter(prog, max_help_position=60) Purpose: Send a keystroke (F15) to simulate user activity Print("Trust me, I will keep you alive!\n") Nb_cycles(int): number of cycles (set to -1 for unlimited) Send keystroke F15 at a given delay for a given nb of cycles Return Input(KEYBDINPUT(key, key, flags, 0, None))ĭef keep_alive(delay, nb_cycles=-1, key='F15'): # Keys 'F.': we use code in the dictionary If len(code) = 1 and re.match(r'', code): Next, input the following command and press Enter once again:powercfg.exe /SETACTIVE SCHEMECURRENT. This time is in seconds, meaning that by leaving it default, you’ll have 60 seconds before the lock screen goes into a timeout. # Code for key 0.9 or A.Z: it corresponds to the the ASCII code Make sure to change 60 to the amount of time you want your lock screen to stay active for. Raise TypeError('Cannot create INPUT structure (keyboard)!') ![]() Return INPUT(INPUT_KEYBOARD, _INPUTunion(ki=structure)) Return INPUT(INPUT_MOUSE, _INPUTunion(mi=structure)) _fields_ = (('type', DWORD), ('union', _INPUTunion))ĬbSize = ctypes.c_int(ctypes.sizeof(INPUT)) (It can definitely be trimmed to a minimum of lines but just got 15 minutes to spare on it so the first part is a big copy-paste of other code).įrom argparse import ArgumentParser, HelpFormatter I ended up writing a Python script that does a similar thing (sending the keystroke F15 every xx seconds). I tried the freeware Caffeine but it was blocked by our IT policies. After a few times of doing this, you or your manager may get a memo or visit from your friendly IT Security department. Therefore, it's best to just leave it alone.Įven if you do manage to change the setting permanently, corporate administrators may detect the computer as being out of compliance and force the policy on again. ![]() If your system did fall into that category, then it would probably already be configured not to lock. Regardless: Unless your system is the sort that requires full-time immediate access, for the preservation of life and/or property (i.e.: 911 Call Center), it is probably against your organization's policy to prevent the workstation from locking. That's exactly what you want, but definitely not what I'd intended. In this case, it ended up not running a screensaver at all. I once tried messing with mine on one system (domain policy is to lock after 15 minutes, but I prefer 5 - can't remember what I changed, though) and the system ended up listening to neither the domain nor my preference even after I rolled back the change. ![]() There's a couple other things I'd like to add, though:īe careful tweaking this setting, whether it be via registry or otherwise. Like others have said, the domain policy will generally override any local settings you try to configure for this. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |