PDA

View Full Version : Need Help with Condition/Comparison for PDF files...



ESCJoe
01-21-2002, 02:18 PM
Hello.

I am trying to create a demo with the following condition for the PDF files:

If the user has Adobe Acrobat Reader installed,
the demo would open the file in Adobe Acrobat
Else the user is taken to a scene where he/she can click on the link to download Adobe Acrobat Reader (I do not like the idea of forcing the user to install a program without understanding what is going on.)

I believe that I have most of the elements in place (the scene, a button to trigger the event, etc.) However, I still can't get the thing to work.

I know that this question may have been asked several times in the past already and I did a search in the forum but the information is lacking. If I could get the full details, I would appreciate it.

As for my system, I have Demoshield 5.4 running in Windows 2000. If you need any more info, please email me and I will provide whatever I can.

KimberlyH
01-21-2002, 05:02 PM
You can set up your demo to check a registry key to see if the user has a file association for PDF. If they do you can use a Launch Associated Application action to launch the PDF file. If they do not you can assign a Go To Scene action to take the user to a scene containing a Quick Link Object that will direct the user to download the Adobe Acrobat Reader install.

The following instructions will walk you through doing this:

To read a registry key into a DemoShield Demo, select properties from the Demo menu. Under the Globals tab, select one of the Global String Variables to contain the Registry value. You do this by entering the Registry Key you want the DemoShield Player to read at run-time in the String field. The format to enter into the edit field is:

HKEY_CLASSES_ROOT\.pdf;string

This should return the value, AcroExch.Document.

This example illustrates how to have DemoShield check to see if a particular file type has been associated on a system. This example will return PDF File if Adobe Acrobat Reader has been installed on a system. This also means one should be able to click on a file with a .PDF extension and the Adobe Acrobat Reader will launch. If the system returns "Not Found" the key does not exist, thus the .PDF file type has not been associated and when you double click on a .PDF file, Windows will ask you to associate the file extension with an application.

Once you have the Registry Key entered into one of the String Global Variables you can use an Event Object to check the value that has been returned. To do this create an Event Object in your scene. Open the Properties to the Event Object and go to the Comparison tab. Assign the following settings:

If this Object/Variable With this Property/Value
(Global Variable) String1(Global)

is Equal (=)

this object/variable String Constant
(Constant) Not Found

It is best to perform a comparison against Not Found in case the user is has an application other than Adobe Reader installed that performs the file association.

Next, go to the True Actions tab. Assign the actions you wish to occur if the user DOES NOT have a file association with the PDF file. Now go to the False Actions tab and assign the actions you wish to occur if the user DOES have a file association with PDF.

I hope this helps.

KimberlyH
01-21-2002, 05:04 PM
The settings for the Event Object Comparison should look like this:

If this Object/Variable
(Global Variable)

(Global Variable)
String1(Global)

is Equal (=)

this object/variable
(constant)

String Constant
Not Found

Hope this helps.

ESCJoe
01-21-2002, 06:35 PM
Originally posted by KimberlyH
The settings for the Event Object Comparison should look like this:

If this Object/Variable
(Global Variable)

(Global Variable)
String1(Global)

is Equal (=)

this object/variable
(constant)

String Constant
Not Found

Hope this helps.

Thank you very much. I'll try this tomorrow. I hope I can set this up properly. The comparison system was what confused me. Searching through your Knowledge Base got cumbersome.

Thanks again.

ESCJoe
01-22-2002, 12:52 PM
Hello again.

I have tried what you have outlined in your previous reply and it half worked. When the demo is in a computer that had Adobe Acrobat Reader installed, the file opened automatically as planned. However, when the demo is in a computer that had no Adobe Acrobat Reader installed, the scene that prompts the user to download the application does not happen. Do you have any ideas what could cause that?

Below are particular details of my demo:
1. The button/hotspot does the following action - Triggers event for the scene where the hotspot is. The action triggered is an event object. It is a time event and the trigger time is 62 seconds.
2. The event object has the following details - The event starts at 61 seconds into the Scene. The event comparison is
If this object/variable (Global Variable)
Global Variable (String1 Global)

is Equal (=)

ths object/variable (Constant)
String Constant (Not Found)

True action is to go to scene about needing Adobe Acrobat Reader.

False Action is to launch associated application for the PDF file.

I believe that is about it. Thanks again for the advice and your help.

ESCJoe
01-23-2002, 12:00 PM
Just following up...

Any idea on the problem I have above?

KimberlyH
01-23-2002, 12:26 PM
From the information you have provided it appears that everything is correct. Without seeing the actual demo, it is difficult to pin point what may be keeping it from going to the other scene.

I have created a sample demo for you to view. Please take a look and compare against your demo.

I hope this helps.

ESCJoe
01-23-2002, 02:46 PM
Thanks for the reply.

I got your demo and it works perfectly. In my case, I tried to use what was there and I still could not get it to work.

I have attached the demo here although I am not sure if this is allowed. Can you take a look at the demo for me and see what you think? It should contain the most pertinent parts to make most of the demo work.

KimberlyH
01-24-2002, 09:29 AM
I took a look at your demo and notice you do not have the Registry Key entered into the String1Global variable within the Globals tab of the Demo Properties.

To correct this, go to the Demo menu and select Properties.
Go to the Globals tab.
Within String1Global enter in the following:

HKEY_CLASSES_ROOT\.pdf;string

This will go into the user's registry and retreive the value for the .pdf extension.

Save your demo and retest.

I hope this helps.

ESCJoe
01-24-2002, 11:27 AM
Thanks!!

This just shows how much experience I have with the program. Hopefully, I can learn this some more and make things easier for me.

Thanks again. You can expect more messages from me in the future.