Any function that saves a file appears to just be entirely ignoring the strings. Every single script that writes any sort of file broke with 8.0. Here’s an example of one save button that stopped working properly. It does not matter what string I have entered for the saveFile function. It will not work. The commented out section was an attempt to get this to work, but it doesnt even save as a .pdf, just as a standard .file. I’ve got an system.dataset.exportToCSV thats also broken and won’t save as a .xls file unless you manually type in the file name with a .xls extension despite the save dialogue box stating you will be saving as a .xls file. Same issue as the saveAsPDF function. I have several clients that rely on saving reports and this is turning out the be a massive pain and making me seriously regret upgrading to 8.0.
I just looked into this, and it’s a bug on our side caused by some old code to enable translation on the file opening dialogs - it looks like our old workaround ends up negatively affecting the file choosers. I’ve filed a ticket so we can investigate taking it out. For now, you could probably adjust the code I have here to make your own
from com.inductiveautomation.ignition.client.script import ClientFileUtilities from javax.swing import JFileChooser from java.io import File def saveFile(filename, extension, description): filechooser = ClientFileUtilities.getChooser(JFileChooser.SAVE_DIALOG, description, extension) filechooser.setSelectedFile(File(filename)) ret = filechooser.showSaveDialog(None) if ret == JFileChooser.APPROVE_OPTION: return filechooser.getSelectedFile().getPath()
This is inputting the string again, but I cant figure out how to get it to work with a report file.
This should be a drop-in replacement for
system.file.saveFile - the code in your first screenshot looks like it would work fine. Are you getting an error, or what’s happening?
No, I got rid of the writeFile portion and so nothing was being written. It’s working now, but I had to manually add “.pdf” to the filename string or it still saves it as a simple file. Overall it’s functioning though. Thanks.
This issue was fixed in the 8.0.3 nightly build that was uploaded on 6/29.