iTeXMac AppleScript Support

AppleScript is implemented in iTeXMac in two flavours.

Text:
iTeXMac benefits from Apple Application Kit and naturally supports both text suites and standard suites.

Projects:
iTeXMac adds a typesetting suite named iTeXMac. You access this suite from the script editor opening a dictionary. Besides basic declarations to enables the Apple suites, iTeXMac suite declares 5 commands, each one with an absolute file name argument: typeset, compile, bibtex, makeindex, render. You can run a script like

tell application "iTeXMac"
typeset file front document of application "TextEdit"
end tell

Then iTeXMac launches, opens the file for reading, determines the typesetting context and the project to be used, and finally typeset. In future release, the typesetting script syntax will be extanded, including format specification and standard arguments.

It might be interesting to combine the use of AppleScript and header compile directives described in Typesetting control from the source

In the current implementation, all the 5 typesetting commands are asynchronous. It means that the launching script will end likely before the typeset will end. So you cannot make complex script calling typeset commands many times because each one kills the preceeding. To write complex typesetting processes, use customized projects instead.