回答編集履歴
1
サンプル追加
test
CHANGED
@@ -14,4 +14,44 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
+
以下、ユーザー入力あれば動作中断する例です。※`Windows`環境限定
|
18
|
+
|
19
|
+
```Python
|
20
|
+
|
21
|
+
import pyautogui
|
22
|
+
|
23
|
+
import win32api
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
# マウス移動 : ユーザーがマウス操作すればその分ずれる?
|
28
|
+
|
29
|
+
pyautogui.moveTo(10, 10)
|
30
|
+
|
31
|
+
pyautogui.moveTo(500, 500,5)
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
# マウス移動 : ユーザー入力あれば動作停止させる
|
36
|
+
|
37
|
+
pyautogui.PAUSE = 0.01 # 「なめらか」に動かす
|
38
|
+
|
39
|
+
pyautogui.moveTo(10, 10)
|
40
|
+
|
41
|
+
inpLast = win32api.GetLastInputInfo()
|
42
|
+
|
43
|
+
print(inpLast)
|
44
|
+
|
45
|
+
for i in range(50):
|
46
|
+
|
47
|
+
inpCur = win32api.GetLastInputInfo()
|
48
|
+
|
49
|
+
print(inpCur)
|
50
|
+
|
51
|
+
if inpCur != inpLast:
|
52
|
+
|
17
|
-
|
53
|
+
break
|
54
|
+
|
55
|
+
pyautogui.moveRel(10,10)
|
56
|
+
|
57
|
+
```
|