[OS X TeX] Mountain Lion, BBEdit, TexShop and Applescript

Michael Sharpe msharpe at ucsd.edu
Mon Dec 30 02:24:52 CET 2013


On Dec 29, 2013, at 1:57 PM, David Goldenberg <goldenberg at biology.utah.edu> wrote:

> Michael,
>    Thanks for your reply, and your work on Applescript for TexShop.  Unfortunately, a delay up to 100 didn't eliminate the error (thought it slow it down!), unless, like you, I turned off "configure external editor".  I'd prefer not to have the TexShop editor window appear, as it just adds to the clutter and my confusion.
> 
> Thanks,
> David
> 

Here's a small variant form that does seem to work with "configure external editor" checked, but "automatic preview update" unchecked.

set TSLibAlias to alias ((path to home folder as string) & "Library:TeXShop:Scripts:TSLib.scpt")
set TSLib to (load script TSLibAlias)

tell application "BBEdit"
	save active document of text window 1
	set texFile to file of active document of text window 1
	set FILEPATH to (POSIX path of texFile) as string
end tell
tell TSLib to set {pdir, shortname, displayname} to docName(FILEPATH)
set pdfname to shortname & ".pdf"

tell application "TeXShop"
	try
		close window (pdfname)
	end try
	tell TSLib to opendoc(FILEPATH)
	activate
	delay 1
	latexinteractive document
end tell

Tested with only a few documents.

Michael


More information about the macostex-archives mailing list