Skip to main content
Participant
February 9, 2022
Question

Repeat script InDesign

  • February 9, 2022
  • 4 replies
  • 673 views

Hi all i have a script in InDesign that adds a cut line to my document, currently it runs on the active page then stops meaning i have to go to the next page manually and run the script again

 

i need a scrtipt or a code that will run a script move to the next page and run the script again how do i do that ?

This topic has been closed for replies.

4 replies

Sunil Yadav
Legend
February 12, 2022

I think this should work for you:

var myDoc = app.documents[0];
for(var i = 0; i < myDoc.pages.length; i++){
    myDoc.pages[i].select();
    app.doScript(File("Your script file path goes here"))
    }

Best

Sunil

m1b
Community Expert
Community Expert
February 9, 2022

Just wanted to add... sometimes it's good to add the cut-line to a layer on a master page. I don't know in your case but wanted to mention.

- Mark

schlindibus
Inspiring
February 9, 2022

You can do something like this:

var inddFolder = Folder.selectDialog("Select Folders with .indd Files");
	if (inddFolder == null) {
		alert("There was no Folder Selected");
		exit();
	}
IDfileList = inddFolder.getFiles("*.indd");
for (var i = 0; i < IDfileList.length; i++) {
		var myFile = IDfileList[i];
		app.open(myFile);
	}
while (app.documents.length > 0) {
//Post Your code here
}
rob day
Community Expert
Community Expert
February 9, 2022

Hi @schlindibus, I think @James22860505sgaq wants to run the cut line function on each page of the active document, not on different ID docs.

schlindibus
Inspiring
February 9, 2022

@rob day hmm looks like your're right 😕😕 Wanted to answer a question too for once haha 🙂 
Is there a way to delete Answers?

rob day
Community Expert
Community Expert
February 9, 2022

You would have to loop thru the pages within the script. Can you post the code?