Opening a PDF

Geoff Canyon gcanyon at inspiredlogic.com
Mon Dec 31 14:00:01 EST 2001


At 11:51 AM -0600 12/31/01, Ken Ray wrote:
>On a Mac, you can use AppleScript to do it:
>
>    tell application "Finder"
>      open file "My Hard Disk:mypdf.pdf"
>    end tell
>
>using the "do <script> as applescript" command.
>
>To find out if Acrobat is installed, you can check (on Windows) the
>following registry key:
>
>    get
>queryRegistry("HKEY_CLASSES_ROOT\AcroExch.Document\shell\open\command\")
>
>which will give you the path to the currently installed version of Acrobat
>(you'll have to strip out quotes and %1 parameters, but you get the idea).
>
>I'm not sure of the best way to see if Mac Acrobat is installed other than
>looking where is *should* be. Perhaps there's an AppleScript that can be
>used?

You could do this (CARO is the creator code for Acrobat):

set tFileSpec to choose file with prompt "Select a File:"
set tAppPath to ""
tell application "Finder"
	try
		set tAppPath to (application file id "CARO" as string)
	on error
		display dialog "Couldn't find Acrobat."
	end try
end tell
if tAppPath is not "" then tell application tAppPath to open tFileSpec

regards,

Geoff



More information about the use-livecode mailing list