Skip to content

Commit a00db2e

Browse files
committed
add code
1 parent 8cc036c commit a00db2e

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

doudou/2021-06-30-pyautogui/app.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# coding=utf-8
2+
3+
import time
4+
import pyautogui
5+
6+
7+
# 将图片拖入轨道
8+
def drag_img_to_track():
9+
# 选中图片
10+
pyautogui.moveTo(170, 270)
11+
pyautogui.doubleClick()
12+
# 拖拽图片至轨道
13+
pyautogui.dragTo(120, 600, 1, button='left')
14+
15+
16+
# 调整视频时长
17+
def drag_img_to_3_min():
18+
# 选中轨道中的第一张图
19+
pyautogui.moveTo(125, 600)
20+
pyautogui.click()
21+
# 拖拽至第三分钟
22+
pyautogui.moveTo(135, 600)
23+
pyautogui.dragTo(700, 600, 1, button='left')
24+
25+
26+
# 删除旧的素材
27+
def delete_top_img():
28+
# 删除轨道中的第二张图片
29+
pyautogui.moveTo(300, 160)
30+
pyautogui.doubleClick()
31+
pyautogui.press("backspace")
32+
33+
# enter yes
34+
pyautogui.moveTo(650, 470)
35+
time.sleep(0.5)
36+
pyautogui.click()
37+
38+
39+
# 导出
40+
def export(name):
41+
pyautogui.moveTo(126, 600)
42+
pyautogui.click()
43+
44+
pyautogui.hotkey('command', 'e')
45+
pyautogui.write(name)
46+
time.sleep(1)
47+
pyautogui.moveTo(800, 393)
48+
pyautogui.click()
49+
time.sleep(20)
50+
pyautogui.click()
51+
52+
53+
index = 0
54+
count = 2
55+
while index < count:
56+
drag_img_to_track()
57+
drag_img_to_3_min()
58+
delete_top_img()
59+
export(str(index))
60+
time.sleep(2)
61+
index += 1
62+
print("end..." + str(index))

doudou/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Python技术 公众号文章代码库
2525
+ [fake-data](https://github.com/JustDoPython/python-examples/tree/master/doudou/2021-01-10-fake-data):假数据
2626
+ [mitmproxy](https://github.com/JustDoPython/python-examples/tree/master/doudou/2021-02-08-mitmproxy):中间人攻击
2727
+ [poetry](https://github.com/JustDoPython/python-examples/tree/master/doudou/2021-03-09-programmer-romance):程序员的浪漫
28-
28+
+ [pyautogui](https://github.com/JustDoPython/python-examples/tree/master/doudou/2021-06-30-pyautogui):自动制作视频
2929
---
3030

3131
从小白到工程师的学习之路。

0 commit comments

Comments
 (0)