ich möchte etwas im Hintergrund machen, das heißt ich will meinen Mauszeiger (in Windows) in "3dgmove.cur" ändern.
Das script, wenn man es sieht sieht so aus:
Code: Alles auswählen
import win32api
from SendKeys import SendKeys
def click(button="left", double=False, button_down=True, button_up=True):
"""Peform a click action using SendInput """
events = []
if button.lower() == "left":
if button_down:
events.append(win32defines.MOUSEEVENTF_LEFTDOWN)
if button_up:
events.append(win32defines.MOUSEEVENTF_LEFTUP)
elif button.lower() == "right":
if button_down:
events.append(win32defines.MOUSEEVENTF_RIGHTDOWN)
if button_up:
events.append(win32defines.MOUSEEVENTF_RIGHTUP)
elif button.lower() == "middle":
if button_down:
events.append(win32defines.MOUSEEVENTF_MIDDLEDOWN)
if button_up:
events.append(win32defines.MOUSEEVENTF_MIDDLEUP)
if double and button_down and button_up:
events *= 2
inp_struct = win32structures.INPUT()
inp_struct.type = win32defines.INPUT_MOUSE
for event in events:
inp_struct._.mi.dwFlags = event
inp_struct._.mi.mouseData = 0
win32functions.SendInput(
1,
ctypes.pointer(inp_struct),
ctypes.sizeof(inp_struct))
# (Der Teil ist nicht von mir)
win32api.SetCursorPos((32, 799))
click()
win32api.SetCursorPos((42, 781))
click()
win32api.SetCursorPos((409, 261))
click()
SendKeys("m{ENTER}")
win32api.SetCursorPos((102.77))
click()
win32api.SetCursorPos((372,444))
click()
SendKeys("3dgmove.cur")
win32api.SetCursorPos((540, 453))
click()
Ich hoffe auf Antworten