Page 1 of 2
How to duplicate a PDF document
Posted: Thu Jan 20, 2011 1:22 pm
by scorpio_33
Is there any way to duplicate the entire PDF document? I need to perform n copies of the information stored in the document name. For example:
name_n.pdf
where:
name - the name of the file
n - number of copies
Does anyone have such a flow can either give me a hint how to do it?
How to duplicate a PDF document
Posted: Thu Jan 20, 2011 10:30 pm
by gfloro
I think this would have to be accomplished through a script.
How to duplicate a PDF document
Posted: Thu Jan 20, 2011 11:18 pm
by scorpio_33
I know but how?
How to duplicate a PDF document
Posted: Fri Jan 21, 2011 4:49 pm
by gfloro
If you don't need to use Switch, you could create an Automator Workflow or an AppleScript to run the Finder's Duplicate command on the file n number of times.
Example AppleScript:
display dialog "How many times do you want the duplicator to run?" buttons {"Cancel", "OK"} default button "OK" default answer ""
set the_loops to text returned of the result as number
tell application "Finder"
repeat the_loops times
duplicate selection
end repeat
end tell
The problem with that though is [1] it requires user input, how many times to duplicate the file and [2] the file name has the word "copy" added.
I am by no stretch of the imagination a "scripter", but a JavaScript that you add to your flow would:
1. set a bunch of variables, ie. input file name, input and output directories
2. grab the count value from the file name and assign to a variable
3. run loop statement to:
- copy the original file to a output directory, rename it
- repeat until it reaches the count value
Simple
Hopefully that's somewhat helpful.
How to duplicate a PDF document
Posted: Fri Jan 21, 2011 6:36 pm
by dkelly
Hello, I created a Script Element that implements a file duplicate function. There's a single property for the number of copies to create.
download FileDup script
Enjoy,
Dwight Kelly
Apago, Inc.
How to duplicate a PDF document
Posted: Fri Jan 21, 2011 6:52 pm
by scorpio_33
Many, many thanks for all. Thank You.
How to duplicate a PDF document
Posted: Sat Jan 22, 2011 12:22 am
by dkelly
Did you end up using the AppleScript or Switch script solution?
How to duplicate a PDF document
Posted: Sat Jan 22, 2011 7:12 pm
by scorpio_33
Switch script soliution. Thank You for Your help.
How to duplicate a PDF document
Posted: Wed Jan 26, 2011 9:32 pm
by gfloro
Dwight,
Nice solutions, thanks for posting. It's nice to see some real world scripting examples to help learn from.
I was going to try modifying your script, so I can use SwitchClient to set the copies, but was stuck on the syntax for getting the metadata from the jobs internal job ticket. Can you offer suggestions?
Gregory
How to duplicate a PDF document
Posted: Thu Jan 27, 2011 4:05 pm
by diwu
Hi Gregory,
You got stuck on getting the metadata from the job. Does this mean you were able to change the script and add a property editor "single-line text with variable" for the copies property?
If you modified the script like this you should be able now to use metadata from SwitchClient.
When you use the updated script in PowerSwitch make sure you have a sample job somewhere in your flow.
I suggest you submit a file via Client with the number of copies as metadata and put a connection on hold somewhere before the duplicate script.
Stop the flow, go to the duplicate script and set the copies property to define single-line text with variable. Choose metadata - text - build location path. Select the external dataset (by default this should be "Submit") and browse the data tree to set the location path for the number of copies you entered in Client.
That should do.
I also created this sample flow
kr,
Dieter
How to duplicate a PDF document
Posted: Thu Jan 27, 2011 8:42 pm
by gfloro
Dieter,
I haven't actually modified Dwight's script as yet. I was going through the documentation looking for what I would need to add to the script to get this working with Client. I'll try your advice and test flow and report back.
Thanks.
Gregory
How to duplicate a PDF document
Posted: Fri Jan 28, 2011 8:51 pm
by gfloro
Dieter,
I followed your instructions, modified Dwight's script and my Flow and got it working. I learned something new.
Cheers,
Gregory
How to duplicate a PDF document
Posted: Sun Jan 30, 2011 2:48 pm
by scorpio_33
Hello again
How can I modify the script to duplicated files have been uploaded to a folder, named like duplicated file? In next step I would like to combine pdf files but to do so they must be in a folder not than separately.
How to duplicate a PDF document
Posted: Sun Feb 06, 2011 2:27 pm
by gfloro
Use the SwitchScripter application to modify the script. Try using the "Assemble Job" connector to gather the PDFs to send to Acrobat. Then use the merge option for Acrobat.
How to duplicate a PDF document
Posted: Tue Feb 08, 2011 4:11 pm
by dkelly
diwu wrote: Hi Gregory,
Does this mean you were able to change the script and add a property editor "single-line text with variable" for the copies property?
Hi, my original script has a property for the number of copies. Why do you state that another needs to be added?