回答編集履歴
2
コードの修正
answer
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
pyautoguiでは日本語入力できないという問題がありましたが、下記の記事を参考にすることで解決しました。
|
6
6
|
https://sagantaf.hatenablog.com/entry/2017/10/18/231750
|
7
7
|
|
8
|
-
クリップボードにコピーした文章をキーボード操作で入力し
|
8
|
+
クリップボードにコピーした文章をキーボード操作で\nが現れるまでまとめて入力し、\nのところはShift+Enterを入力するプログラムとしました。
|
9
9
|
```python3
|
10
10
|
import pyautogui
|
11
11
|
import pyperclip
|
@@ -13,20 +13,30 @@
|
|
13
13
|
|
14
14
|
def copipe(string):
|
15
15
|
pyperclip.copy(string)
|
16
|
-
pyautogui.hotkey('
|
16
|
+
pyautogui.hotkey('command', 'v')
|
17
17
|
|
18
|
+
|
19
|
+
def shift_enter():
|
20
|
+
pyautogui.keyDown('shift')
|
21
|
+
pyautogui.press('enter')
|
22
|
+
pyautogui.keyUp('shift')
|
23
|
+
|
18
24
|
text = pyperclip.paste()
|
19
25
|
|
20
|
-
time.sleep(
|
26
|
+
time.sleep(5)
|
21
27
|
|
28
|
+
myclipbord = ''
|
29
|
+
|
22
30
|
for i in text:
|
23
|
-
if i =
|
31
|
+
if i != '\n':
|
24
|
-
|
32
|
+
myclipbord += i
|
33
|
+
|
25
|
-
|
34
|
+
elif i == '\n':
|
26
|
-
pyautogui.keyUp('shift')
|
27
|
-
else:
|
28
|
-
copipe(
|
35
|
+
copipe(myclipbord)
|
29
|
-
|
36
|
+
time.sleep(0.05)
|
37
|
+
myclipbord = ''
|
38
|
+
shift_enter()
|
39
|
+
time.sleep(0.05)
|
30
40
|
```
|
31
41
|
|
32
42
|
改善点などあればお教えください、、
|
1
コードの修正
answer
CHANGED
@@ -20,11 +20,12 @@
|
|
20
20
|
time.sleep(3)
|
21
21
|
|
22
22
|
for i in text:
|
23
|
-
copipe(i)
|
24
23
|
if i == '\n':
|
25
24
|
pyautogui.keyDown('shift')
|
26
25
|
pyautogui.press('enter')
|
27
26
|
pyautogui.keyUp('shift')
|
27
|
+
else:
|
28
|
+
copipe(i)
|
28
29
|
time.sleep(0.1)
|
29
30
|
```
|
30
31
|
|