I am trying to automatically convert pdf files to docx files in python, using (copied from this):
import win32com.client
word = win32com.client.Dispatch("Word.Application")
word.visible = 1
pdfdoc = 'NewDoc.pdf'
todocx = 'NewDoc.docx'
wb1 = word.Documents.Open(pdfdoc)
wb1.SaveAs(todocx, FileFormat=16) # file format for docx
wb1.Close()
word.Quit()
This opens Word and the following prompt appears:
I want to run my script without user intervention, so is it possible to programmatically click the OK button?

The
Openmethod has optional parameters that can be specified to avoid the dialog:The
ConfirmConversionsparameter is set totrueto display theConvert Filedialog box if the file isn't in Microsoft Word format, otherwise just set it to false.