• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Programatically determine installation location for InDesign CS3, CS4, CS5, AND CS5.5 (Windows)

Contributor ,
Aug 02, 2011 Aug 02, 2011

Copy link to clipboard

Copied

We build plug-ins for all versions of InDesign from CS3 and later, for Windows and Mac.

To deploy our plug-in(s) on Windows, we use InstallShield, which has a somewhat complicated mechanism to locate InDesign.exe and determine its version so we know which plug-in(s) to install, but basically, the location is determined (via the RegLocator table in InstallShield) based on this registry setting:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\InDesign.exe

This has been working fine for all versions of InDesign since CS2.  However, that location is apparently no longer set by the InDesign CS5.5 installer.  So, we need to find some other way of programatically locating InDesign CS5.5 with our installer.

I've searched the registry of a machine with InDesign CS5.5  installed, and there are other registry entries related to InDesign, but those  entries are not set by earlier versions of the InDesign installer.  Ideally, there would be a registry setting, or some other reliable marker we can use to locate the InDesign installation, which is consistent across all versions of InDesign (at least back to CS3).

Using the registry setting is something we came up with on our own via  trial-and-error, since, as far as I know, there is no documented way to  locate the InDesign  installation folder.  (Our Mac installer uses a simpler mechanism to locate InDesign by the application name and version number.)

I find the apparent lack of documentation on this a bit ironic, since just about every other aspect of the SDK and the methods for creating InDesign plug-ins is extremely well documented, expect for the last final bit one needs to know to get to the promised land of actually deploying a carefully crafted plug-in to customers' machines.  (This seems to be true of the Acrobat SDK as well.)  However, I could have just missed the relevant documentation, in which case, please point me to it.

So, is there a recommended way to programatically  locate the InDesign installation location on Windows?  How are other people doing this in their installers?

TOPICS
SDK

Views

3.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 06, 2011 Aug 06, 2011

Copy link to clipboard

Copied

Hello,

This might help.

IDFile file;

ISession* session = GetExecutionContextSession();

InterfacePtr<IPlugInList> pluginList(session, IID_IPLUGINLIST);

if (pluginList == NULL)

break ;

if (! pluginList->GetPathName(kEMVPrefix, &file))

break;

P

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 08, 2011 Aug 08, 2011

Copy link to clipboard

Copied

Thanks for the reply, Pickory, but unfortunately, no, that does not help to answer my question at all.

Yes, once I have an InDesign plug-in installed and running, I can use the InDesign SDK to determine my plug-in's installed location.  (Although I think it would be simpler to call GetModuleFileName from the Windows API, or CFBundleCopyExecutableURL on Mac, instead.)

But I need to determine the InDesign install location before I install my plug-in, so I know where to install it.  And obviously I have to install the plug-in before I can run any of its code.

Please respond as to how you know where to install your plug-in in the first place, in your installer.  Everyone out there must have some way of determining this, right?  Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 08, 2011 Aug 08, 2011

Copy link to clipboard

Copied

Hi Dan,

this is the InDesign plugins SDK forum, you need the installer forum....

Just kidding. I use a really hacky piece of VB to install my plugins while I'm developing...

here's the bit which works out the folder depending on which version I'm compiling for.

That gives you the gist anyway, and I imagine that most installers are going to do more or less the same thing, except they'll have short cuts ways of getting it.

