[OS X TeX] Applescript changes in TS

Herbert Schulz herbs at wideopenwest.com
Sat Dec 31 07:32:29 EST 2011


On Dec 31, 2011, at 12:37 AM, Michael Sharpe wrote:

> I have a number of applescripts that work correctly from the Applescript Editor but fail with strange error messages when run from the TeXShop Macro Menu with header 
> 
> --Applescript direct
> 
> I tracked down two of the problems that were show-stoppers for me:
> 
> (i) length no longer functions correctly with either strings or lists in the Macro Menu, though it does under Applescript Editor. You need to change all instances of length to count. (This affects several macros distributed with TeXShop.)
> 
> (ii) offset is not functional under the Macro Menu (no problem under AppleScript Editor), and I replaced it in my macros with the function stroffset:
> 
> on stroffset(find_str,whole_str) 
> 	if (count of whole_str)=0 then return 0
> 	if (count of find_str)=0 then return 0
> 	set tid to Applescript's text item delimiters
> 	set Applescript's text item delimiters to {find_str}
> 	set lst to text items of whole_str
> 	set Applescript's text item delimiters to tid
> 	if (count of lst)=1 then
> 		return 0
> 	else
> 		return (count of (item 1 of lst)+1)
> 	end if
> end stroffset
> 
> I'd appreciate any postings of other fixes as it's a tiresome business to track down Applescript errors that occur only in the Macro Menu. A couple of scripts I just fixed are available at
> 
> http://math.ucsd.edu/~msharpe/fontset.dmg
> 
> They may be useful to those who have large collections of fonts and wish to be able to switch a saved set of fonts quickly. (To install, select Macros/Macro Editor, then select Macros/Add Macros from file, selecting each .plist from the dmg as the target.)
> 
> Michael


Howdy,

With every OS upgrade Applescript seems to change or seems to need support in a different way. Thanks for tracking down these problems. I know I had to remove an `on error' selector from once of the macros I use a lot to get it to work under Lion when it was working fine under Snow Leopard.

Thanks also for your macros. I can see good use for them.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the MacOSX-TeX mailing list