Forum Replies Created
-
AuthorPosts
-
Masood Ahmad
ParticipantHi Paul.
Try this:
#target indesign
app.menuActions.item("$ID/Add All Unnamed Colors").invoke();
var myIndesignDoc = app.activeDocument;
var myUnusedSwatches = myIndesignDoc.unusedSwatches;
for (var s = myUnusedSwatches.length-1; s >= 0; s--) {
var mySwatch = myIndesignDoc.unusedSwatches[s];
var name = mySwatch.name;
if (name != ""){
mySwatch.remove();
}
}
app.activeDocument.colors.everyItem().properties = {space:ColorSpace.CMYK, model:ColorModel.PROCESS};
I call this script: “Swatches_Add-UnNamed_Delete-Unused_Convert-2-CMYK-Process.jsx”
Masood Ahmad
ParticipantHi Qing, Hi Robert,
First, please accept my sincere apologies for not responding to your replies. I got stuck somewhere and couldn’t got the time to test these additions.
My initial requirement was to fit all the inline images in the story in the selected text frame. I tested both the scripts given by you (Qing and Robert) and they worked well.
Qing’s script was fixing all the inline images of the selected text frame but not in the whole story. I didn’t realized that Robert’s script was in fact fixing all the inline images in the whole story of the selected text frame. Secondly, to center align the inline images was an optional thought, which I fixed by updating the para style for the inline images.
Qing, your changes to the script worked the way I wanted:
var allRtg = myObject.parentStory.rectangles.everyItem().getElements();
This helps me fix all the inline images within the story.Robert, your first script as I said worked well. The new updated code gives me a new thought as the new code was fixing all the inline images within the document. So I have saved this as a separate script for future requirements.
I must say, that now I have three scripts:
1) Fix all inline images within a Document.
2) Fix all inline images within a Story.
3) Fix all inline images within a TextFrame.Thanks a ton to both of you :)
October 11, 2019 at 1:50 am in reply to: Create a table with specific number of row and column with JavaScript #14323944Masood Ahmad
ParticipantNo script is needed for this. Use the InDesign’s default Insert Table command from the menu.
Masood Ahmad
ParticipantAny clues…
Masood Ahmad
ParticipantHi Qing and Robert,
I’m facing an issue while running the script. The text frame containing the text and inline images runs on multiple pages. Every column is a separate text frame, for example, there are 6 text frames for a 6 column layout on every page. So I realized that while selecting only one text frame on the first page, the script make changes only to that particular text frame, whereas the other content remains unchanged. If I select multiple text frame, then it make changes to the contents of all the selected text-frames. As you know we can’t select frames on multiple pages, I’m facing issues. So is there a way, that the script can make changes to the entire story. Or a better way is to select the text using text tool and then run the script.
//DESCRIPTION: Fit Image to Frame for Inline graphics//https://indesignsecrets.com/topic/image-fitting-options-on-anchored-graphic-frames
//Version: 1.0, dated: 2nd October 2019.app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Image Fitting Script");
function main() {
// Capture the current selections in array
var mySelections = app.selection;
for (var i = 0; i < mySelections.length; i++) {
var myObject = mySelections[i];
if (myObject instanceof TextFrame) {
var allRtg = myObject.rectangles.everyItem().getElements();
for (var j = 0; j < allRtg.length; j++) {
var theRtg = allRtg[j];
try {
theRtg.fit(FitOptions.contentToFrame);
theRtg.fit(FitOptions.proportionally);
theRtg.fit(FitOptions.frameToContent);
theRtg.fit(FitOptions.centerContent);
} catch (e) { }
}
}
}
}
Please look into this and help me out. Thanks in advance.
Masood
Masood Ahmad
ParticipantThanks Qing and Robert, both the scripts worked well.
I just noticed that some inline graphic frames got reduced in size and they are now left align as per the Paragraph style. I was thinking of a way to center align all the inline objects.
I tried this:
myObject.Justification.CENTER_ALIGN;
and this:
theRtg.fit(Justification.CENTER_ALIGN);Can you help me out on this as well.
In addition, is it doable with little extra code to assign a para style, let’s say “Inline_Images” to all those inline graphic frames.
September 30, 2019 at 10:21 am in reply to: Apply [Unconditional] condition to Conditional Text #14324012Masood Ahmad
ParticipantThanks Robert, for your quick code. It works like a charm.
Just checking if all the Unused Conditions can be removed by adding some extra code to it.
Masood Ahmad
ParticipantHi Matthew,
Are you looking for this, I just realised that I have a copy of the script is in my discs.
https://www.dropbox.com/s/2u68zmibotqi3k8/GREP_Toggler_EnableOrDisable%20%5B1.4a%5D.jsx?dl=0
Masood Ahmad
ParticipantAway from computer
Try this:Grep Find:
([\u])(o)
Change to:X$1Masood Ahmad
ParticipantTry this…
GREP Find/Change:
Find What:^(Name1:.+\r)(Name1:.+\r)+
Change to:$0\rMasood Ahmad
ParticipantI don’t think this is achievable with GREP, may be some script can do the magic.
Masood Ahmad
ParticipantTry exporting the file as IDML, then open the IDML file and work on that. In case the issue persists, please send a copy of the InDesign file to me to analyze.
masood.designs@gmail.comMasood Ahmad
ParticipantWell there’s a trick to avoid relinking the images to the desktop folder. Just close the InDesign file without saving.
Try it and let me know of other issues you may encounter.
Masood Ahmad
ParticipantYou’re welcome Peter.
January 31, 2019 at 10:01 am in reply to: InDesign 5.5 for Windows and Excel: find a code/price in .xls, replace into Indd #114061Masood Ahmad
ParticipantYes, I should have counted that as well :)
-
AuthorPosts
