[texhax] Executing a script with \href{run:script.sh}

Steve Schwartz s.schwartz at imperial.ac.uk
Wed Sep 29 23:24:39 CEST 2010


Henrik

On Wed, 2010-09-29 at 09:36 +0100, Henrik Frisk wrote:
> Hi,
> 
> I'm trying to make a call to a script in a beamer presentation with
> \href{run:media/vertigo.sh} but instead of running the script, when I
> click on it (in acroread) the script  itself opens in emacs. I was
> trying to edit my .mailcap to make acroread use /bin/bash to run the
> script but that didn't help. What am I missing? (I'm on Fedora 10 BTW)

I've fought over this for a few years, and having solved it along the
lines you tried it stopped working. I give below a recipe I found on the
web that works for me. For security I give my scripts a unique ending,
so that it doesn't open acroread up to executing a potentially
malicious .sh file. Let's say you use .mysh as a file type, i.e.,  your
scripts are named myscript.mysh

Now, here's the recipe of what I did:

1. added

<mime-type type="application/mysh">
<comment>Movie Shell Script</comment>
<expanded-acronym>MY mysh</expanded-acronym>
<magic priority="50">
<match value="\x47\x3f\xff\x10" type="string" offset="0"/>
<match value="0x000001b3" type="big32" offset="0"/>
<match value="0x000001ba" type="big32" offset="0"/>
</magic>
<glob pattern="*.mysh"/>
</mime-type>

to /usr/share/mime/packages/freedestop.org.xml

2. sudo update-mime-database /usr/share/mime/    [as directed above]

3  opened nautilus, selected one of my .mysh scripts and set /bin/sh as
the custom command to open it. T
his then works with acroreader AND okular AND evince but NOT kpdf.

[I suspect the magic section is designed to peer into an mpeg file and
recognise it, but it doesn't seem 
to confuse my system so I'll leave it for now...]

I suspect this works better because it adds the mimetype in the right
place(s). Maybe this will work for you.

Regards,
Steve

PS Ah I see you've solved it differently, but the above will avoid
having to do it with individual files. I put the mplayer options in my
scripts. Also I have tried to get them to autoplay but failed. Let me
know if you solve this one. But you will also need to autostop them or
you may find your presentation grinding to a halt with half a dozen
movies continuing to play


> Thanks,
> 
> /Henrik
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
> 
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org
-- 
+-------------------------------------------------------------------+
Professor Steven J Schwartz        Phone: +44-(0)20-7594-7660
Head, Space & Atmospheric Physics  Fax:   +44-(0)20-7594-7772
The Blackett Laboratory            E-mail: s.schwartz at imperial.ac.uk
Imperial College London            Office: Huxley 6M67A 
London SW7 2AZ, U.K.               Web: www.sp.ph.ic.ac.uk/~sjs
+-------------------------------------------------------------------+



More information about the texhax mailing list