[OS X TeX] Open related... macro

Martin Costabel costabel at wanadoo.fr
Sat Feb 14 16:37:44 CET 2009


Peter Dyballa wrote:
> 
> 
> Am 14.02.2009 um 12:11 schrieb Josep Maria Font:
> 
>> it's beyond my knowledge to understand how to adapt it for the Open 
>> related... macro.
> 
> 
> Maybe it's just a minor problem: even when you tell your system "TeXShop 
> is responsible for extensions a, b, c" TeXShop has its own idea of 
> responsibility. Maybe you just need to add to TeXShop's responsibility via
> 
>     defaults write TeXShop OtherTeXExtensions -array-add toc bbl
> 
> (as with asymptote files) these two file types ... (to remove: defaults 
> write TeXShop OtherTeXExtensions -array)

In the case at hand, the culprit is not TeXShop, but it is Finder (or 
its AppleScript interface) who decides rather arbitrarily which file 
name extensions it sees as file name extensions. Try the following (in a 
command window, 2 lines):

touch foo.tex foo.bbl
osascript -e 'tell app "Finder" to name extension of (choose file)'

This opens a file chooser window, and when you select foo.tex, the 
script dutifully prints "tex", but when you select foo.bbl, it prints an 
empty line.

Thus bbl (and I guess the other extensions Josep is trying) is not 
recognized by Finder as a file name extension. This seems to be a 
Leopard "feature", on Tiger it prints "bbl" for foo.bbl.

I don't know where Finder gets the list of recognized extensions from, 
but for the "Open" script, you shouldn't rely on Finder's idea of file 
name extensions. You would need to use some shell script with Unix 
commands like 'cut' or 'awk', such as for the variable "actualextension" 
in Peter's example.

--
Martin





More information about the macostex-archives mailing list