How to merge IDML documents/How to rename IDML based on found value in Stori
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / How to merge IDML documents/How to rename IDML based on found value in Stori
- This topic has 9 replies, 4 voices, and was last updated 7 years, 2 months ago by Loic Aigon.
-
AuthorPosts
-
-
December 28, 2016 at 8:47 am #90797Justin SlighMember
I use a web-based database that exports single page documents as separate unnamed IDML file.
Im looking into how to create a script/droplet that can:
1. merge multiple IDML files
2. save as INDDelse
1. For each IDML, find value of <Content> where the AppliedCharacterStyle of <CharacterStyleRange> is “CharacterStyle/Project Title”
2. Rename the IDML with that value -
December 28, 2016 at 2:36 pm #90810Kai RübsamenMember
Both seems to be possible, but need a bit more information and surely testing. If you are interested in a paid script, you can mail me at [email protected]
Kai
-
January 3, 2017 at 3:23 am #90900Loic AigonMember
FWIW, I have been interested long time in the idea of merging idml files without getting really further from the idea. However when I confronted my project to other dev fellows, the general consensus was that it was a deadend, mostly for IDs issues.
So I guess the only “true” way of merging indesign files is actually to open those and relocate pages. As for the naming, it’s quite easy to find text which style is applied on.
Unless I am wrong.
Loic -
January 3, 2017 at 3:55 am #90901Kai RübsamenMember
Loic, that’s my understanding too. Since the OP want a named indd, I would open every idml and move the pages from idml2 to idml1 …
Kai
-
January 3, 2017 at 6:14 am #90907Justin SlighMember
I explored an Applescript solution with some minor success. PHP is about the only language I speak. Ill keep exploring.
-
January 5, 2017 at 5:42 am #91014Justin SlighMember
I have a working Applescript but was unable to post to the forum.
-
January 5, 2017 at 10:28 am #91023David BlatnerKeymaster
Sorry, Justin. Not sure why that got caught up. I’ve published it now.
-
-
January 5, 2017 at 10:28 am #91012Justin SlighMember
Here is the Droplet i came up with. To add error correction and flexibility, I may add the following:
1. Check to see if output filename provided is already used in the output folder.
2. Get the CombinedDocument’s preferences from the first file. (it is hard coded into mine but it might not matter as mine deletes the first (blank) page.
3. Provide support for filtering filetypes
4. Provide support for dropping folders (getting the first tier results of the contents)
5. Provide a dialog that indicates broken links or overset text in the combined document on completionon run {input, parameters}
--Choose Output Folder
tell application "Finder"
set OutputFolder to choose folder with prompt "Select a folder for output"
set myFilelist to input
set myFileCount to count of myFilelist
end tell
log myFileCount
if myFileCount > 0 then
--Get output filename
display dialog "Please provide the name for the combined file" default answer ""
set SaveNameInput to text returned of result
set SaveName to SaveNameInput & ".indd"
--Need to add check if filename already exists
tell application "Adobe InDesign CC 2017"
activate
set user interaction level of script preferences to never interact
tell view preferences
set horizontal measurement units to inches
set vertical measurement units to inches
end tell
--setup combined document
set myCombinedDoc to make document
tell document preferences of myCombinedDoc
set page height to "8.5"
set page width to "11"
set page orientation to landscape
set pages per document to 1
set facing pages to false
set allow page shuffle to false
end tell
repeat with i from 1 to myFileCount
open (item i of myFilelist)
delay 10
set myCurrentFile to the active document
tell myCurrentFile
set DocName to name
log DocName
duplicate every spread of myCurrentFile to after last spread of myCombinedDoc
close saving no
end tell
end repeat
tell myCombinedDoc
set SavePath to (OutputFolder as string) & SaveName
log SavePath
delete page 1
save to SavePath
close saving no
end tell
set user interaction level of script preferences to interact with all
beep 3
display alert "Complete" giving up after 3
end tell
else
display dialog "No IDML files to process" giving up after 3
end if
return input
end run
-
January 29, 2017 at 2:16 pm #91686Justin SlighMember
I have a functioning solution in PHP. This one will query a database and replace placeholders within IDML templates. It also combines multiple IDML files. I may publish when I have added error handling.
Placeholders are wrapped in percent signs. %PlaceholderName%
1. For each result in the database query, PHP class unzips the selected template to a work folder with a unique name.
2. The Story_XXX.xml files that include placeholder names are selected.
3. Find/Replace is performed on the array of placeholders and the database results.
4. Once all of the placeholders have been handled, the story and spread Ids are made unique. This includes the filename and references within spreads. An array keeps track of these changes.
5. The first template folder is designated the combined workspace. All of the other template stories and spreads are dumped into the appropriate holders.
6. The combined workspace’s designmap.xml is opened as a DOMDocument and the new spreads and stories are added.
7. The combined document is zipped (The mimetype from the template is incorporated.) -
January 30, 2017 at 2:45 am #91697Loic AigonMember
Nice.
-
-
AuthorPosts
- You must be logged in to reply to this topic.