Version 2 of Howto open PDF with Adobe Acrobat or Reader using DDE

Updated 2007-09-30 16:29:37 by ALX

This page provides an example of how to open PDF with Adobe [L1 ] Acrobat or Adobe Acrobat Reader using the DDE package. For more information see DeveloperFAQ.pdf [L2 ], IACOverview.pdf [L3 ] and IACReference.pdf [L4 ].

Alexander Schöpe


 package require dde

 if {[catch {registry get HKEY_CLASSES_ROOT\\acrobat\\shell\\open\\command {}} acrobat]} {
   puts stderr "registry: $acrobat"
   exit 1
 }
 set acrobat [string range $acrobat 0 [string first " /u" $acrobat]]

 if {[catch {registry get HKEY_CLASSES_ROOT\\acrobat\\shell\\open\\ddeexec\\application {}} service]} {
   puts stderr "registry: $service"
   exit 1
 }
 if {[catch {registry get HKEY_CLASSES_ROOT\\acrobat\\shell\\open\\ddeexec\\topic {}} topic]} {
   puts stderr "registry: $topic"
   exit 1
 }

 if {[dde services $service $topic] == ""} {
   exec $acrobat &
 }

 dde execute $service $topic {[FileOpen("C:\IACReference.pdf")]}

Category Example | Category Package | Category Windows | Category DDE