1
1
import win32com .client
2
2
import os
3
3
import sys
4
- from more_itertools import value_chain
5
4
6
5
# PpSaveAsFileType enumeration (PowerPoint)
7
6
ppSaveAsMP4 = 39
@@ -18,7 +17,7 @@ def ppt2video(pptx, video, timing, duration,
18
17
if sys .platform == "win32" :
19
18
pass
20
19
else :
21
- print ("Sorry, this script can be run only on Windows." )
20
+ print ("Sorry, this script can be run only on Windows." )
22
21
23
22
# Create files pathes for the ppt and video files.
24
23
ppt_path = os .path .abspath (pptx )
@@ -63,7 +62,7 @@ def ppt2video(pptx, video, timing, duration,
63
62
# Presentation.CreateVideo method (PowerPoint)
64
63
# https://docs.microsoft.com/en-us/office/vba/api/powerpoint.presentation.createvideo
65
64
new_presentation .CreateVideo (video_path , timing , duration ,
66
- resolution , frames , quality )
65
+ resolution , frames , quality )
67
66
while True :
68
67
try :
69
68
# Update the video file, if already exists.
@@ -79,8 +78,10 @@ def ppt2video(pptx, video, timing, duration,
79
78
80
79
81
80
if __name__ == '__main__' :
82
- file_name = "presentation.pptx" # e.g.:test.pptx, file expected to be in the root folder
83
- video_name = "presentation_video" # e.g.: test_video, will be created in the root folder
81
+ # e.g.:test.pptx, file expected to be in the root folder
82
+ file_name = "presentation.pptx"
83
+ # e.g.: test_video, will be created in the root folder
84
+ video_name = "video"
84
85
UseTimingsAndNarrations = False # Boolean value
85
86
DefaultSlideDuration = 2 # Int
86
87
VertResolution = 720 # Int
@@ -95,9 +96,7 @@ def ppt2video(pptx, video, timing, duration,
95
96
# "4":"input before slide number 4, the forth slide"}
96
97
# You can choose to what slides to add precending text and what slides
97
98
# to leave without additional input.
98
- input_dict = { "1" :"input index 1" ,
99
- "2" :"input index 2" , "4" :"input index 4" , "5" :"input index 5" ,
100
- "10" :"input index 10" }
99
+ input_dict = {}
101
100
102
101
ppt2video (f"./{ file_name } " , f"./{ video_name } .mp4" ,
103
102
UseTimingsAndNarrations ,
0 commit comments