Re: Gedankenfurz
Verfasst: Dienstag 26. Februar 2019, 18:13
@Perlchamp: Ja das ist eine Art Sandbox.
Seit 2002 Diskussionen rund um die Programmiersprache Python
https://www.python-forum.de/
Code: Alles auswählen
SYSTEM_PATH = 'c:/windows/system32/'
def btn_snip_clicked():
shell = win32com.client.Dispatch("WScript.Shell")
app_snip = shell.Run(f'{SYSTEM_PATH}SnippingTool.exe')
win32api.Sleep(300)
shell.AppActivate(f'{SYSTEM_PATH}SnippingTool.exe')
win32api.Sleep(300)
shell.SendKeys("^n")
win32api.Sleep(300)
Code: Alles auswählen
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''detecting_mouseclicks_in_windows_using_python.py:
Code to check if left or right mouse buttons were pressed
'''
__author__ = 'Markacho'
__date__ = '30.01.2017'
import win32api
import time
state_left = win32api.GetKeyState(0x01) # Left button down = 0 or 1. Button up = -127 or -128
state_right = win32api.GetKeyState(0x02) # Right button down = 0 or 1. Button up = -127 or -128
while True:
a = win32api.GetKeyState(0x01)
b = win32api.GetKeyState(0x02)
if a != state_left: # Button state changed
state_left = a
print(a)
if a < 0:
print('Left Button Pressed')
else:
print('Left Button Released')
break
if b != state_right: # Button state changed
state_right = b
print(b)
if b < 0:
print('Right Button Pressed')
else:
print('Right Button Released')
break
time.sleep(0.001)