|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
run a shell script from a beamer-generated pdfHi,
I'm trying to run a shell script from a latex-generated pdf file. In the latex code, I use \href{run:shell.sh}{here} I include the hyperref package but when I click on the hyperref within the generated pdf file, I open the shell script in a text editor instead of executing it. Does anybody knows what I am doing wrong? |
|
|
Re: [Latex-beamer-users] run a shell script from a beamer-generated pdfOn Monday, 31. August 2009 02:46:28 Rosie80 wrote:
> Hi, > I'm trying to run a shell script from a latex-generated pdf file. > In the latex code, I use > \href{run:shell.sh}{here} > I include the hyperref package > but when I click on the hyperref within the generated pdf file, I open the > shell script in a text editor instead of executing it. > Does anybody knows what I am doing wrong? Hi Rosie, I would expect the script to work just the way you found in the other thread. However, you could have included the quote in this message also and thus avoid thread-hijacking. But nevertheless, my first idea would be, is the script executable? As always, some miniexample might be helpful to better understand your situtation. Best, Cedric ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Latex-beamer-users mailing list Latex-beamer-users@... https://lists.sourceforge.net/lists/listinfo/latex-beamer-users |
|
|
Re: [Latex-beamer-users] run a shell script from a beamer-generated pdfRosie,
On Mon, 2009-08-31 at 01:46 +0100, Rosie80 wrote: > Hi, > I'm trying to run a shell script from a latex-generated pdf file. > In the latex code, I use > \href{run:shell.sh}{here} > I include the hyperref package > but when I click on the hyperref within the generated pdf file, I open the > shell script in a text editor instead of executing it. > Does anybody knows what I am doing wrong? I think this is probably because your acroreader, or whatever, doesn't know what you want it to do. Here are some notes I made for myself a while back, which involve adding things to mailcap and mimetype. Be warned, however. Opening up your pdf reader to execute arbitrary shell scripts could be dangerous is someone sends you a rogue pdf which invokes a script to wipe your hard-disk! Hope this helps. Steve ------------------------------- Some time ago I posted a query concerning launching a script to run a movie from a pdf file created by pdflatex (e.g., using beamer to make a presentation). Here's my original posting: http://www.tug.org/pipermail/texhax/2005-September/004624.html Many people have written to me asking if I had found a solution, to which my reply was no. Then Achim Beetz did the same thing and, a couple of hours later, sent me the (partial) solution from which I put together the final bits. What follows is how it's done in Linux. It's all a question of mimetypes that acroread knows how to handle which, of course, it gets from the system, e.g., /etc/mailcap, ~/.mailcap, etc. In addition (which Achim didn't tell me), you need to teach your system about the file extensions, in ~/.mime.types, so it can then go look up the appropriate application. In your latex source there is, for example: \href{run:movie_script.sh}{Click Here} movie_script.sh is just a shell script to run your favorite player, e.g. a file with the one line: mplayer -geometry 50%:50% -nofs /home/sjs/movies/mymovie.mpg (xine also works pretty well; you need something with a good command line interface and which gives you control, e.g., to hide the controls, etc.). Then you need: In ~/.mailcap: application/x-sh; /bin/sh %s to invoke sh to run your shell script. You can also use /bin/bash or some other shell interpreter. You also need to associate the .sh ending with a shellscript: In ~/.mime.types: application/x-sh sh That's it! In putting together the final pieces following Achim's help, I ran across postings that discouraged putting application/x-sh in your .mailcap. I presume this is because your browser will also pick up this information and if a web-page has a similar href link to a shell script, it will run it without prompting on your machine! Of course, it has to first put a suitably evil shellscript somewhere it can find and then execute it. But I can see the dangers. I guess there might be a way to modify the acroread script so that only acroread finds this .mailcap entry. Suggestions from gurus most welcome. Perhaps using your own special filename ending and only putting that in .mime.types would be sufficient, or more tediously simply editing/swapping multiple versions of .mailcap files. Finally, as Achim pointed out, you can do the same thing directly on the movie file, by specifying, e.g., In ~/.mailcap: video/*; mplayer [options] %s You will obviously need to teach .mime.types about suffices for video files. Then you can run the movie directly: \href{run:mymovie.mpg}{Click Here} This is another way to avoid the security risk of opening up /bin/sh, at the expense of not being able to control the movie geometry, repitition, or other parameters you might put on the command line. Perhaps these could all be coerced into the "filename" passes through %s? -- +-------------------------------------------------------------------+ Professor Steven J Schwartz Phone: +44-(0)20-7594-7660 Head, Space & Atmospheric Physics Fax: +44-(0)20-7594-7900 The Blackett Laboratory E-mail: s.schwartz@... Imperial College London Office: Huxley 711A London SW7 2AZ, U.K. Web: www.sp.ph.ic.ac.uk/~sjs +-------------------------------------------------------------------+ ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Latex-beamer-users mailing list Latex-beamer-users@... https://lists.sourceforge.net/lists/listinfo/latex-beamer-users |
|
|
Re: [Latex-beamer-users] run a shell script from a beamer-generated pdfThank you for your answers.
The problem was that my OS opens all the .sh files with a text editor. I changed that into the file properties and,now, the link is working. ![]() Rosilde
|
|
|
Re: [Latex-beamer-users] run a shell script from a beamer-generated pdf
|
| Free embeddable forum powered by Nabble | Forum Help |