[OS X TeX] Re: Automator with latexdiff?
jushen at gmail.com
Mon Sep 12 13:33:55 CEST 2005
Didn't want to totally waste my weekend, I wrote a simple AppleScript
for this task. I know not much about AppleScript, so it is for sure
there's much to be improved. I would also appreciate any comments.
This script, when saved as compiled application with no Start up
screen, will be invoked by double clicks. You will be asked asks to
choose the source file, the modified file (i.e., 2 files), and the
folder in which you want the comparison result to be saved. The
default name is diff.tex. It then is passed to TeXShop and opens by
Prerequisite: You need to have latexdiff installed.
Note: I think the script is quite self-evident. You are welcome to
modify according to your setup.
property diffFile : "diff.tex"
set theFile to (choose file with prompt "Select the source file:")
set sourcePath to quoted form of POSIX path of theFile
set newFile to (choose file with prompt "Select the modefied file:")
set modefiedPath to get quoted form of POSIX path of newFile
set theFolder to (choose folder with prompt "Where to save diff file?")
set targetPath to POSIX path of theFolder
do shell script "/usr/local/bin/latexdiff " & sourcePath & " " &
modefiedPath & ">" & (quoted form of (targetPath & diffFile))
set macPath to POSIX file (targetPath & diffFile)
tell application "TeXShop"
On 9/11/05, Jung-Tsung Shen <jushen at gmail.com> wrote:
> Hope this is not off topic too far.
> I installed latexdiff the other day, and thought it's very useful. I
> have been trying to "automate" the whole process using Automator + Run
> Shell Script the whole weekend but in vain.
> Here's what I did:
> (1) "Ask for Finder Items". Allow Multiple Selection.
> (2) "Get UNIX Paths of Files" (which I downloaded from the internet.
> Already tested it. Worked as expected.)
> (3) "Run Shell Script". Shell: /bin/csh ; Pass input as arguments.
> The little script myDiff looks like:
> #! /bin/csh -f
> latexdiff $1 $2 > tempPath/diff.tex
> (4) Open Finder Item: diff.tex
> Unfortunately, I kept getting empty file diff.tex.
> The command
> /bin/csh path/myDiff file1.tex file2.tex
> worked as expected, though.
> I actually know very little about all these stuff, was simply allured
> by the name "Automator" and thought it's a simple task ....
> I appreciate any help to make this work, and make my weekend not wasted. :-)
--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
& FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>
More information about the Macostex-archives