I have been running a script for some time now on different version of ARIS. Recently I migrated to version 9.7/8 and the ARIS script return errors, which previously didn't occur. This is one example of the code I use. This function writes an image of a model to a local path on my client.
function pictureOfModel(oModel, size) { var pic = oModel.Graphic(false,false,g_nLoc); var myPath = Context.getSelectedPath(); var sfileName = myPath + oModel.GUID() + ".png"; //alternatives are GUID() or Name(g_nLoc) + "_" + size + ZipfileList.push(oModel.GUID() + ".png"); // pic.setZoom(size) // image improvement only(optional) if(!logInfo (oModel.Name(g_nLoc))){ return false; } if(!pic.Save(sfileName)) { Dialogs.MsgBox("Could not save " + sfileName); return false; } return true; }
The error I get looks like this:
Other errors I get are also from code that try to save to the local system. What is the strategy to save to local files in the ARIS 9.x software?
Hello Toine,
on second thought: You are trying to export a model graphic as .png using the script. This should not be encrypted, since you can do that perfectly well in the client with any license and view it in any graphics program. So the flaw should be elsewhere.
Regards, M. Zschuckelt
Hi Toine,
this has nothing to do with Access license or encryption.
Does this report run on a local installation? Only in this case you can be sure that the path returned by Context.getSelectedPath() really exists, because it's a client path and report are executed on the server. So this works only if both are running on the same machine.
Second: You should not use custom file operations in a ARIS 9 server environment. Context object/output object provide all file operations which should be used.
I solved it eventually. Indeed by using the context output object. This did the trick
function pictureOfModel(oModel, size) {
var pic = oModel.Graphic(false,false,g_nLoc);
var sfileName = oModel.GUID() + ".png"; //alternatives are GUID() or Name(g_nLoc) + "_" + size +
var output = Context.createOutputObject();
ZipfileList.push(oModel.GUID() + ".png");
// pic.setZoom(size) // image improvement only(optional)
if(!logInfo (oModel.Name(g_nLoc))){
return false;
}
if(!pic.Save(output, sfileName)) {
Dialogs.MsgBox("Could not save " + sfileName);
return false;
} else {
Context.addOutputFileName(sfileName);
Context.setSelectedFile(sfileName);
}
return true;
}