Forum Replies Created
-
AuthorPosts
-
Matt Isaac
ParticipantJust 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.Matt Isaac
Participanthttps://helpx.adobe.com/indesign/using/find-change.html
also has some useful tips.Matt Isaac
Participanthttps://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’)Matt Isaac
ParticipantI’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
Matt Isaac
ParticipantI’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.
Matt Isaac
ParticipantThe 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
Matt Isaac
ParticipantI 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]
}Matt Isaac
ParticipantThis 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
Matt Isaac
ParticipantDo 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.
Matt Isaac
ParticipantI 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.
September 1, 2016 at 1:33 pm in reply to: GREP, how to select everything except a specific word #88112Matt Isaac
ParticipantThis 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.
Matt Isaac
Participanttry..
(\w+ ){3}\d\K(st|nd|rd|th)
.. Let me know if this doesn’t work for you.August 31, 2016 at 8:53 am in reply to: Using scripts for advanced table sculpting – help needed #87946Matt Isaac
ParticipantYeah, i didn’t even think about the cells shifting with the merge.
Matt Isaac
Participanttry
m\K3(?=/hr)
August 30, 2016 at 2:02 pm in reply to: Using scripts for advanced table sculpting – help needed #87932Matt Isaac
Participantvar 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.
-
AuthorPosts