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

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

This time the new name can be written in the template file without  
suffix for making highlighting easier.


(*Have a template file with the correct suffix open in TS, then run  
the script, after inserting the desired name (without suffix) in the  
template file and highlighting it. Needs Flashmode-downloadable.*)

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 scriptPath to (do shell script "dirname " & "~/Library/Flashmode/ 
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

	tell application "Finder"
		get file theFile
	end tell
on error
	tell application "TeXShop"
		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