Copy link to clipboard
Copied
Hi All,
This below coding is open indesign file and flow word file then save as in the same name. But now I need to add "_Flowed" with the before .indd extension. See 16th line. But if I run this coding result is e.g. Indesign.indd_Flowed. Please advice.
See my coding
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
var myIndFile = File.openDialog ("Select Indesign File");
var myWordFile = File.openDialog ("Select Word File");
app.open (myIndFile);
var mydoc = app.activeDocument;
mydoc.textPreferences.smartTextReflow = true;
mydoc.textPreferences.limitToMasterTextFrames = false;
mydoc.textPreferences.deleteEmptyPages = false;
mydoc.textPreferences.addPages = AddPageOptions.endOfStory;
mydoc.pages.item(0).textFrames.item(0).place(File(myWordFile));
app.activeDocument.save(new File(myIndFile + "_Flowed"));
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;//This coding is not skipping of dialog boxes etc.
Regards,
Vetha
Replace the 16th line with the below code:
app.activeDocument.save(new File(myIndFile.path + "/" + myIndFile.name.replace(".indd", "") + "_Flowed.indd"));
Vandy
Copy link to clipboard
Copied
Replace the 16th line with the below code:
app.activeDocument.save(new File(myIndFile.path + "/" + myIndFile.name.replace(".indd", "") + "_Flowed.indd"));
Vandy
Copy link to clipboard
Copied
Superb vandy
Copy link to clipboard
Copied
Hi Vetha,
I’ve no idea, if this is good practice, but for me this works too:
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
var myDoc = app.open( File.openDialog( "Select InDesign File" ) );
myDoc.properties = { textPreferences: { smartTextReflow: true, limitToMasterTextFrames: false, deleteEmptyPages: false, addPages: AddPageOptions.endOfStory } };
myDoc.textFrames[0].place(File.openDialog ( "Select Word File" ));
myDoc.save ( new File ( myDoc.fullName.toString().slice(0, -5) + "_Flowed.indd" ));
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
Notice, that you get an error with your and my version, if you click cancel in the dialogs. That should be checked too.
Notice also, that smart text reflow will not work, if the textfame on page 1 is not a primary textframe or a master text frame (in older version).
If there exists better solutions, it would be great, if the advanced scripters share them with us.
–Kai
Copy link to clipboard
Copied
Hi Vandy,
One more information I need, I don't want to save the existing file just I need to flow and SAVE AS with "existing file name_flowed.indd". Is this possible?
Regards,
Vetha
Copy link to clipboard
Copied
Hi Vetha,
The solution which I mentioned earlier wont replace your old indesign file, it will flow the word file and save it as different indesign file (i.e., file name_flowed.indd")
Try it again!
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
var myIndFile = File.openDialog ("Select Indesign File");
var myWordFile = File.openDialog ("Select Word File");
app.open (myIndFile);
var mydoc = app.activeDocument;
mydoc.textPreferences.smartTextReflow = true;
mydoc.textPreferences.limitToMasterTextFrames = false;
mydoc.textPreferences.deleteEmptyPages = false;
mydoc.textPreferences.addPages = AddPageOptions.endOfStory;
mydoc.pages.item(0).textFrames.item(0).place(File(myWordFile));
app.activeDocument.save(new File(myIndFile.path + "/" + myIndFile.name.replace(".indd", "") + "_Flowed.indd"));
Vandy
Copy link to clipboard
Copied
Hi Vandy,
Sorry for late reply. First of all Thanks for your reply.
Your coding working fine, Actually my working process is, I have created one indesign file like as template, but now the above coding is working first to save the indesign file and save as a copy.
I no need to save the existing indesign file. Just flow and save as another name. The original file treated as template.
Regards,
Vetha
Find more inspiration, events, and resources on the new Adobe Community
Explore Now