d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Running Interactive Python Script Via Rdp
Add Reply New Topic New Poll
Member
Posts: 11,610
Joined: Oct 28 2008
Gold: 1,795.00
Apr 16 2014 03:37pm
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.
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)


The error I get when the script runs after I have closed the RDP connection:

Code
File "x", line x, in mclick
win32api.SetCursorPos((x,y))
pywintypes.error: (0, 'SetCursorPos', 'No error message is available')


I assume this is because the screen is locked OR the screen service doesn't exist (not sure which)

Aside from programmatically rdp-ing in to this server and running this script on yet another computer are there any other options to having this run?
Member
Posts: 62,215
Joined: Jun 3 2007
Gold: 9,039.20
Apr 18 2014 02:37am
Member
Posts: 582
Joined: Mar 22 2014
Gold: 0.00
Apr 18 2014 06:24am
Is this in Windows 8? I wrote a macro recorder and player in Python using PyWin32 bindings and having trouble with the Alt key not being allowed for security reasons. There was a workaround that I can't seem to find/remember, and never got around to implementing. Perhaps it's a similar issue here?
Member
Posts: 11,610
Joined: Oct 28 2008
Gold: 1,795.00
Apr 18 2014 08:54am
Quote (killgoreisleet @ Apr 18 2014 02:37am)


+1 for knowing how to use google


workarounds i've found are using a c# wrapper to run this as a service and schedule it, emulating rdc via another box, and running as a local user

thx
Member
Posts: 62,215
Joined: Jun 3 2007
Gold: 9,039.20
Apr 18 2014 09:07am
Quote (0n35 @ Apr 18 2014 08:54am)
+1 for knowing how to use google


workarounds i've found are using a c# wrapper to run this as a service and schedule it, emulating rdc via another box, and running as a local user

thx


Sounds like something you could do in Python really.

If it works, it works.

Go Back To Programming & Development Topic List
Add Reply New Topic New Poll