PDA

View Full Version : HOWTO: Detect Acrobat Version


Support
10-22-2002, 05:01 PM
<HTML><HEAD><TITLE>HOWTO: Detect Acrobat Version</TITLE></HEAD><BODY><h3>HOWTO: Detect Acrobat Version</h3><b>Document ID: IR04027</b><hr>The information in this article applies to:<ul><li>AutoPlay Media Studio 4.0</li></ul><hr><h3>SUMMARY</h3><p>This article explains how to detect what version of Acrobat is installed using AutoPlay Media Studio 4.0.</p><h3>DISCUSSION</h3><p>Detecting the version of any installed viewer is quite simple in AutoPlay Media Studio 4.0 because of the addition of the <b>File.GetDefaultViewer()</b> action. <b>File.GetDefaultViewer()</b> returns the full path and filename of the viewer associated with a specific file extension on the user's system. While <b>File.GetDefaultViewer()</b> 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 <b>File.GetInformation</b> action.</p><p>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 <b>File.GetInformation</b> action.</p><p><b>Note: </b>In the case of the *.pdf file extension the default viewer will always be either Acrobat Reader, or the full version of Adobe Acrobat.</p><p>Here is an example of how the actions for getting the version of Acrobat might look:</p><pre><code>%ViewerLocation% = "NONE"<br>%ViewerLocation% = File.GetDefaultViewer ("pdf")<br>IF (%ViewerLocation% = NONE)<br> %AcrobatVersion% = "0.0"<br>ELSE<br> %AcrobatVersion% = "0.0"<br> %AcrobatVersion% = File.GetInformation (Version, "%ViewerLocation%")<br>END IF</code></pre><p>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%.</p><p>The IF statement tests to see if <b>File.GetDefaultViewer()</b> 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.</p><p>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 <b>File.GetInformation()</b> action to get the version information of the default *.pdf viewer and store the result in %AcrobatVersion%</p><p>If <b>File.GetInformation()</b> fails %AcrobatVersion% will be set to 0.0, otherwise %AcrobatVersion% will contains the version of Acrobat that the user has installed on their system.</p><p><b>Tip: </b>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 <b>File.GetDefaultViewer()</b> action.</p><h3>MORE INFORMATION</h3><p>For more information please see the following topics in the AutoPlay Media Studio 4.0 help file.</p><li><b>Command Reference | Actions | Variable | Set Value</b></li><li><b>Command Reference | Actions | File | Get Default Viewer</b></li><li><b>Command Reference | Actions | Control Structure | IF</b></li><li><b>Command Reference | Actions | Control Structure | ELSE</b></li><li><b>Command Reference | Actions | Control Structure | END IF</b></li><li><b>Command Reference | Actions | File | Get Information</b></li><p>KEYWORDS: AutoPlay Media Studio 4.0, Adobe Acrobat, Version</p><hr><FONT SIZE=1>Last reviewed: November 1, 2002<br>Copyright © 2002 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br></FONT></BODY></HTML>