8 Replies Latest reply on Apr 13, 2011 10:56 PM by Ahmad Fattahi

# Is there a variable or constant in PI SDK having the path of the PIPC folder?

Is there a variable or constant in PI SDK having the path of the PIPC folder?

I need this to check automatically where I need to point the references in the Excel Macro,  We are experimenting some troubles because in some users machines the PIHOME is installed in different locations...

Regards,

Julio Farrera

CEMEX EA

• ###### Re: Is there a variable or constant in PI SDK having the path of the PIPC folder?

PI SDK versions 1.3.6.353 and later set up an environment variable for PIHOME upon installation (see this article for more information). Now you can use the function Environ (VB 6) or the Environment class (VB .NET) to access the Windows Environment variables.

Hope this helps!

• ###### Re: Is there a variable or constant in PI SDK having the path of the PIPC folder?

The 32-bit installation path may be read from %winddir%\pipc.ini, [PIPC] PIHOME=

The 64-bit installation path may be read from HKLM\Software\PISystem, string value for PIHOME.

These are the 'authoritative' PI client installation paths.

• ###### Re: Is there a variable or constant in PI SDK having the path of the PIPC folder?

If you want to do it the hard way, can't remember why I did it this way, you could do the following via the registry:

- Lookup the CLSID key of one of the PI SDK objects in the HKCR section, e.g. HKEY_CLASSES_ROOTS\PISDK.PIValue\CLSID.

- Lookup the TypeLib key of the CLSID string value, e.g. HKEY_CLASSES_ROOTS\CLSID\&#123;CLSID_STRING_VALUE&#125;\TypeLib.

- Finally, lookup the "WIN32" and/or "WIN64" keys of the "HKEY_CLASSES_ROOTS\TypeLib\&#123;TypeLib_String_Value&#125;\1.1\0\" key that gives you the paths for 32 bit and/or 64 bit installations.

• ###### Re: Is there a variable or constant in PI SDK having the path of the PIPC folder?

That was amazing Rhys! How about including a diagram or flowchart?

• ###### Re: Is there a variable or constant in PI SDK having the path of the PIPC folder?

We were actually looking for a PI Constant or variable that may store the value for the path or directory where PI tools are installed on a client computer (in this case PIDataLink and PISDK).

There is a chance that end users using the reports we built in Excel with PIDataLink may not have the PI tools installed always in C drive but sometime on another hard drive.

We were looking for a way to know the full path where PI is installed so we can make sure we add (by code) the References of the PI libraries we need for VBA behind our Excel reports.

For now, I have been able to access the Registry and look for the value of the key:

My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\PISystem\PIHOME

Then, I can use this path and add any missing reference by code:

Jesus Varela

CEMEX

• ###### Re: Is there a variable or constant in PI SDK having the path of the PIPC folder?

Jesus,

Glad we could help and it works now!

• ###### Re: Is there a variable or constant in PI SDK having the path of the PIPC folder?

Thanks for your help and I am sorry for not reading complete the solution you offered.

I am actually able to read the value of the Full Path in VBA code with the following lines of code:

Dim slPIHOME As String

slPIHOME = Environ("PIHOME")

Best regards...

Jesus Varela

CEMEX

• ###### Re: Is there a variable or constant in PI SDK having the path of the PIPC folder?

That's OK. now you have multiple options to get the job done!