Detecting Adobe Reader
Ken Ray
kray at sonsothunder.com
Wed Apr 5 13:44:44 EDT 2006
On 4/5/06 9:05 AM, "revolution at duncansoftware.com"
<revolution at duncansoftware.com> wrote:
> I need to detect the presence of Adobe Reader (and the version if possible) on
>
> Windows 98 thru XP, Mac OS9, and Mac OSX. I have searched the archives, but
> the
>
> code I found there was for starting and running Reader with a pdf file. I just
> need
>
> to "silently" detect its presence or absence.
Here's a function I use (watch for line wraps):
function stsPathToAcrobat
switch (the platform)
case "MacOS"
put format("tell app \"Finder\"") & cr & \
format("get application file id \"CARO\" as text") & cr & \
"end tell" into tScript
do tScript as "AppleScript"
if the result = "execution error" then return "" -- doesn't exist
else return replaceText(the result,quote,"")
break
case "Win32"
put "HKEY_CLASSES_ROOT\AcroExch.Document\shell\open\command\" into tKey
put word 1 to -2 of queryRegistry(tKey) into tPath
return replaceText(tPath,quote,"")
break
end switch
end stsPathToAcrobat
And you could just test to see if stsPathToAcrobat() returns empty or not.
HTH,
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list