Copy link to clipboard
Copied
Hello all,
Newie here. I browsed through the different forums and assembled a simple script to set up the column and gutter on an indesign page, It's not this simple, it will be expanded later.
var doc = app.activeDocument;
var page = doc.pages.item(0);
page.marginPreferences.properties = {
columnCount: 12,
columnGutter: 0
};
it works when run via Indesign script menu on the active document. I would like it so that it runs on all open documents. I googled far and wide, and found some sample, but i could not make it work, either syntax errors, var undefined, etc.
I tried the suggestion from how to apply my script to all opened files?, it didn't work.
It didn't work for me.
while (documents.length > 0) {
var doc = app.activeDocument;
var page = doc.pages.item(0);
page.marginPreferences.properties = {
columnCount: 12,
columnGutter: 0
}
app.activeDocument.close()
}
I tried copying from another script that Mr. Kuhrel helped me with prior, it still runs but only on the active window.
The variables are not correct, that much i can tell but i don't know how to fix it.
for (var i = app.documents.length-1; i >= 0; i--) {
var doc = app.activeDocument;
var page = doc.pages.item(0);
page.marginPreferences.properties = {
columnCount: 3,
columnGutter: 0
}
}
Is there a universal wrapper that can be used to //insert codes here — to run on all open documents in indesign?
Regards and have a great weekend.
Hi,
Closing doc while script run and keep relation for its execution on current DOM status can lead you into false result.
I suggest to use Peter Kahrel way with one modification:
Jarek
Copy link to clipboard
Copied
In your second javascript example, change the top line:
while (documents.length > 0) {
to the following:
while (app.documents.length > 0) {
Otherwise, there are other ways to run a script (or lots of scripts) to many documents. Check out this thread here:
How to take an existing script and apply it to multiple documents
Copy link to clipboard
Copied
Hello,
i have nearly the same issue, i want to save all opened pdf documents.. It is only saving one document to the path, can you help me please?
while (app.documents.length > 0) {
this.saveAs("D:/Users/TestUser/Desktop/" + this.documentFileName);
app.activeDocument.close()
}
Copy link to clipboard
Copied
Hi,
Closing doc while script run and keep relation for its execution on current DOM status can lead you into false result.
I suggest to use Peter Kahrel way with one modification:
Jarek
Copy link to clipboard
Copied
Hello,
i have nearly the same issue, i want to save all opened pdf documents.. It is only saving one document to the path, can you help me please?
while (app.documents.length > 0) {
this.saveAs("D:/Users/TestUser/Desktop/" + this.documentFileName);
app.activeDocument.close()
}
I think i know my fault.. "this" only saves one doc in my case, maybe the solution is an array? I really dont know how to code this, im new in adobe scripting
Copy link to clipboard
Copied
i want to save all opened pdf documents.
You can’t open a PDF into InDesign (you can only Place PDFs), so maybe you are looking for an Acrobat script?
For InDesign files you don’t need a file path unless they are new documents, so this would work for existing doc:
while (app.documents.length > 0) {
app.activeDocument.save()
app.activeDocument.close()
}
If you wanted a save as to a specified folder then:
var fld = Folder.desktop
while (app.documents.length > 0) {
app.activeDocument.save(File(fld + "/" +app.activeDocument.name))
app.activeDocument.close()
}
Copy link to clipboard
Copied
Hello, thanks for your help but this didnt worked for me.
Yes i am looking for a script in adobe acrobat pro dc.
For example: i am opening 10 pdf files from SAP (only opened, it isnt saved local!) and after that i want to save all of them with one action (a script) on a specific folder. i dont want to save them one by one, it takes too much time.
is this possible?
I am using the Java Script debugger in acrobat.
Your Code gave me syntax error, see below (attachement)
Copy link to clipboard
Copied
Try the Acrobat forum.
https://community.adobe.com/t5/acrobat/bd-p/acrobat?page=1&sort=latest_replies&filter=all
Copy link to clipboard
Copied
Sorry for the later reply, this is exactly what I needed. Thank you both!!