2 Replies Latest reply on Dec 5, 2006 12:08 PM by drew_ford

    Help with Buddy API -- Open PDF URGENT!

    drew_ford
      I'm Using Buddy API, Flash, and Director MX2004 for an interactive CD.

      I need to open a pdf SPECIFICALLY in Acrobat Reader 7.07 --

      I've successfully gotten the interactive to open pdf's -- but if the user has Acrobat Pro 6 or Pro 7, the pdf will open in one of those instead. These programs limit the functionality of the pdf --

      How do I alter the following script so that it opens pdfs solely in 7.07 Reader?
      (Note: if the user has acrobat Reader 6.0 -- the reader automatically suggests they upgrade, and the problem is solved. Pro 6 and 7 do not make it so easy . . .)

      How do I change the script so that the user's machine will open 7 instead of 6?

      Here's the script I'm using now --

      property pDefaultDocDir

      on new (me)
      pDefaultDocDir = "Files"
      return me
      end

      on OpenFile me , p_FileType , p_Dir , p_FileName
      set FileToOpen = the moviePath & pDefaultDocDir & "\" & p_Dir & "\" & p_FileName
      -- Open the FileType
      if (p_FileType = "PDF") then
      me.StartAcrobat ( FileToOpen )
      end if
      end OpenFile

      --Acrobat File opening
      on StartAcrobat me, p_PDFFile
      if ( baFileExists( p_PDFFile ) = 1 ) then -- check if file exists
      set AcroRead32Exe = baFindApp( "pdf" ) -- see if acrobat is installed
      if AcroRead32Exe <> "" then -- if they have acrobat and the file exists
      baOpenFile( p_PDFFile , "Maximised" ) -- open the file
      else --
      sprite(27).callFrame(3)
      end if
      end if
      end StartAcrobat


      Thanks for any assistance I can get!

      Drew

        • 1. Re: Help with Buddy API -- Open PDF URGENT!
          Level 7
          This will tell you what version of Acrobat is installed:

          put baFileVersion(baFindApp("PDF"))
          -- "7.0.0.2004121400"

          So you can see that I am using 7.0. Actually, the baFindApp("PDF")
          thing gets the location/filename of the program associated with PDF. In
          my case it is Acrobat:

          put baFindApp("PDF")
          -- "D:\Program Files\Adobe\Acrobat 7.0\Acrobat\Acrobat.exe"

          If you really need to make sure that it is the Acrobat Reader, then you
          need to run a check against that to make sure it is the right program
          (it would be acroread.exe for someone who does not have the full version
          of Acrobat).

          Then, you can use baFileVersion to get the version number. Since all
          you care about is the 1st 2 pieces, you can parse the version string and
          compare it to the version number you wish. <Warning- untested, just
          typed in off the top of my head Lingo>

          oldDelim=the itemDelimiter
          the itemDelimiter="."
          acroVersion=baFileVersion(baFindApp("PDF"))
          firstBit=acroVersion.item[1]
          secondBit=acroVersion.item[2]
          condensedVersion=float(firstBit&"."&secondBit)
          the itemDelimiter=oldDelim

          if condensedVersion<7.07 then
          --tell the user they need a newer version
          else
          --do your script
          end if

          In my case, my computer would fail this test since I have 7.0 which is
          less than 7.07. You can simplify it significantly if you just want to
          check if it is less than 7.
          • 2. Re: Help with Buddy API -- Open PDF URGENT!
            drew_ford Level 1
            Thanks, Mike.

            I contact Buddy API people in Australia via email -- and have made what I think are their suggested changes in the following script.
            However, it seems like what I need is a hybridization of what you recommended in your response, and what they've sent me.

            However, since I have no background in scripting -- literally, I cut and pasted everything I had originally from a very helpful website -- the terminology and structure mean nothing to me, really.

            Can what I have below be adjusted to do what I need?

            property pDefaultDocDir

            on new (me)
            pDefaultDocDir = "Files"
            return me
            end

            on OpenFile me , p_FileType , p_Dir , p_FileName
            set FileToOpen = the moviePath & pDefaultDocDir & "\" & p_Dir & "\" & p_FileName
            -- Open the FileType
            if (p_FileType = "PDF") then
            me.StartAcrobat ( FileToOpen )
            end if
            end OpenFile

            --Acrobat File opening
            on StartAcrobat me, p_PDFFile
            if ( baFileExists( p_PDFFile ) = 1 ) then -- check if file exists
            set AcroRead32Exe = baReadRegString( "Software\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe", "", "", "HKEY_LOCAL_MACHINE" ) -- see if acrobat is installed
            if AcroRead32Exe <> "" then -- if they have acrobat and the file exists
            set the itemDelimiter = "."
            if integer( item 1 of baFileVersion( AcroRead32Exe ) ) >= 7 then -- version 7 or later is installed
            baOpenFile( p_PDFFile , "Maximised" ) -- open the file
            else --
            sprite(27).callFrame(3) -- earlier version installed, do whatever is appropriate
            end if
            end if
            end if
            end StartAcrobat


            Many thanks --

            Drew