system.file.openFile - Several file extensions?

It’s not possible through the system function directly, unfortunately. Untested workaround solution:

from com.inductiveautomation.ignition.client.script import ClientFileUtilities

def openFiles(desc, *extensions):
	filechooser = ClientFileUtilities.getChooser(0, desc, *extensions)

	filechooser.setMultiSelectionEnabled(True)

	if filechooser.showOpenDialog(None) is not None:
		return [file.getPath() for file in filechooser.getSelectedFiles()]

def openFile(desc, *extensions):
	filechooser = ClientFileUtilities.getChooser(0, desc, *extensions)

	if filechooser.showOpenDialog(None) is not None:
		return filechooser.getSelectedFile().getPath()


# imageFiles = openFiles("Image (JPG, JPEG, PNG)", "jpg", "jpeg", "png")
# imageFile = openFile("Image (JPG, JPEG, PNG)", "jpg", "jpeg", "png")
2 Likes