Back

If your email is not recognized and you believe it should be, please contact us.

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 77 total)
  • Author
    Posts
  • in reply to: Grep Find/Replace, multiple formatting applied #89249
    Matt Isaac
    Participant

    Just set app.changeGrepPreferences.appliedCharacterStyle = app.activeDocument.characterStyles[0] in the script just after the position line.. If the subscript was applied with a character style you will be able to remove that line as setting the character style to none will take out the subsccript anyway.

    in reply to: Grep Find/Replace, multiple formatting applied #89161
    Matt Isaac
    Participant

    https://helpx.adobe.com/indesign/using/find-change.html also has some useful tips.

    in reply to: Grep Find/Replace, multiple formatting applied #89158
    Matt Isaac
    Participant

    https://creativepro.com/resources/grep would be a good starting point for learning GREP.
    The GREP for ml to mL would be a bit simpler than your kPa find:\<ml\>change to:mL

    here are the expressions broken down to hlep you to understand them:
    (?<=):This piece of grep looks behind for anything after the ‘=’ without selecting it (eg. (?<=f)un will select ‘un’ only if it is after ‘f’).
    (?=)does the same for looking ahead (eg. f(?=un), will only select ‘f’ if it is before ‘un’).
    \< and \> looks for word beginnings and endings respectively. (eg \<fun\> will only find ‘fun’ not ‘funny’ or ‘funds’)

    in reply to: Grep Find/Replace, multiple formatting applied #89150
    Matt Isaac
    Participant

    I’m pretty sure this can only be done with two grep expressions first to change the K: (?<=\<p)K(?=a\>) second to change the a: (?<=\<pK)a\>
    These can be combined into a single shortcut command if applied via script such as:
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "(?<=<p)K(?=a>)";
    app.changeGrepPreferences.fontStyle = "Italic";
    app.changeGrep();

    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "(?<=<pK)a>";
    app.changeGrepPreferences.position = Position.NORMAL;
    app.changeGrep();

    for information on installing and using the script see: https://creativepro.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-post.php

    in reply to: Change page number style depending on page #89087
    Matt Isaac
    Participant

    I’m guessing when you copy/pasted the code you didn’t include the last ‘}’ add that to the end of the script.. also line 8, the line starting with app.doScript, I would change “Add page numbers in reverse” to just “Add page numbers” I copied the doScript function from a previous script i had written and forgot to edit that part.

    in reply to: Change page number style depending on page #89048
    Matt Isaac
    Participant

    The only way i know of to do this is with scripting. There may or may not be a way using InDesign’s built-in features. create a paragraph style with the styling the way you want all the numbers to appear and name that style “Page Numbering”, then create a character style the way you want the current page number to be formatted and name this style “Current Page” and run this script:

    
    /*
    Scripted by Skemicle
    1:00 PM 10/17/2016
    */
    if (parseFloat(app.version) < 6)
    main();
    else
    app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Add page numbers in reverse");
    function main() {
    	doc = app.activeDocument;
    	prefs = doc.viewPreferences;
    	hmu = prefs.horizontalMeasurementUnits;
    	vmu = prefs.verticalMeasurementUnits;
    	prefs.horizontalMeasurementUnits = MeasurementUnits.INCHES;
    	prefs.verticalMeasurementUnits = MeasurementUnits.INCHES;
    	var ro = doc.viewPreferences.rulerOrigin;
    	doc.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
    	page = doc.pages;
    	pages = [];
    	userlayer = doc.activeLayer;
    	try{
    		doc.layers.itemByName("Page Numbering").remove()
    	}catch(er){};
    	doc.layers.add({name:"Page Numbering"});
    	pageHeight = doc.documentPreferences.pageHeight;
    	pageWidth = doc.documentPreferences.pageWidth;
    	leftMargin = doc.marginPreferences.left;
    	rightMargin = pageWidth - doc.marginPreferences.right;
    	bottomMargin = pageHeight - doc.marginPreferences.bottom;
    	for(c=0;c<page.length;c++){
    		pages[c] = c + 1
    	}pageNumbers = pages.join(" ");
    	for(c=0;c<page.length;c++){
    		numbersFrame = page[c].textFrames.add({contents:pageNumbers, geometricBounds:[bottomMargin,leftMargin,bottomMargin + .25,rightMargin]});
    		numbersFrame.insertionPoints[0].appliedParagraphStyle = "Page Numbering";
    		word = numbersFrame.words
    		for(n=0;n<word.length;n++){
    			if(word[n].contents == c + 1){
    				word[n].appliedCharacterStyle = "Current Page";
    			}
    		}
    	}
    	doc.layers.itemByName("Page Numbering").locked = true;
    	app.activeDocument.activeLayer = userlayer;
    	doc.viewPreferences.rulerOrigin = ro;
    	prefs.horizontalMeasurementUnits = hmu;
    	prefs.verticalMeasurementUnits = vmu;
    }
    

    For information on installing and using this script see: https://creativepro.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-post.php

    in reply to: Merged Text Frame #88878
    Matt Isaac
    Participant

    I assume this is what you want:
    for(var n=0;n<app.selection.length-1;n++){
    app.selection[n+1].insertionPoints[0].contents = "\r";
    app.selection[n].nextTextFrame = app.selection[n+1]
    }

    in reply to: Space Before and After #88670
    Matt Isaac
    Participant

    This is possible to do with scripting:

    var doc = app.activeDocument,
    text = doc.textFrames;
    for(c=0;c<text.length;c++){ /*create a loop for each textFrame in the document;*/
    para = text[c].paragraphs;
    for(i=0;i<para.length - 1;i++){/*create a loop for each paragraph within a textFrame;*/
    if(para[i+1].appliedParagraphStyle.name == "Head"){ /*Check if the following paragraphStyle is "Head";*/
    para[i].appliedParagraphStyle = "Before Head"; /*apply "Before Head" paragraphStyle to the paragraph;*/
    }
    }
    }

    This will loop through each paragraph of each text frame and apply the ‘Before Head’ paragraph style to any paragraph whose next paragraph style is set to ‘Head’. For information on installing and using the script see: https://creativepro.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-or-blog-post.php

    in reply to: GREP number change #88636
    Matt Isaac
    Participant

    Do the nine-digit numbers contain commas? Do all prices have a period with the cents value? Are they all preceded by a number sign? There are many questions that can come up that would affect the outcome of the desired result.. The more specific you are with your request the easier it will be to give a solution that will work for what you need.

    in reply to: Adding two word last names to User Dictionary #88553
    Matt Isaac
    Participant

    I don’t know about adding “da Silva” to the user dictionary.. But a workaround could be to add “damSilva” and use a GREP Style to apply a no fill color character style to text: (?<=da)m(?=Silva) leaving da Silva.. I don’t know how well this will work for you.

    in reply to: GREP, how to select everything except a specific word #88112
    Matt Isaac
    Participant

    This also only works if “shining” only appears once in the paragraph.. if you need it to ignore two or more of the word you may need to use a script depending on what you are doing with the text after it is selected.

    in reply to: GREP Styles problem #87992
    Matt Isaac
    Participant

    try.. (\w+ ){3}\d\K(st|nd|rd|th).. Let me know if this doesn’t work for you.

    in reply to: Using scripts for advanced table sculpting – help needed #87946
    Matt Isaac
    Participant

    Yeah, i didn’t even think about the cells shifting with the merge.

    in reply to: GREP suggestion please? #87939
    Matt Isaac
    Participant

    try m\K3(?=/hr)

    in reply to: Using scripts for advanced table sculpting – help needed #87932
    Matt Isaac
    Participant

    var doc = app.activeDocument;
    var tables = doc.textFrames.everyItem().tables.everyItem();
    tables.rows[0].unmerge();
    tables.cells[0].merge(tables.cells[1]);
    tables.cells[2].merge(tables.cells[4]);
    tables.columns[4].remove();
    tables.columns[3].remove();

    This script does what your steps specify.

Viewing 15 posts - 1 through 15 (of 77 total)