07-31-2012 04:06 PM
I am launching DIAdem from LabVIEW with a particular desktop file that has a specific script-extension. In development mode, everything works fine as I have absolute paths.
When I build the LabVIEW application, I will be placing the desktop file and the script into a support "DIAdem" folder. However, the path may change depending upon where the user installs the application.
Is there a way to use a relative path within the desktop file?
Otherwise I guess I'll have my LabVIEW application modify the desktop file upon launch.
Thanks,
Becky
08-01-2012 01:43 PM - edited 08-01-2012 01:43 PM
I've tried to programmatically modify the desktop file by opening it in LabVIEW, replacing the path and resaving it. I used the "Read from Text File" and "Write to Text File" VIs.
When trying to use this modified desktop file in DIAdem, I get an "unexpected end of file" error; call with incorrect handle error and DIAdem configuration read error.
I have attached the LabVIEW code I used to modify the file (version 2011).
Any other ideas would be greatly appreciated.
Thanks,
Becky
08-02-2012 04:02 PM
Hi Becky,
Let me know if you have any questions about what Beau told you on the phone this morning. For everyone else, I suggested that instead of using a DDD file to use the ScriptDefault.VBS that ships with DIAdem and always runs on startup.
Brad Turpin
DIAdem Product Support Engineer
National Instruments
08-02-2012 04:39 PM
Hey Becky,
There is a script, ScriptDefault.vbs, that is always run and is located automatically by DIAdem (C:\Program Files\National Instruments\DIAdem \Libr\Documents\ScriptDefault.VBS). This file is hidden from users.You could add a ScriptCmdAdd() function to this default script file to call a script with user commands.
I hope this helps!
08-02-2012 05:03 PM
Brad/Courtney/Beau -
I was successful in adding ScriptCmdAdd() to the UserCmdExample.VBS file (the one that is registered as an example script extension by default).
I'd prefer to use the ScriptDefault.VBS file, but I get file permission errors when I try to programmatically edit the file using LabVIEW or manually in Notepad++ or the DIAdem script editor. The programs all return that the file is read-only. However, when I view the file properties in explorer, it is not marked read-only. Any suggestions on changing file permissions would be appreciated.
Thanks,
Becky
08-03-2012 10:31 AM
Hi Becky,
Can you delete the ScriptDefault.VBS file with Windows Explorer? If not, then you don't have administrative privileges. If you can, then you will be able to delete or edit that file programmatically as long as the VBScript (DIAdem) is running (was launched) with administrative privileges. That's one downside to the ScriptDefault.VBS approach, it's in the Program Files directory, which many users are locked out of.
Brad Turpin
DIAdem Product Support Engineer
National Instruments