[OS X TeX] applescripts for TeXShop and iTeXMac?

Matthew Hills hills_tex at tina.stanford.edu
Fri Aug 27 15:13:52 EDT 2004

Any advice on writing scripts that will run on both TeXShop and iTeXMac?

While I can write a script that can run from both environments, there 
is an unfortunate tendancy for the both applications to be opened when 
the scripts are compiled (presumably to access the relevant 

my general approach is:

>   set current_app to ....  (figure out which app is launching the 
> script)
>   if current_app is "TeXShop" then
>          tell application "TeXShop"
>               ....
>          end tell
>   end if
>   if current_app is "iTeXMac" then
>          tell application "iTeXMac"
>               ....
>          end tell
>   end if

I'm thinking that there should be some way to get around this by using 
the raw forms:
>     if current_app = "TeXShop" then
>         tell application current_app
>             set search_pattern to the «class CONT» of the «class SELE» 
> of the front document
>             ...

Unfortunately, I'm having trouble getting this to work when compiled 
from TeXShop.  (works fine when run from the Scrip Editor).

Has anyone else found a happy way to do these things?  (basically I 
just need to get the
current selected text and potentially replace it with some new text)


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