SetCursorPos is Possible?



  • On 01/09/2015 at 04:16, xxxxxxxx wrote:

    Hi!🙂

    Is Possible, set Cursor Position in Screen?
    I have this Python Code, but in Cinema4D not work....
    Thanks!

    def mousePos(cord) :
        win32api.SetCursorPos((x_pad + cord[0], y_pad + cord[1]))
         
    def get_cords() :
        x,y = win32api.GetCursorPos()
        x = x - x_pad
        y = y - y_pad
        print x,y



  • On 02/09/2015 at 10:01, xxxxxxxx wrote:

    Hi,

    it looks like you are using ActivePython. We (SDK Support Team) have no experience with this and can't support it.
    Also I'm not aware of any C4D function to position the cursor.

    In general it may also be a bad idea to use Win32 stuff in plugins and scripts. At least, if you are planning to make it public, as it won't work on Mac. But I'm sure you are aware of this.



  • On 02/09/2015 at 10:31, xxxxxxxx wrote:

    @ Runner009
    over net, you can find interesting and fun projects for python or extend it
    like https://pypi.python.org/pypi/PyAutoGUI
    Seems cross-platform tool

    example of using: http://tinypic.com/player.php?v=2emijiq%3E&s=8#.VecyEJfLKzk

    i use from examples, manual

    import c4d  
    import pyautogui, pytweening  
      
    def main() :  
      screenWidth, screenHeight = pyautogui.size()  
      currentMouseX, currentMouseY = pyautogui.position()  
      pyautogui.moveTo(500, 500, duration=2, tween = pytweening.easeOutQuad)  
      
    if __name__=='__main__':  
      main()
    

Log in to reply