Created
July 29, 2011 03:15
-
-
Save milligramme/1113065 to your computer and use it in GitHub Desktop.
eventlistener for indesign, commit after saving
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cd /Applications/Adobe\ InDesign\ CSn/Scripts/Startup\ Scripts