Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Repeat script InDesign

New Here ,
Feb 09, 2022 Feb 09, 2022

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
723
Translate
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
Community Expert ,
Feb 09, 2022 Feb 09, 2022

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

 

Translate
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

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
}
Translate
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
Community Expert ,
Feb 09, 2022 Feb 09, 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.

Translate
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

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

Translate
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
Community Expert ,
Feb 09, 2022 Feb 09, 2022

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

Translate
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

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

 

Translate
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
Community Expert ,
Feb 09, 2022 Feb 09, 2022

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
}; 
Translate
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
Community Expert ,
Feb 09, 2022 Feb 09, 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

Translate
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
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

Translate
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