Making using TypeScript for Google Apps Scripts more convenient on OS X

There are a couple of issues with using TypeScript for this: The first is that Google Apps Script doesn’t directly support TypeScript, and the second is that the Apps Scripts editor is web based.

The first issue isn’t really an issue, since the TypeScript is transpiled directly into JavaScript. But the second one is an issue. It would be painful to have to open the generated JavaScript in IntelliJ, copy it into the clipboard, activate the web-based editor, select the old content, paste the new content from the clipboard, and save it, every time I make a change to the TypeScript.

Fortunately I’ve found a simple way to automate all of this using AppleScript.

Firstly, I ensure that the Apps Script editor is open in its own window. My project is called “Documote” and this is what the Google Chrome window looks like:

Secondly I’ve created this AppleScript file to copy the generated JavaScript to that project: