[OS X TeX] Re: Collection of Macros for TeXShop and BibDesk

Ramón Figueroa-Centeno ramonf at hawaii.edu
Mon Apr 19 21:59:21 CEST 2010


Aloha,

Nice scripts.

Two things, to make things really robust;

1. Enclose

 if texapp = "TeXShop" then
  tell application "TeXShop" to set section to the content of the selection
of the front document
 else if texapp = "iTeXMac" then
  --tell application "iTeXMac" to set section to (the selection of the text
of the front document)
 end if

in a "try" block, that is

try
	set the front_document to the front document
	if texapp = "TeXShop" then
		tell application "TeXShop" to set section to the content of the selection
of the front document
	else if texapp = "iTeXMac" then
		--tell application "iTeXMac" to set section to (the selection of the text
of the front document)
	end if
on error
	beep
	return
end try

That way we deal with the case when there is no front document.

2. If lines (paragraphs to use the TeXShop applescript dictionary term) are
very long, which can happen if you use soft wrap, then when you pass them to
"do shell script" things won't work (there is a limit to how much data it
can take). So I usually dump things to a tmp file and pass that to the
shell. In your case it may not matter as lines with for sections are usually
short, but who knows what weird things your users will do :)

Anyway, great work, I learned some tricks from it.

Mahalo,

Ramón


-- 
View this message in context: http://n2.nabble.com/Collection-of-Macros-for-TeXShop-and-BibDesk-tp4921970p4927586.html
Sent from the MacOSX-TeX mailing list archive at Nabble.com.



More information about the macostex-archives mailing list