Determine Data Directory using Formula

I want to determine the data directory of a person’s Notes Client using formula.

I have everything working when I hard code a path. Unfortunately not everyone has the same setup so hard-coding "c:\lotus\notes\data" is not a great solution.

  • @environment only works for fields that begin with “$”

  • relative paths don’t seem to work either

Is there another way to determine the where the data directory is located?


I need to get a proper value for IconPath_Actual. Here is some sample code :

choice :=@PickList( [Custom] : [Single]; “” ; “vFollowUpIcons” ; “Select a follow-up icon to be displayed in the document and views:” ; “Please select the follow-up status from the list below:” ; 1 );

@SetField(“FollowUpIconNumber”;choice) ;

IconPath_ExampleOnly := “C:\Lotus\notesR6\data\domino\icons\vwicn081.gif”;

IconPath_Actual := @Environment(“Directory”) + “\domino\icons\vwicn” + choice + “.gif”;

@Command([EditGotoField] ; “FollowUpIcon”);

@Command([FileImport] ; “GIF Image” ; IconPath_Actual)

Subject: Determine Data Directory using Formula

You can use formula: @RegQueryValue(“HKEY_LOCAL_MACHINE”; “Software\Lotus\Notes”; “DataPath”)

/Andrei

http://dominounlimited.blogspot.com

Subject: Determine Data Directory using Formula - sample code

Thank you. it worked.

Here is some working code if someone ever stubbles across this and needs something similar.

Note: “FollowUpIcon” must be an EDITABLE richtext field (you can unclick “Show Field Delimiters” for better display)

IconChoice :=@PickList( [Custom] : [Single]; “” ; “vFollowUpIcons” ; “Select a follow-up icon to be displayed in views:” ; “Please select the follow-up status from the list below:” ; 1 );

IconName := “vwicn” + @Trim(@RightBack(IconChoice ; “|”)) + “.gif”;

@SetField(“FollowUpIconNumber”; IconChoice) ;

IconPath := @RegQueryValue(“HKEY_LOCAL_MACHINE”; “Software\Lotus\Notes”; “DataPath”) + “domino\icons\” + IconName;

@Prompt([Ok];“Path”;IconPath);

@Command([EditGotoField] ; “FollowUpIcon”);

@Command([FileImport] ; “GIF Image” ; IconPath)