Macrovision Knowledge Base

HOWTO: Using the File Existence Condition

Document ID: Q108710
Last Revised On: Friday, October 15, 2004

This article applies to the following:
Product(s):
DemoShield 5.x
DemoShield 6.x
DemoShield 7.x
DemoShield 8.x

Summary

Sometimes a specific action must be performed based on whether a file is available during demo playback. To assist with this setup, DemoShield has incorporated a File Existence condition within the Condition Builder. Using the File Existence condition, you can check for a file or folder in a specific location and then perform actions based on whether or not the file exists. This is useful for checking whether the viewer has a particular file or folder on their system, or whether a file or folder exists within the distribution.


Discussion

The following instructions explain how to set up a File Existence condition to check for Notepad.exe in the Windows directory and assigning a launch application action to be triggered if the file exists.

  1. Create a blank demo in DemoShield.

  2. Create a Text Object on the scene.

  3. Open the Properties and label the Text Object T Message.

  4. Select the Object Styles tab and enter in the following line of text:

    The file does not exist in the location specified.

  5. Select the General Tab and unselect the Initial and Current Visible check boxes.

  6. Click OK to close out of the Properties.

  7. Place an Event Object on the scene.

  8. Open the Properties to the Event Object and select the Object Styles tab.

  9. Change the start time of the Event to 1 second outside of Scene Length. For example, if the scene is 60 seconds, set the start time to 61 seconds.

  10. Select the Always Perform True Actions under the Conditions heading and delete this.

  11. Click on the New button to activate the Condition Builder.

  12. Select the File Existence option from the Condition Type drop-down menu. The following appears under Condition Description:

    If file <filler> exists then
    {
    }
    else
    {
    }

  13. Select the <filler> link. An edit field appears for you to enter the path for the file you wish to check for.

  14. Because Notepad.exe resides in the Windows directory, we can use the DemoShield Windows tokens to direct DemoShield to this location. Enter the following into the field:

    <WINDIR>notepad.exe<WINDIR>

  15. Click Apply to set the path in the Condition Description.

  16. Click OK to close out of the Condition Builder.

  17. Select the Actions tab. Here, you will assign the actions that you would like to occur based on whether the file exists in the location specified.

  18. Under the True Actions assign a Launch Application action using the following settings:

    Application Name: <WINDIR>Notepad.exe<WINDIR>
    Set Current Working Directory: No
    Application Command Line: {leave blank}
    Wait for Application to End: No
    Message to be Displayed: None

  19. Click Finish to apply the action.

  20. Under the False actions, assign a Show action to show the Text Object T Message created at the beginning of this example.

  21. Click Finish to apply the action and then click OK to close out of the Event Object Properties. Now that the Event has been set up we can create a Bitmap Button Object to trigger the Event.

  22. Place a Bitmap Button Object on the scene and open the Properties.

  23. Select the Actions tab.

  24. Select the Left-Clicks Mouse Up event and then click on the New button to activate the Action Wizard.

  25. From the Action Wizard, select the Trigger Event action and then click Next.

  26. Apply the following settings:

    Scene Name: Current Scene you are on
    Object Name: Event Object
    Event Name: Time
    Event Trigger Time: 2 seconds outside of Scene Length or for this example it will be 62 seconds

  27. Click Finish to apply the action and then click OK to close out of the Bitmap Button Properties.

  28. Save the demo and test run to check the condition.

When the user clicks on the Bitmap Button to launch Notepad.exe the Condition will be performed to check if Notepad.exe exists in the Windows directory. If it does, a Launch Application action will be performed to launch the file. If it does not, the Show action will be performed to show the message that the file does not exist in the location specified.


Additional Information

For more information on using DemoShield Tokens, refer to Knowledge Base article Q105484 INFO: DemoShield Tokens.

For more information on triggering an Event Object via a Button click, refer to Knowledge Base article Q105130 HOWTO: Creating a Button Object That Will Trigger an Event Object.


References

For more information on using the Condition Builder, see the DemoShield Help Library topic "Condition Builder."

Click here for a sample demo displaying the setup listed above.

 

 



How Can We Improve This KB Article?

Please rate the quality of this article: Excellent Good Fair Poor

Did this article answer your question? If not, we'd like to hear more about it.

If we have any follow-up questions, where can we contact you?

Email Address (optional):

Articles are periodically updated based on your feedback, but a response is not sent to all feedback received.
For answers to your technical support questions, please contact us using one of the support options at http://support.installshield.com/contact/