[texworks] Script for selecting pdf viewer
st.loeffler at gmail.com
Sat Dec 8 17:38:02 CET 2012
On 2012-11-20 11:20, Ignasi wrote:
> the scripts menu on TeXworks viewer window shows the option 'Open in
> default viewer'.
> I would like to know if its possible to add another option which
> allows selecting another
> pdf viewer which is not the default one.
In principle, yes. However, the problem for a general solution is to
(reliably) determine what applications are installed on a particular
system that are capable of displaying pdfs (and how they need to be
called - which will be platform-dependent).
That said, for a particular case, it should be fairly easy to achieve.
> I use SumatraPDF as the default viewer but certain beamer animations
> and other tools like ocg
> need AdobeReader and I would like the possibility of opening my
> results with such a viewer from
> TeXworks menu.
> I don't know nothing about scripts so when I edited launchPdf.js to
> look for some 'inspiration'
> I couldn't understand it and I'm stacked.
Writing a script is definitely the way to go here. launchPdf.js is a
good starting point. However, it uses TW.launchFile(), which simply
calls the default application associated with the file it is given
(similar to double-clicking on the file in a file manager).
What you would need is TW.system(), which simply executes the string it
is given as if it were entered in a terminal (or a "Run Application"
dialog). So, for example, something like
TW.system("acroread " + TW.target.fileName)
might work (though I haven't tested it).
More information about the texworks