[OS X TeX] Problem applescripting TeXShop

Jan Anderssen jan at linguist.umass.edu
Sat Apr 5 02:31:47 EDT 2008


On Apr 4, 2008, at 10:13 PM, Chris Goedde wrote:

> I'm having a problem getting the result I want with applescript and
> TeXShop and I need some help. I'm trying to write a script to open a
> pdf file in TeXShop and have it be frontmost. What I have right now is
> (assuming that test.pdf is on my desktop):
>
> tell application "TeXShop"
>
>    open POSIX file "/Users/goedde/Desktop/test.pdf"
>    activate
>    set index of window "test.pdf" to 1
>
> end tell
>
> This works with two big exceptions:
>
> (1) The resulting window doesn't have a toolbar, just a title bar.
> (2) The window is frontmost but not active.

The window has a toolbar for me. Maybe you closed the toolbar once and  
TeXShop remembers? (TeXShop 2.14 and 10.5.2 as well)


As for the second problem, I thought something like the following  
might help, but it crashes TeXShop reliably, once there's more than  
one open window:

tell application "System Events"
	tell process "TeXShop"
		tell menu bar 1
			tell menu bar item "Window"
				tell menu "Window"
					click menu item "test.pdf"
				end tell
			end tell
		end tell
	end tell
end tell


It's copied straight from this: http://www.apple.com/applescript/uiscripting/02.html 
  - not sure why it doesn't work, maybe not supported by TeXShop?

Jan




More information about the MacOSX-TeX mailing list