[OS X TeX] how to handle window-mania?

Claus Gerhardt claus.gerhardt at urz.uni-heidelberg.de
Fri Oct 15 00:02:52 CEST 2004


> BTW, does anyone have a TeXShop script to open included file?  (e.g., 
> hilight the name of a file in an \input or \include statement, run the 
> script, and the document in question is opened?)  I've gotten used to 
> it from programming editors...

Matthew,

below is an Applescript for BBEdit with this functionality. It is 
assumed that my BBEdit subroutine scripts are installed in 
~/Library/TeXShop/Scripts.

Furthermore, the included file is assumed to be in the same directory 
as the source file and is referred to simply by its basename.


Claus

-- Applescript
-- Apply only to an already saved file.
-- Claus Gerhardt, Oct. 2004

(* The subroutine setnamebbedit returns baseName, texName, pdfName, 
namePath, dirName, dirNameunquoted, and saves the document of window 
texName.
*)

tell application "BBEdit"
	get file of window 1
	set filepath to result
	set fileName to POSIX path of filepath as string
	
	
	set scriptPath to (do shell script "dirname " & 
"~/Library/TeXShop/Scripts/ex")
	set scriptPath to scriptPath & "/setnamebbedit.scpt"
	set scriptName to POSIX file scriptPath as alias
	set scriptLiB to (load script scriptName)
	tell scriptLiB
		set {baseName, texName, pdfName, namePath, dirName, dirNameunquoted} 
to setnamebbedit(fileName)
	end tell
	
	set findName to selection as string
	set fileName to findName & ".tex" as string
	
	set shellScript to "cd " & dirName & ";"
	set shellScript to shellScript & "bbedit   " & fileName
	do shell script shellScript
	
end tell







--------------------- 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 mailing list