complicated text import
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / complicated text import
- This topic has 2 replies, 3 voices, and was last updated 5 years, 9 months ago by Loic Aigon.
-
AuthorPosts
-
-
June 24, 2018 at 1:29 pm #104496Christopher MossParticipant
I have a client who has transcribed 1000s of pages of 19th century correspondence in Word and would now like to make a book. The transcriptions often include a response in the margin from the reciever to the sender and these annotations have been tagged in the word doc with a #L. The book then would have a large RH column with the original letter and a small LH column with the annotated response along side – following the placement in the original document as closely as possible.
Of course one could import the entire text to the large RH column and manually cut and paste the annotated section. What we hoped to find is a plug in or script capable of at least populating the two columns correctly to save some of the tedium involved in importing 2000+ annotated letters.
-
June 25, 2018 at 1:16 pm #104515Kai RübsamenMember
Hi Christopher, this is possible with scripting and there is a need of some testing. If you are interested, you can contact me directly at [email protected]
Kai
-
June 26, 2018 at 2:44 pm #104548Loic AigonMember
This might help given that you set the margins of the main thread and also set a specific object style (I like to report everything as possible on native and editable features) ;)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var main = function() {
var doc = app.properties.activeDocument, sel, docFile, m = $.os[0]==”M”,
mf = function ( f ) {return (f instanceof Folder)||/\.docx?$/i.test(f.name)},
wf = “Word files : *.doc, *.docx;”, filter = m? mf : wf;if ( !doc ) {
alert(“You need an open document” );
return;
}if ( app.selection.length!=1 || !(app.selection[0] instanceof InsertionPoint) ) {
alert(“Please select some insertionPoint and try again”);
return;
}docFile = File.openDialog(“Please open Word file…”, filter);
if ( !docFile ) return;sel = app.selection[0];
sel.place ( docFile );anchorAnswers ( doc );
}
function anchorAnswers ( doc ) {
var fgp = app.findGrepPreferences.properties,
cgp = app.changeGrepPreferences.properties,
n = 0, found = [], nText, ip, anchored;app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.properties = {
findWhat:”#L.+\\r”,
}found = doc.findGrep();
n = found.length;
while ( n– ) {
nText = found[n];
ip = nText.insertionPoints[0];
anchored = ip.textFrames.add({geometricBounds:[0,0,60,60]});
nText.move ( LocationOptions.AT_BEGINNING, anchored.parentStory.insertionPoints[0] );
anchored.appliedObjectStyle = getObjectStyle (doc, “anchored” );
}app.findGrepPreferences.properties = fgp;
app.changeGrepPreferences.properties = cgp;
}function getObjectStyle (doc, styleName ) {
var st = doc.objectStyles.itemByName ( styleName );
!st.isValid && st = doc.objectStyles.add ({name:styleName});
return st;
}var u;
app.doScript ( “main()”,u,u,UndoModes.ENTIRE_SCRIPT, “The Script” );
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-
AuthorPosts
- You must be logged in to reply to this topic.