[OS X TeX] latexdiff Applescript

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Sat May 6 21:30:29 CEST 2006


I forgot to mention that the subroutine setnamets.scpt (see below)  
has to present in
~/Library/TeXShop/Scripts/setnamets.scpt

Claus

on setnamets(x)
	set n to (number of characters of contents of x)
	set fileNamequoted to quoted form of x
	set windowName to do shell script "basename " & fileNamequoted
	set m to (number of characters of contents of windowName)
	set dirName to quoted form of (characters 1 thru (n - m - 1) of x as  
string)
	set dirNameunquoted to (characters 1 thru (n - m - 1) of x as string)
	set theText to contents of windowName as string
	
	set n to (number of characters of contents of theText)
	set i to n as number
	
	repeat while i > 0
		if character i of theText is equal to "." then
			set m to i
			exit repeat
		else
			set i to (i - 1)
		end if
	end repeat
	
	set baseName to (characters 1 thru (m - 1) of theText as string)
	set texName to baseName & ".tex"
	set namePath to dirNameunquoted & "/" & baseName as string
	set pdfName to namePath & ".pdf" as string
	set rtfName to namePath & ".rtf" as string
	set logPath to namePath & ".log" as string
	set logName to baseName & ".log" as string
	
	try
		tell application "TeXShop"
			save document texName
		end tell
	end try
	return {baseName, texName, pdfName, namePath, dirName,  
dirNameunquoted, logName, logPath, rtfName} as list
end setnamets
------------------------- 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 Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list