pdf files

Ken Ray kray at sonsothunder.com
Mon May 13 00:43:01 EDT 2002


Mike,

The following was posted by Peter Reid on the Runtime Revolution site a
while ago... have fun:

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
------------------------------
Thanks to advice from others on this list, I now have a
cross-platform (Mac OS Classic, Mac OS X, Windows) solution to
opening the default Acrobat viewer application such that it can stay
open in the background and open successive Acrobat files by the use
of the "launch sample.pdf with acrobatViewer" command.

The following is the stack script of my mini app that launches the
default Acrobat viewer and then quits leaving the viewer running:

constant \
     cSamplePDF = "sample.pdf", \
     cXexternalsStack = "xExternals.rev", \
     cClassicExternalsStack = "ClassicExternals.rev"

on preOpenStack
   global gAcrobatViewer, gProgPath
   -- find current program folder:
   put the fileName of this stack into gProgPath
   set itemDelimiter to "/"
   delete last item of gProgPath
   put "/" after gProgPath

   if "Win" is in the platform then
     -- find default Win Acrobat viewer:
     put word 1 to -2 of \

queryRegistry("HKEY_CLASSES_ROOT\AcroExch.Document\shell\open\command\")
\
         into gAcrobatViewer
   else
     -- find default Mac Acrobat viewer:
     -- activate appropriate Externals:
     put the systemVersion into sysVers
     set itemDelimiter to "."
     if item 1 of sysVers >= 10 then
       start using stack (gProgPath & cXexternalsStack)
     else
       start using stack (gProgPath & cClassicExternalsStack)
     end if
     -- get path of Mac Acrobat viewer:
     set itemDelimiter to gModuleListSep
     put gProgPath & cSamplePDF into samplePDF
     put ext_doctoapp(samplePDF) into gAcrobatViewer
   end if

   -- open default Acrobat viewer & quit:
   if the environment is not "development" then
     launch gAcrobatViewer
     quit
   end if
end preOpenStack

This uses the Externals that can be downloaded from the RunRev web site at:


http://www.runrev.com/revolution/developers/developerdownloads/externalscoll
ection.html

The two stacks named in the "constants" section ("xExternals.rev" and
"ClassicExternals.rev") are empty except that they have had the
relevant version of the Mac Externals installed into them.  Note that
you MUST be running Mac OS Classic when installing the Classic
Externals and running Mac OS X when installing the X Externals.  If
you attempt to open the wrong Externals for the current OS, Rev will
crash out!

For Windows, the mini app simply interrogates the registry to get the
details of the default Acrobat viewer app.  For the Mac, the above
"starts using ..." the externals stack which is appropriate for the
currently running version of Mac OS and then uses the
"ext_docToApp()" function to get the name of the default Acrobat
viewer.  For this to work you need to supply the name of an existing
Acrobat file - "sample.pdf".

So, I have the following files in the same folder:

    AcrobatLauncher.exe     - Win standalone Acrobat Launcher (1.6Mb)

    AcrobatLauncherClassic  - Mac OS Classic standalone Acrobat Launcher
(3.9Mb)

    AcrobatLauncherX        - Mac OS X standalone Acrobat Launcher (2.4Mb)

    ClassicExternals.rev    - Rev stack containing Mac OS Classic
Externals (52Kb)

    xExternals.rev          - Rev stack containing Mac OS X Externals (52Kb)

    Sample.pdf              - tiny Acrobat file, content is irrelevant
(72Kb)

My main app uses similar code to the above to determine the path of
the default Acrobat viewer app for use with the "launch" command.

Note that using the "ext_appsOpen()" function in the Mac Externals,
it's possible to check whether an Acrobat viewer app is already
running prior to running AcrobatLauncher.  Unfortunately, I still
don't know how to do the same thing for Windows as yet.

Thanks to everyone who's contributed to this, I hope the above is of
help to anyone else trying to do the same thing (or something similar
with "launching" of apps).

Cheers

Peter
--
Peter Reid
Reid-IT Limited, Loughborough, Leics., UK
Tel: +44 (0)1509 268843 Fax: +44 (0)870 052 7576
E-mail: preid at reidit.co.uk
Web: http://www.reidit.co.uk
_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution

----- Original Message -----
From: <MMessieh at aol.com>
To: <metacard at lists.runrev.com>
Sent: Sunday, May 12, 2002 12:19 PM
Subject: Re: pdf files


> How do you open a URL pdf file with Metacard?
>     If you have a field "url" with several pdf file urls then...
> put the selectedText of fld "url" into ff
>     if ff is empty then exit switch
>     get char -4 to -1 of ff
>    put url ff into fld "urlresult"
> How do you get the result to be opened by Acrobat reader?
> mike
> mmessieh at aol.com
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard
>




More information about the metacard mailing list