-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathautogui.py
38 lines (30 loc) · 906 Bytes
/
autogui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pyautogui
import pyperclip
import platform
sysinfo = platform.platform()
pyautogui.PAUSE = 0.5 # 设置每个动作0.5s
def paste():
if 'windows' in sysinfo.lower() or 'linux' in sysinfo.lower():
pyautogui.hotkey('ctrl', 'v')
else:
# Mac OS
pyautogui.hotkey('command', 'v')
def copypaste(content):
''' copy and paste '''
pyperclip.copy(content)
paste()
def copy():
if 'windows' in sysinfo.lower() or 'linux' in sysinfo.lower():
pyautogui.hotkey('ctrl', 'c')
else:
# Mac OS
pyautogui.hotkey('command', 'c')
def copyall():
''' 全选 浏览器中的内容 '''
if 'windows' in sysinfo.lower() or 'linux' in sysinfo.lower():
pyautogui.hotkey('ctrl', 'a')
pyautogui.hotkey('ctrl', 'c')
else:
# Mac OS
pyautogui.hotkey('command', 'a')
pyautogui.hotkey('command', 'c')