[OS X TeX] Configure TeXshop to use ``ANT''?

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Thu Oct 12 18:49:53 EDT 2006


Now I understand William's reply to my mail. Here is an Applescript  
which could serve as a temporary solution. I couldn't test the  
script, but any errors should be easy to correct.

Claus


-- Applescript
-- Claus Gerhardt

(*The script creates a basename.ant file when a  basename.tex file is  
open in TS and runs the shell script ant which is supposed to be in ~/ 
Library/Flashmode/bin/ant, and opens the pdf file.  Needs Flashmode- 
downloadable.*)


--on ant()
tell application "TeXShop"
	get path of document of window 1
	set fileName to result
	--set saveName to the content of the selection of the front document
	--set saveName to saveName & ".tex"
end tell
set previewer to "TeXShop"


set scriptPath to (do shell script "dirname " & "~/Library/Flashmode/ 
Subroutines/ex")
set scriptPath to scriptPath & "/setnametsn.scpt"
set scriptName to POSIX file scriptPath as alias
set scriptLiB to (load script scriptName)
tell scriptLiB
	set {baseName, texName, pdfName, namePath, dirName, dirNameunquoted,  
logName, logPath, rtfName, docName} to setnametsn(fileName)
end tell

set antName to baseName & ".ant"
set fileName1 to dirNameunquoted & "/" & antName
set theFile to POSIX file fileName1
set theLine to 1 as number

set dialogSave to "File already exists. Do you want to overwrite it?"

try
	tell application "Finder"
		get file theFile
		set theAnswer to the button returned of (display dialog dialogSave  
buttons {"No", "Yes"} default button "No") as string
		if theAnswer is equal to "Yes" then
			
			set shellScript to "cd " & dirName & ";"
			set shellScript to shellScript & "cat  " & docName & " " & ">" & "  
" & antName
			do shell script shellScript
			try
				set shellScript to "cd " & dirName & ";"
				set shellScript to shellScript & "~/Library/Flashmode/bin/ant  "  
& antName
				do shell script shellScript
				
				set thePDF to POSIX file pdfName as alias
				set scriptPath to (do shell script "dirname " & "~/Library/ 
Flashmode/Subroutines/ex")
				set scriptPath to scriptPath & "/preview_bbedit.scpt"
				set scriptName to POSIX file scriptPath as alias
				set scriptLiB to (load script scriptName)
				tell scriptLiB
					preview_bbedit(docName, thePDF, previewer, process_name)
				end tell
				
			on error
				set logFile to logPath as POSIX file
				tell application "TeXShop"
					activate
					open logFile
				end tell
			end try
		else
			beep
		end if
	end tell
on error
	
	set shellScript to "cd " & dirName & ";"
	set shellScript to shellScript & "cat  " & docName & " " & ">" & " "  
& antName
	do shell script shellScript
	try
		set shellScript to "cd " & dirName & ";"
		set shellScript to shellScript & "~/Library/Flashmode/bin/ant  " &  
antName
		do shell script shellScript
		
		set thePDF to POSIX file pdfName as alias
		set scriptPath to (do shell script "dirname " & "~/Library/ 
Flashmode/Subroutines/ex")
		set scriptPath to scriptPath & "/preview_bbedit.scpt"
		set scriptName to POSIX file scriptPath as alias
		set scriptLiB to (load script scriptName)
		tell scriptLiB
			preview_bbedit(docName, thePDF, previewer, process_name)
		end tell
		
	on error
		set logFile to logPath as POSIX file
		tell application "TeXShop"
			activate
			open logFile
		end tell
	end try
	
end try
--end ant
------------------------- 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 MacOSX-TeX mailing list