Problem with Launch Command
preid at reidit.co.uk
Thu Feb 21 04:43:01 EST 2002
>I haven't had time to test this, but just to give you a possible idea to
>use, try adding appropriate scripts to a substack and a main stack to do the
>following: 1) open Acrobat Reader from the substack (perhaps a splash
>screen stack), 2) open your main stack, 3) close the substack, and then 4)
>use launch commands from the main stack to open multiple PDFs within the
>existing instance of Acrobat Reader. It seems to me that using the substack
>in that way would be the equivalent of opening the reader outside of the
>stack from which you're going to be launching the multiple PDFs. I'm sure
>you'd have to close the substack first in order to achieve that effect. I'd
>be interested in hearing whether that route works for you.
>Have you considered my suggestion of avoiding launch (at least the second
>time) and using AppleScript to directly ask Acrobat to open the file?
Thanks to both Tommy and Ben for their suggestions above.
I've tried a variant of Tommy's suggestion, that is I've created a
minimal stack that simply launches Acrobat and then quits. I've
turned this stack into a standalone app (AcrobatLauncher). I'm not
sure that a substack of the main stack approach would work as the
launch of Acrobat would still be a child process of the main stack.
Now I can trigger this AcrobatLauncher app to open Acrobat in a way
that means it is externally opened and behaves as required (i.e. I
can open several Acrobat docs using "launch" in my main stack/app and
I don't need to "kill" anything). HOWEVER, I now have the problem
that I can't tell whether Acrobat is already running or not! My main
program/stack needs to check whether Acrobat is already running, if
not it must launch my small AcrobatLauncher program BEFORE using the
"launch" command to open the next Acrobat file.
So, the question now becomes, how to I check whether Acrobat is
already running or not for both Mac and Windows (bearing in mind that
it could be any version of Acrobat and it may be the full Acrobat or
simply the Acrobat Reader)? The "openProcesses" does not tell you
about any processes NOT opened by the running stack/app.
Whilst Ben's idea looks good, it only provides a Mac solution, not a
Windows one, so I put this to one side for now until I've exhausted
any dual platform solutions. Also, I have a slight concern about
using AppleScript as to whether I can absolutely rely on the Mac
users' system having the full AppleScript support installed?
Reid-IT Limited, Loughborough, Leics., UK
Tel: +44 (0)1509 268843 Fax: +44 (0)870 052 7576
E-mail: preid at reidit.co.uk
More information about the Use-livecode