(osX) Applescript to run compile shortcut in TexShop not working while in Sublime Editor

0

I'm trying to write an script so that when I'm in Sublime I can use a keyboard shortcut to get it to:

  1. save in sublime
  2. compile in TeXShop (I'm using it with the external editor setting)
  3. then switch back to Sublime.

So far I have:

on run {input, parameters}
tell application "Sublime Text"

    activate

end tell

tell application "System Events"

    tell process "Sublime Text"

        click menu item "Save" of menu "File" of menu bar 1

    end tell

end tell

tell application "TeXShop"

    activate

end tell


tell application "System Events"

    tell process "TeXShop"

        click menu item "Typeset" of menu "Typeset" of menu bar 1

    end tell

end tell

tell application "Sublime Text"

    activate

end tell

return input
end run

Which works fine in Automator/TeXShop. But it doesn't work when I'm in Sublime Text Editor. I've tried a whole host of keyboard shortcuts and currently have it as 'Command' + '~'

**bonus: It'd be really cool if it only switches back to Sublime when it's finished compiling. But I have no idea how to do that.

Any help would be greatly appreciated.

m4p85r

Posted 2014-09-22T01:36:43.440

Reputation: 125

Answers

1

When I asked this I didn't really know what I was doing. Texshop is an editor/viewer for Latex. It is NOT the compiler. It simply uses the compiler.

If someone finds this and wants to use Sublime Text to edit their Latex documents then I suggest the plugin Latex Tools. That link also contains a great guide on how to set it up and recommends a PDF viewer based on what OS you're using. It's the best Latex setup I've found so far.

m4p85r

Posted 2014-09-22T01:36:43.440

Reputation: 125