HOWTO: Detect Acrobat Version

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Support
    Forum Member
    • Jan 2000
    • 204

    HOWTO: Detect Acrobat Version

    HOWTO: Detect Acrobat Version

    HOWTO: Detect Acrobat Version

    Document ID: IR04027
    The information in this article applies to:
    • AutoPlay Media Studio 4.0

    SUMMARY

    This article explains how to detect what version of Acrobat is installed using AutoPlay Media Studio 4.0.

    DISCUSSION

    Detecting the version of any installed viewer is quite simple in AutoPlay Media Studio 4.0 because of the addition of the File.GetDefaultViewer() action. File.GetDefaultViewer() returns the full path and filename of the viewer associated with a specific file extension on the user's system. While File.GetDefaultViewer() does not determine the actual version of the default viewer itself, once you have the path to the viewer, determining the version becomes trivial: simply pass it to the File.GetInformation action.

    To detect which version of Acrobat is installed we will have to first determine the location of the default viewer for files with the *.pdf file extension. If there isn't one, then we will set the version to 0.0. If there is a default viewer, then we will attempt to get the version information from it using a File.GetInformation action.

    Note: In the case of the *.pdf file extension the default viewer will always be either Acrobat Reader, or the full version of Adobe Acrobat.

    Here is an example of how the actions for getting the version of Acrobat might look:

    %ViewerLocation% = "NONE"
    %ViewerLocation% = File.GetDefaultViewer ("pdf")
    IF (%ViewerLocation% = NONE)
    %AcrobatVersion% = "0.0"
    ELSE
    %AcrobatVersion% = "0.0"
    %AcrobatVersion% = File.GetInformation (Version, "%ViewerLocation%")
    END IF

    The first action simply initializes %ViewerLocation% to "NONE", and the second attempts to store the full path to the default viewer associated with the *.pdf file extension in %ViewerLocation%.

    The IF statement tests to see if File.GetDefaultViewer() returned anything by comparing its value to "NONE". So if %ViewerLocation% is still equal to "NONE" (our initialization value) we know that there is no default viewer. If this is the case we set %AcrobatVersion% to 0.0 since there is no version of acrobat on the user's system.

    If *.pdf does have a default viewer (%ViewerLocation% does not equal "NONE") we will try to get the version information of the default viewer. Before we attempt to get the version information with we will initialize %AcrobatVersion% to 0.0, incase we cannot read any version information from the default viewer. Then we use the File.GetInformation() action to get the version information of the default *.pdf viewer and store the result in %AcrobatVersion%

    If File.GetInformation() fails %AcrobatVersion% will be set to 0.0, otherwise %AcrobatVersion% will contains the version of Acrobat that the user has installed on their system.

    Tip: This method of version detection can be used with any file type. For the most part the only change necessary is the file extension used in the File.GetDefaultViewer() action.

    MORE INFORMATION

    For more information please see the following topics in the AutoPlay Media Studio 4.0 help file.

  • Command Reference | Actions | Variable | Set Value
  • Command Reference | Actions | File | Get Default Viewer
  • Command Reference | Actions | Control Structure | IF
  • Command Reference | Actions | Control Structure | ELSE
  • Command Reference | Actions | Control Structure | END IF
  • Command Reference | Actions | File | Get Information
  • KEYWORDS: AutoPlay Media Studio 4.0, Adobe Acrobat, Version


    Last reviewed: November 1, 2002
    Copyright © 2002 Indigo Rose Corporation. All rights reserved.
Working...
X