[OS X TeX] Defining the file name in the tex file

Claus Gerhardt gerhardt at math.uni-heidelberg.de
Thu Sep 28 16:18:25 EDT 2006


This script is better, since files won't be accidentally overwritten.

Claus

(*Have a template file with the correct suffix open in TS, then run  
the script, aftter inserting the desired name for saveName. Needs  
Flashmode-downloadable.*)


set saveName to "test.tex"

tell application "TeXShop"
	get path of document of window 1
	set fileName to result
end tell

set scriptPath to (do shell script "dirname " & "~/Library/Flashmode/ 
Subroutines/ex")
set scriptPath to scriptPath & "/setnamebbedit_rootn.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 setnamebbedit_rootn(fileName)
end tell

set fileName1 to dirNameunquoted & "/" & saveName
set theFile to POSIX file fileName1
set theLine to 1 as number

try
	tell application "Finder"
		get file theFile
		beep
	end tell
on error
	tell application "TeXShop"
		activate
		close document docName
	end tell
	
	set shellScript to "cd " & dirName & ";"
	set shellScript to shellScript & "cat  " & docName & " " & ">" & " "  
& saveName
	do shell script shellScript
	
	do shell script "~/Library/Flashmode/bin/texshopcg " & theLine & " "  
& fileName1
end try
------------------------- 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