DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Relative path for ddd, wps and script shortcuts

Solved!
Go to solution

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?

0 Kudos
Message 1 of 4
(3,144 Views)

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

Christian
CLA, CTA, CLED
0 Kudos
Message 2 of 4
(3,087 Views)
Solution
Accepted by topic author olhass

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??? 😉

 

0 Kudos
Message 3 of 4
(3,078 Views)
Solution
Accepted by topic author olhass

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

Christian
CLA, CTA, CLED
0 Kudos
Message 4 of 4
(3,074 Views)