For some reason loading this .TDR template sometimes, but not always, throws the bottom error on the command:
Call Report.LoadLayout("N:\TeamShares\Data\Software\DIAdem\DIAdem Scripts\NVH\Report Layouts\Twist_v180720_A.TDR")
Then throws the top error on the WndShow() command.
The report layout loads fine outside of the script. It also occasionally loads fine from within the script. I couldn't find much documentation in the way of what causes that particular error.
It looks like you're loading the TDR file from an "N" drive. Is this a network drive? And are you trying to access this file from different computers or user accounts?
The error messages seem to be indicating an access violation, which may have something to do with user permissions. Is it possible to copy this file onto your local drive in a public directory to see if you are able to replicate the behavior that way?
Strangely, when I copy the exact line of code,
from the main script to a new script and call it by itself, it loads the TDR template with no error.
So the computer must have access to that network path. As you suggested, it behaves like something earlier in the script, like some type of access privelege, prevents it up from loading the TDR, however this is the only section of the main script that has anything to do with the REPORT object.
It sounds like you at least better understand the behavior you're seeing. Are you able to get your script up and running, or are you still having issues?
I'm getting the script to work by first loading the TDR, then running the script. I still get the DIATxObj.dll error when loading the report template from within the script. It's not just the one template either, so if I want to populate different templates, I have to split the script into two, manually load the second template, then run the second script. Unfortunately that error message doesn't give much information about what's really going on...
I think that there may be an issue with Read/Write permissions on those files when accessed from a script. Could you try seeing if you can save changes to a file once it's loaded? If you can't, then there may be an issue with the application not being given write access to the TDR files on your network drive.
It does seem like it could be a symptom of file permissions, however the problem persists even when I copy the TDR to the local hard drive and load it from there...
I'm not sure how the script loads the file, so even if the file or directory doesn't limit the access to read only, the script command may load the file with read only access. This is why I was asking if you could try saving changes to the file once it's loaded to make sure that the file is loaded with write access.
Feel free to post on the forum if you get the chance to test this!
Just wanted to provide an update to this. I migrated to DIAdem 2018 on a new computer running Windows 10 x64. I am an "administrator" on this computer. This problem still persists and is more of an issue as I try to script more operations with TDR layouts.
This error occurs whether the TDR is on my local drive or a network drive. Could this have to do with the content of the TDR? It's odd that I didn't see this for several weeks after updating to DIAdem 2018, but now it happens about 50% of attemps at loading a TDR from a script. The result of this is that DIAdem has to be restarted.