PDA

View Full Version : How To Find a Directory



WHerbert
01-10-2003, 12:04 PM
Express ver 4.

I want to be able to find the fonts directory for Adobe Acrobat (already installed) so that I can install custom fonts. How can I do that?

TIA

Chandima
01-10-2003, 12:28 PM
First you need to determine what you want to look for:

Do fonts in the Acrobat fonts folder have unique extensions?
If you find the folder path to the Acrobat exe file, can you build the directory to it's fonts from there?
Is there a registry entry that will tell you the path to the fonts folder?

1. Go to Requirements View
2. Select "Software Requirements" node and Right click
3. Select "Create New Launch Condition"
4. Select the method you want to perform the search and then configure the wizard.

You can use the results of the search for your setup.

WHerbert
01-10-2003, 03:17 PM
OK... I can find the install path for the reader in the registry under the key

\HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\5.0\InstallPath

This returns the string

d:\Program Files\Adobe\Acrobat 5.0\Reader

which is where the executable AcroRd32.exe is stored. However, the fonts are stored in

d:\Program Files\Adobe\Acrobat 5.0\Resources\Fonts

so this is not the match I would need.

The fonts folder does not have a registry entry, but they do have a unique extension of .pfm. However, these font extensions _can_ be found in other directories... older versions of Acrobat, or other products which use custom fonts, so this doesn't guarantee the correct folder.

So... if I do use the regstry entry, how do I manipulate the path I find to use it as an installation directory for the fonts?

I appreciate your quick and informative responses.

Chandima
01-10-2003, 03:57 PM
Try the following:

1. Go to Requirements View
2. Launch new Launch Condition Wizard
3. Press "Next"
4. Select "Registry entry, that contains a folder"
5. Press "Next"
6. Configure as follows:

Registry root: HKEY_CURRENT_USER
Registry Key: Software\Adobe\Acrobat Reader\5.0
Registry value: InstallPath

7. Press "Next"
8. Enter message as "Couldn't find the folder. Stopping install." Press "Finish". This should create a new node named "INSTALLPATH".
9. Change this searches icon to the "empty box" state.

To make the files install here:
1. Go to Files View
2. Create a root level folder named "MyTest"
3. Add your font files to this folder
4. Create a VBScript custom action and let it launch after Install Welcome dialog. Make it point at the following VBScript:

Dim FolderVal

FolderVal = Session.property("INSTALLPATH")
MsgBox FolderVal
TempFold = Split(FolderVal, "\")
TempFoldLimit = Ubound(TempFold)

for i = 0 to (TempFoldLimit-1)
NewFold = NewFold & TempFold(i) & "\"
next

ACRFont = NewFold & "Resources\Fonts"
MsgBox ACRFont

Session.property("MYTEST") = ACRFont

Build the setup and install. Let me know if it works.

WHerbert
01-10-2003, 04:03 PM
Ahhhhh... the lightbulb comes on... the alternative would be to write a quickie executable in C or pascal in place of the VB script so then I would not have to worry about a script engine dependency... all the rest of the procedure would be pretty much the same.

Many thanks for your help.

Chandima
01-10-2003, 04:08 PM
If so I suggest you use an C DLL because then you can use the "New Style DLL" custom action to get and set the msi properties I have used in the script. See the "New Style DLL Custom Action help" for a very simple sample that retrieves the Product Name using MsiGetProperty (this code is written in C++ by the way). Good luck!

WHerbert
01-10-2003, 05:06 PM
OK... I see... one problem with my approach of using a simple executable is that I have no way of knowing the install drive or dirctory... the place that I would install my font files for copying to the acrobat directory. But, could I not have those fonts on the install CD, read the registry values for acrobat, construct a path and copy directly from install CD to the acrobt directory?

Chandima
01-10-2003, 06:22 PM
Absolutely. What you do with Custom Actions is entirely up to you. Only thing is then you're pretty much writing your own little install routine :).

If you are doing it this way, here are a couple of hints:
1. If you put the font files in the "Disk1" node of the "Setup Files" view, at build time they will be on the root level of the CD.
2. Since you seem to have code to read from the registry, you can use this to your advantage and retriev the install location and source location for your custom action. In the Registry View, create a key and put two string data entries that have the following values:

[INSTALLDIR]
[SourceDir]

After the install is complete (by the time Setup Complete Success dialog comes up), these registry keys will resolve to the actual install location, and location of msi (which will give you the CD rom drive letter since you ARE using a CD).