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.

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.