|PDF Xtra for Authorware
Due to the differences in the way Acrobat and Reader behave from one version to another, it is sometimes desirable for an Authorware piece to detect which version the user has installed and then take appropriate action.For instance, if there is no Acrobat or Reader installed or the version is too old, the piece could alert the user to go to the appropriate URL and download the most recent version, or a version of Reader can be run from CD.
The global method PDF_AcrobatInfo() returns a list of property lists containing the name, version number and path, for all Adobe Acrobat or Reader applications installed on the user's computer (and the Preview application on Mac OS X).
You can then check for a specific version of Adobe Acrobat or Reader and launch the installed application from that path, or take another action if the appropriate application is not in the list.
--This code checks to see if a valid version of Adobe Reader or Acrobat is intalled
-- and then branches to the appropriate icon in the flowline.
AcrobatInfo := PDF_AcrobatInfo()
-- returned list looks like this:
-- [[#appname: "Acrobat", #version: "7.0", #path: "C:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe"]]
Done := FALSE
OK_TO_Display_PDF := FALSE
i := 1
NumItems := ListCount(AcrobatInfo)
repeat while (Done <> TRUE) & (i <= NumItems)
Item := ValueAtIndex(AcrobatInfo, i)
app:= ValueAtIndex(Item, 1)
if (app = "Reader") | (app = "Acrobat") then
appver := ValueAtIndex(Item, 2)
ver := SubStr(appver, 1,1)
if (ver = "5") | (ver = "6") | (ver = "7") then
-- prevent false positives by checking the path
appPath := ValueAtIndex(Item, 3)
if appPath <> "" then
OK_To_Display_PDF := TRUE
Done := TRUE -- exit loop and launch the version
i := i + 1
if (OK_To_Display_PDF = TRUE) then
Goto (IconID(@"LaunchViewer") -- launch the version found
-- warn the user to install Reader