There's probably a better way, but this works for me...


    Private Function DiscoverApplicationFolderFromName(ByRef strApplicationName As String) As String
        Dim strApplicationSignature As String
        Dim strDefaultPath As String

        If (g_strCreativeSuiteVersion = CREATIVE_SUITE_5) Then
            ' special case for CS5, because a debug machine might have CS5 or CS5.5 or both installed.
            ' plugins built with the SDK for 5.5 will not run in CS5 apps
            strApplicationSignature = strApplicationName + ".Application." + CREATIVE_SUITE_55
            Dim strInCopyPath = DiscoverApplicationFolderFromSignature(strApplicationSignature, "")
            If (strInCopyPath <> "") Then
                g_strCreativeSuiteVersion = CREATIVE_SUITE_55
                Return strInCopyPath
            End If
        End If

        strApplicationSignature = strApplicationName + ".Application." + g_strCreativeSuiteVersion
        strDefaultPath = "C:\Program Files\Adobe\Adobe " + strApplicationName + " " + g_strCreativeSuiteVersion + "\" + strApplicationName + ".exe"
        Return DiscoverApplicationFolderFromSignature(strApplicationSignature, strDefaultPath)
    End Function

    Private Function DiscoverApplicationFolderFromSignature(ByRef strApplicationSignature As String, ByRef strDefaultPath As String) As String

        Dim strApplicationPath As String = DiscoverApplicationPathFromCLSID(strApplicationSignature, strDefaultPath)

        If (strApplicationPath = "") Then
            Return ""
        End If

        Dim strDirectory As String = Path.GetDirectoryName(strApplicationPath)

        ' Get rid of the trailing Debug because this depends on whether we install the Debug or Release version first or second.
        ' It will be added on again if we're using a Debug Configuration
        Dim strDebugTag As String = " Debug"
        If strDirectory.EndsWith(" Debug") Then
            strDirectory = strDirectory.Substring(0, strDirectory.Length - strDebugTag.Length)
        End If

        Return strDirectory
    End Function


    Private Function DiscoverApplicationPathFromCLSID(ByRef strApplicationSignature As String, ByRef strDefaultPath As String) As String

        Dim strApplicationPath As String = strDefaultPath

        Try
            Dim strKey As String = strApplicationSignature + "\CLSID"
            Dim regKey As RegistryKey = Registry.ClassesRoot.OpenSubKey(strKey)
            Dim strGUID As String = regKey.GetValue("")
            regKey.Close()

            If IsRegistryVirualized() Then
                strKey = "Wow6432Node\CLSID\" + strGUID + "\LocalServer32"
            Else
                strKey = "CLSID\" + strGUID + "\LocalServer32"
            End If

            regKey = Registry.ClassesRoot.OpenSubKey(strKey)
            strApplicationPath = regKey.GetValue("")
            regKey.Close()

        Catch ex As Exception
            LogMessage("FAILED DiscoverApplicationPathFromCLSID: " + strApplicationSignature)
            strApplicationPath = strDefaultPath
        End Try

        Return strApplicationPath
    End Function

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 16, 2011 Aug 16, 2011

Copy link to clipboard

Copied

Thanks Caerwyn.    So you're looking at a key such as HKEY_CLASSES_ROOT\InDesign.Application\CLSID, finding the CLSID, and then looking at a key such as HKEY_CLASSES_ROOT\[Wow6432Node\]CLSID\{(found CLSID)}\LocalServer32.   This does seem to be consistent between InDesign CS5 and 5.5.  I still need to check on the other various versions of InDesign CS we're supporting.

But still, how do you do this at install time on a customer's machine? 

Unfortunately, this "two hop" approach in the Registry doesn't seem to work with the InstallShield/MSI RegLocator table, so it looks like I'll have to rework our installer.

Anyone else out there using InstallShield or MSI to install your plug-in?  If not, what are you using?  Again, it seems like everyone out there must face this issue, so any further advice would be greatly appreciated.  I'm still hoping that Adobe has an official recommendation.

FYI, for development, we set up our projects with post-build scripts, each of which references an environment variable pointing to the location of the host application for whatever plug-in we're building (various versions of InDesign, Acrobat, QuarkXPress, and others).  The developer has to set this environment variable on his or her development machine.  But this approach obviously doesn't work for customer's machines.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 16, 2011 Aug 16, 2011

Copy link to clipboard

Copied

LATEST

That's the way I do things on my development machin.

I get the Creative Suite version from the build config name, then as you say, get the clsid, then the path from that.

So far it works okay for CS2, through to CS5.5.

It's pretty standard registry stuff, I don't think it's going to break in a hurry.

In the real installer, we just store the CLSID for each version that we support and then it's just a one hop in the registry.

The CLSID is fixed for each application version, it doesn't change from install to install. ie, the CLSID for Adobe InDesign CS4 is the same on any machine it's installed on.

I'm not to 'clued up' on the installer side of things, we're using WiX, and the smarts to get the application path from the clsid seems to be a standard part of the installer.

Sorry I haven't used InstallShield in years.

Regards

Caerwyn

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines