I'm trying to write an script so that when I'm in Sublime I can use a keyboard shortcut to get it to:
- save in sublime
- compile in TeXShop (I'm using it with the external editor setting)
- 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.