我想要使用進度指示將.pptx文件轉換爲.mp4視頻文件。我使用Python 2.7.6,以便在win32com.client模塊一起在Microsoft PowerPoint自動幾個行動2013年Powerpoint視頻導出進度使用ResampleMediaTask
這是我到目前爲止的代碼:
import win32com.client
powerpoint = win32com.client.Dispatch("Powerpoint.Application")
presentation = powerpoint.Presentations.Open(FileName='myFile.pptx',
WithWindow=False)
try:
# May need a few other parameters as well
presentation.CreateVideo('out.wmv')
except:
raise SystemExit
的問題在我情況是,我沒有得到導出到視頻進度的指示。我知道這些信息是可用的,因爲從應用程序內導出到視頻時,Powerpoint本身會顯示確切的進度條。
到目前爲止,我設法檢索的唯一信息是輪詢CreateVideoStatus
屬性,該屬性僅告訴我轉換是否已結束。
while presentation.CreateVideoStatus == 1:
time.sleep(1)
然而,根據這個帖子Powerpoint 2013 - Progress for export to video,用戶Steve Rindsberg表明,我們應該使用ResampleMediaTasks
對象及其PercentComplete()
方法來獲得進展。
關於如何在Python中實現這一點的任何想法?
我剛剛做了:'powerpoint.ResampleMediaTasks.PercentComplete()'但'PercentComplete()'由於某種原因停留在100%,就像在這篇文章中一樣:http://stackoverflow.com/a/19102209/178728 – kstratis
所以我認爲Microsoft的ResampleMedia ActiveX對象確實有這個問題。 –