Copy link to clipboard
Copied
Hi all! - got a little scenario I need help solving, hoping some of you clever minds can help me!
I have a bundle of files that will be delivered to me each week, these will be varying in page count from:
34, 36, 38 & 40 pages (possibly more havent been told yet).
I need these split into seperate folders based on the page count... Ideally I don't want to be doing this manually, opening each oneindividually, checking page count, then dragging over to a folder...
I have an action set up for these already as pages need rotating, flattening ect, so my ideal outcome is to have some javascript that will execute as part of this workflow inside this action. It would count the pages, and move to a folder located on my mac.
Not sure if this is possible, couldn't find much online! Thanks for the help in advanced!
Copy link to clipboard
Copied
Sorry, I forgot the quotes (now corrected). It should be:
this.saveAs("/Volumes/ClientFolder/Client1/TestFolder/" +"Page_"+ this.numPages+ "/"+this.documentFileName);
Copy link to clipboard
Copied
In this example, assume your folders are named Pages_34, Pages_36, etc. In your action add "Execute JavaScript" as the last command then add the following script:
this.saveAs("/*this is the file path to your folder including the last slash*/ " + "Page_" + this.numPages + "/" + this.documentFileName);
If you're folders aren't consistently name and/or don't have the number of pages in the name you will have to create an if statement like this:
var fldrName;
if(this.numPages==36)
{fldrName="The first folder"} else
if(this.numPages==38)
{fldrName="The second folder"} else...etc.
Then pass the variable into the saveAs cPath parameter. I'm not a Mac user but I believe the file paths us backslashes. Open a PDF in one of the folders and run the following script in the console to see the path structure then escape backslashes in your script if the paths contain them:
this.path
Copy link to clipboard
Copied
 Thanks for the response! I have added this to the Execute Javascript function, its not allowing me to click ok - says there is a syntax error - am I missing something?
Sorry 0 knowledge of code here...
Appreciate the help!
Copy link to clipboard
Copied
Sorry, I forgot the quotes (now corrected). It should be:
this.saveAs("/Volumes/ClientFolder/Client1/TestFolder/" +"Page_"+ this.numPages+ "/"+this.documentFileName);
Copy link to clipboard
Copied
This is perfect thank you so much, you have just saved me a bunch of time! I take it if a file has more pages and there is no folder setup, it will just skip this file?
Copy link to clipboard
Copied
You can do this:
try{this.saveAs("/Volumes/ClientFolder/Client1/TestFolder/" +"Page_"+ this.numPages+ "/"+this.documentFileName);}catch(e){console.println(this.documentFileName)}
Open the console when the Action is finished and it will show a list of files that weren't saved (if any).
Copy link to clipboard
Copied
Thanks! You have been a lot help, really appreciated!