Skip to content

Instantly share code, notes, and snippets.

@milligramme
Created July 29, 2011 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milligramme/1113065 to your computer and use it in GitHub Desktop.
Save milligramme/1113065 to your computer and use it in GitHub Desktop.
eventlistener for indesign, commit after saving
#targetengine "session"
main();
function main(){
var af_save = app.addEventListener("afterSave", git_indd, false);
}
function git_indd (myEvent){
var doc = myEvent.parent;
if (has_fullpath (doc)) {
var cd_path = doc.fullName.parent;
var receipt = "do shell script \"cd " + cd_path + "; git init; git add .; git commit -m 'update'\"";
app.doScript(receipt, ScriptLanguage.APPLESCRIPT_LANGUAGE);
};
}
/**
* is document saved at least once?
*/
function has_fullpath (doc) {
return doc.properties['fullName'] !== undefined
}
@milligramme
Copy link
Author

cd /Applications/Adobe\ InDesign\ CSn/Scripts/Startup\ Scripts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment