Hello. There is a program in python 2.7 that works in a loop, there is a problem in the following, when the user locks the computer, the program continues to work and therefore if you log in from another user, the program will not open because the process is already running. Help solve this kind of problem.

Tell me how to write a script in python 2.7 that will add tasks to the windows task scheduler. Either how to do it so that when the computer is locked (win + l), the process of the program is closed, and when unlocked it starts.

  • And why not just check that that process is under a different user and run another one under the current one? - Qwertiy
  • It is necessary to finish the process somehow, because the program uses a COM port and you can only establish one connection with it) - Diq

0