Copy link to clipboard
Copied
#targetengine "session"
var myDocument = app.documents.item(0);
var myStory = myDocument.stories.item(0);
myStory.trackChanges = true;
I placed this script in the Startup Script folder but it gives me an error on line 3. When i have the script in the Normal Script folder and Click on it it works.
Please use the following code and let me know if all is well. I have made some modifications and explained below:
...#targetengine session
var myEventListener = app.eventListeners.item("TurnTCon");
if (!myEventListener.isValid) {
myEventListener = app.addEventListener("afterOpen", doJob1 );
myEventListener.name = "TurnTCon";
}
function doJob(event) {
try{
if(event.parent.constructor.name == "Document") {
var myDocument = event.parent;
if(myDocument
Copy link to clipboard
Copied
You'll need an event listening mechanism to check, if a document is opened and react on that.
You have to realise, that a script in the startup scripts folder is executed immediately when starting InDesign.
At exactly this point in time no document is open. So your code will return an error.
Even if you launch InDesign by double-clicking a document.
Btw. You are asking this in the wrong forum, I think.
A moderator should move this question over to InDesign Scripting
Regards,
Uwe
Copy link to clipboard
Copied
Sorry i thought i was in the scripting Forum
Copy link to clipboard
Copied
yes, need to changed doJob1 to doJob.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now