Repeat script InDesign

New Here ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

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 ?

TOPICS
Scripting

Views

136

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

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

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

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
}

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

You can only edit answers, but it’s not a problem I misread posts all the time

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

No no, this is also useful, i didn't even think of something like this 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

Ok. For pages within the active document it would be:

 

var p = app.documents[0].pages
for (var i = 0; i < p.length; i++){
    $.writeln("add cut mark to this page: " + p[i].documentOffset)
    //Add Code
}; 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 09, 2022 Feb 09, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 12, 2022 Feb 12, 2022

Copy link to clipboard

Copied

LATEST

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines