title: Mouse Events with Locked Computer
body: <p>I am running my script once every X hours with Python, this is done via RDP.  After I close out the RDP (I assume) the screen "locks" on the computer.  When trying to move my mouse with the following code I get an error</p>
  
  <pre><code>def mclick(x,y):
      win32api.SetCursorPos((x,y))
      time.sleep(0.5)
      win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
      win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
  </code></pre>
  
  <p>The error I get when the script runs after I have closed the RDP connection:</p>
  
  <pre><code>File "x", line x, in mclick
      win32api.SetCursorPos((x,y))
  pywintypes.error: (0, 'SetCursorPos', 'No error message is available')
  </code></pre>
  
  <p>I assume this is because the RDP connection has closed so it has no where to click, aside from constantly having this RDP connection alive how would I get this to run?</p>