[python-win32] win32ui.CreateFileDialog error

Tim Riley riltim at gmail.com
Wed Aug 9 21:55:52 CEST 2006


Can anyone explain to me why the following code will return a list if I
select 12 files but will return None if I select 13?

#file: pdf_batch_plot.py
#auth: Tim Riley
#rev:  0
#desc: Allows the selection of multiple pdf files and batch plots them to
pdf.
#
#Note: This program requires the win32all package for Python as it makes use

#      of Windows API calls to create the open file dialog box as well as
#      COM calls to control AutoCAD.
#------------------------------------------------------------------------------
import sys, os
import win32ui
import win32con

# create an OpenFileDialog using win32ui.CreateFileDialog
def GetFiles():
    dlg = win32ui.CreateFileDialog(1,
                                   None,
                                   None,
                                   (win32con.OFN_FILEMUSTEXIST|
                                    win32con.OFN_EXPLORER|
                                    win32con.OFN_ALLOWMULTISELECT),
                                   'AutoCAD Drawings (*.dwg)|*.dwg||')

    dlg.SetOFNTitle('Select Drawing Files')
    testvalue = dlg.DoModal()
    if testvalue == win32con.IDOK:
        return dlg.GetPathNames()

if __name__ == '__main__':
    printfiles = GetFiles()
    print printfiles
    blah = raw_input('hit enter...')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20060809/47b3174e/attachment.html 


More information about the Python-win32 mailing list