05-05-2017 05:15 AM
Hello,
I'm starting a diadem desktop file from a relative path and the file itself contains settings with realtive paths, e.g.
Workspace: '%workdir%\MyWorkspace.WSP';
This works fine. I can also set F-shortcuts to files that are located in the workdir directory when I delete the path in the settings field.
But in the configuration of the workspace I can't handle that the opened files are located in this workdir because their reference is saved with absolute paths and if I delte them in the wsp-file I get an version error.
Any suggestions?
Solved! Go to Solution.
05-09-2017 04:36 AM - edited 05-09-2017 04:38 AM
Hi,
First I want to make sure I understand your problem correctly.
1. %workdir% is a windows environment variable, right?
2. you are using this variable in a desktop (ddd) file by editing it manually, e.g. with a text editor?
3. your example configuration is located at this point of the ddd file?
Begin_AUTOSEQUENCE Begin_Defaults ... Workspace: '%workdir%\MyWorkspace.WSP'; ... End_Defaults; End_AUTOSEQUENCE;
So far this also works for me but where are you changing paths for opened script files?
The wsp file is encoded when opening it in editor (DIAdem 2015 SP2).
Can you please provide a little more information about that?
Regards
05-09-2017 07:20 AM
Hi Christian,
you've got it right. %workdir% is an environment variable and these actually work within the SQL-like coded DDD-file (which can be edited by a textfile-Editor for example).
The WSP-file is encoded and i assume it can't be changed manually.
But i found a solution: loading the script files that you want to have opened in a "default" workspace could be loaded by the starting script, e.g. if you want to load the file "MyScript.VBS" from the relative directory %workdir% you have to implement this code in the starting script:
dim path dim wshShell : set wshShell = CreateObject ("WScript.Shell") path = wshShell.ExpandEnvironmentStrings("%workdir%") MsgBox(path) call AutEdFileOpen(path&"\MyScript.VBS", "VBS-DIADEM")
Where the starting script is defined in the DDD-file:
AppStartScript: '%workdir%\Start.VBS';
Or do you have a better idea??? 😉
05-09-2017 08:04 AM - edited 05-09-2017 08:06 AM
To be honest, I don't know any direct way how to include relative paths in a wsp file.
Your approach with a start script is pretty much the same that I would do.
If you don't want to use WScript.Shell to get the windows variable content, you can also use AutEdWSDeskfile variable which contains the default wsp file path (absolute path which already contains %workdir% content).
But then you still have to extract the folder name, e.g. like this:
dim path path = CreateObject("Scripting.FileSystemObject").GetFile(AutEdWSDeskfile).ParentFolder call AutEdFileOpen(path&"\MyScript.VBS", "VBS-DIADEM")
I think one of those approaches using a start script is better and safer than modifying too much of the configuration file contents manually.
Regards