Point to add to the script or Grep Style?

Hello

Is it possible to add a hightlight to a script?  Basically, what I want to do is highlight the text and the tricky part is that the text changes size depending on the size of the file, we are working on that.  I want to highlight automatically the "FOR PROFESSIONAL USE ONLY" the way that we do now is to underscore that in the menu options underscore: say my font size is 8, leading 9.6 (these will always change).

Weight: = 9.6

Shift: = - 8*.33

Color = yellow

It's the way we do now.  Can it be scripted or Grep style which will automatically do this for certain lines of text only?  And no matter the font size calculate what he needs to do if its 2pt, 10pt 100 PT etc... It will highlight the text specified correctly?

I hope it's possible...

Thank you

The lower one is best.

I remove a bug and also if not 'what' is provided to the point function culminating and there is no entry in find it which is the find panel of text and text is selected, then this text is highlighted.

An idea in the script is that a shortcut can be applied to it and it will get its information from the Panel of text search.

So for now to change the answer to this one

// Highlight function by Trevor
// http://creative-scripts.com
// Custom Scripts for Adobe InDesign, Illustrator and a lot more
// Beta Version 1
// https://forums.adobe.com/message/8898663#8898663

function highlight(what, color) {
    var range, s, doc;
    doc = app.properties.activeDocument;
    if (!doc) {
        return 'No Active Document';
    }
    s = app.selection && app.selection[0];
    range = (s && s.properties.underline !== undefined && s.characters.length) ? s : doc;
    app.doScript(f, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Highlight Text');

    function f() {
        var finds, find, l, leading, pointSize, currentChangeProps;
        color = color || app.activeDocument.colors.itemByName('Yellow');
        // Store current find change text settings
        currentFindTextWhat = app.findTextPreferences.findWhat;
        currentChangeProps = app.changeTextPreferences.properties;
        what = what || currentFindTextWhat;
        if (what !== '') {
            // if no what is provided then the current entry in the find text panel will be used
            app.findTextPreferences.findWhat = what;
            app.changeTextPreferences.changeTo = '';
            app.changeTextPreferences.underline = true;
            app.changeTextPreferences.underlineColor = color;
            finds = range.findText();
            range.changeText();
            l = finds.length;
            while (l--) {
                find = finds[l];
                leading = find.leading;
                pointSize = find.pointSize;
                leading = pointSize * find.autoLeading / 100;
                find.underlineWeight = leading + 'pt'; // This is presuming that font and leading size is set to points!
                find.underlineOffset = (pointSize - leading) * 1.5; // The 1.5 might need tweaking but seems to work well
            }
            app.findTextPreferences.findWhat = currentFindTextWhat;
            app.changeTextPreferences.properties = currentChangeProps;
        } else if (range !== app.activeDocument) {
            leading = range.leading;
            pointSize = range.pointSize;
            leading = pointSize * range.autoLeading / 100;
            range.underline = true;
            range.underlineColor = color;
            range.underlineWeight = leading + 'pt'; // This is presuming that font and leading size is set to points!
            range.underlineOffset = (pointSize - leading) * 1.5; // The 1.5 might need tweaking but seems to work well
        }
    }
}

/***************************************************************************************************************************************
** If text is selected then the "highlighting" is only applied within the selected text                                              **
** Otherwise the "highlighting" is applied within the whole document                                                                **
** One could change this to apply to what ever is selected in the Find text document if one wanted to                                **
** To highlight the word(s) in the find text panel just use highlight(); or highlight(undefined, app.activeDocument.swatches[5]);    **
** One can use highlight('Foo'); to highlight "foo" and ignore what's in the find text panel                                        **
** The formating / styles etc. for the find are taken from the find panel                                                            **
** If one provides a swatch as the second argument highlight(undefined, app.activeDocument.swatches[5]); that swatch will be used    **
** otherwise yellow will be used                                                                                                    **
** If one provides a swatch as the second argument highlight(undefined, app.activeDocument.swatches[5]); that swatch will be used    **
** If text is selected and what argument is given and the find what in the find panel is empty then the selected text is highlighted **
**************************************************************************************************************************************/

highlight();

Tags: InDesign

Similar Questions

  • Temporarily stop the execution of grep styles

    Hello

    I still bring a book with lots of texts in three languages. I have several paragraph styles with up to 10 grep styles. So my short of very slow InDesign files, I think that cause grep styles in my paragraph style.

    My question is, is there a way to prevent the grep style to run in the paragraph style without removing them?

    Concerning

    Sascha

    Hi Sascha,

    Add an asterisk in front of the GREP expression: *.

    Uwe

  • Decimal point for numbers in the script.

    Hello!

    So I build a flash program that will run a dashboard threatened just like the c# file to this Web site (Jeopardy! |) Coding4Fun Articles | Channel 9) because it is more beneficial for me to build it in flash than to pay $80 + for a Phidget. Everything went very well. However, I can't get the string to add commas for the life of me! I tried the NumberFormatter class, but nothing happens. I tried to import it, but it does not work nor receive code building advice. I would say that my AS3 knowledge ahead of a N00B, but not yet the intermediaries. I am only doing this for a hobby.

    This code is below. I'm working on the first player and the $200: button, everything here is in what regards to the score of the first player and the +/-functions $200:

    var firstPlayerScore:int;

    firstPlayerScore = 0

    var questionValue:Number = 0;

    p1Score.text = "$" + String (firstPlayerScore);

    p1200btn.addEventListener (MouseEvent.CLICK, firstNumber);

    p1addbtn.addEventListener (MouseEvent.CLICK, addP1);

    p1minusbtn.addEventListener (MouseEvent.CLICK, dropP1);

    function firstNumber(Event:MouseEvent):void {}

    questionValue = 200

    }

    function addP1(Event:MouseEvent):void {}

    firstPlayerScore = firstPlayerScore + questionValue;

    p1Score.text = "$" + String (firstPlayerScore);

    questionValue = 0

    }

    function dropP1(Event:MouseEvent):void {}

    firstPlayerScore = firstPlayerScore - questionValue;

    p1Score.text = "$" + String (firstPlayerScore);

    questionValue = 0

    }

    End of the code

    Any help would be greatly appreciated. Thank you!

    Given that the two functions of your repeat the same code you can probably create another function for them both to share and that extending further, passing the textfield andf score as arguments that you can share for all players...

    function addP1(Event:MouseEvent):void {}

    firstPlayerScore = firstPlayerScore + questionValue;

    writeScore (p1Score, firstPlayerScore);

    }

    function dropP1(Event:MouseEvent):void {}

    firstPlayerScore = firstPlayerScore - questionValue;

    writeScore (p1Score, firstPlayerScore);

    }

    function writeScore(tField:TextField,_score:int):void {}

    var commaScore:String =... add commas here, but you intend to do

    tField.text = "$" + commaScore;

    questionValue = 0

    }

    If you want to help the NumberFormatter, you will need to provide some information about it.

  • Script or GREP?

    I use InDesign CS5 (CS6 on order). In my paper, I have 9 numbers i.e 123456789 strings. I want to find a way to globally convert these strings in the format 123 45 67-89. Seems simple enough! In research on the scripts and greps (I never use greps, or wrote a script), I can't determine which would be the best way to achieve this.

    Find/replace > grep tab

    Search: (\d\d\d)(\d\d)(\d\d)(\d\d)

    Change to: $1 $ 2 $3-$4

  • GREP style: Find all the letters between

    I am trying to create a GREP style to deal with a signature of two lines like this:

    -Name of the author,

    Source cited

    I want the name of the author to be caps/sc and the font that I use has an established expert, so I need to replace only the lowercase characters of the name of the author with the sc. character style

    So far, what I did is creat a character style that is defined as the Roman. I then to my grep styles:

    peps.jpg

    The italic style applies to the 2nd line (after a forced line break) very well.

    However, I can't do it sc style to apply to my lc between the em dash characters and the comma. I can get the sc to be applied to the whole line, if I use '. ' for any character, but "\l" does nothing for me...

    Someone at - it advice?

    Thank you

    Chris

    Thanks for the help. You led me in the right direction.

    I was doing too complicated and I still don't have a firm grasp on what GREP may or may not do.

    I solved the problem with GREP styles:

    The reason that I can't apply sc for the first line is because the font I'm using is old and includes a set of expert. In police expertise, there are only small capitals. Strikes in uppercase are reserved for the factions, currency symbols and other glyphs not standards.

    Best,

    Chris

  • one of the scripts in AppleScript 2 (grep + Add hyperlink)

    Hello.

    I try to combine the two scripts. First digit numbers a greps 7 in indesign

    and another, hyperlink, which is the same numbers as this (grep) selection'

    Does anyone have idea how to do this. Thank you - Jan

    This greps digit number 7 in indesign with this script

    say application "Adobe InDesign CS5.5.

    Activate

    set grep preferences to find

    set grep preferences to change

    set {find what to find grep preferences to '\\d{7'}

    say an active document

    set myFoundItems to find grep

    end say

    end say

    and this one hyperlink:

    say application "Adobe InDesign CS5.5.

    say document 1

    set mySelection to selection

    the value LinkID to content of mySelection as string

    set LinkIDURL to string LinkID

    try

    set URL_L to do destination URL of the hyperlink name:LinkID destination URL:LinkIDURL} {properties

    on error

    set URL_L to the URL of the hyperlink destination LinkID

    end try

    set URL_La to do text of hyperlink source properties {text source: () (point 1 of mySelection), hidden:fake}

    set MonLienHypertexte to do { new hyperlink with properties { }destination:URL_L source:URL_La visible:fake}

    end say

    end say

    end



    YES! I got it with the help of Indesign scripting quide.

    Here's the applescript. Feel free to use if you need. It doesn't work if none of the hyperlinks are not assignet 7-digit, you're grepping with this script

    say application "Adobe InDesign CS5.5.

    activate

    -grep opitonit ettei edelliset resetoi high vaikuta

    the value find grep preferences for Nothing

    the value grep preferences to change anything

    -Asettaa haku in parametrit

    define include hidden layers to find change grep options to false

    define include locked layers to find to find change grep options to true

    -7 number perakkain hakuaehto

    { the value find what to find grep preferences to '\\d{7'}

    say an active document

    -etsii jokaisen sivulla oleva mallikoodin nimen

    the value myFoundItems to find grep

    -ottaa ylos jokaisen mallikoodin numerosarjan

    Repeat with I have from 1 to (count myFoundItems)

    the value Name of the file of content of point i of myFoundItems

    if not (there is the URL of the hyperlink destination FileName) then

    the value The of to make the URL of the hyperlink destination with properties {name: FileName, destination URL: file name}

    on the other

    the value The to the URL of the hyperlink destination FileName

    end if

    -hyperlinkin of lisaa

    the value TheHSName of file name

    the value TheHS to do source hyperlink text with properties {name: TheHSName, text source: (point I of myFoundItems), hidden: false}

    do new hyperlink with properties {destination: the, source: TheHS, visible: false}

    end Repeat

    end say

    end say

  • How to add channels to a channel table in the display panel in the script

    Hi all

    We try to put in place a review tool video using DIAdem, and we want to fill the results which have already been analysed in a Panel. This means populating a channel table in this Panel with the necessary data, but we cannot find a way to add strings to a table in the script. It seems that it should be very simple, but we can not find!

    Thank you

    Peter

    Hi Peter,.

    Yes, it's simple. You prepare your VIEW with the channel table layout and use the add on the columns collection method.

    The command might look like this:

    VIEW. Sheets (1). Areas (1). DisplayObj.Columns.Add("myGroup/myChannel")

  • Add/change the columns of data type (scripting)

    Hello

    I am writing a script to add default columns and their values in tables. So far, for me, it is possible to add columns to an existing table in the model.

    Then, I want to add value to the data type. I discovered there is a method called getDataType(). So far, I have not found the "setter; for this property.

    Like other scripts, I started by creating a table with columns, and then using the API to read the values.

    A simplified version of my code:

    get the columns of table

    myTab var = model.getTableSet () .getByName ("T_POSITIONS");

    colArray = myTab.getElementsCollection () .toArray ();

    loop through columns

    for (i = 0; i < colArray.length; i ++) {}

    the type of var data = colArray [i] .getDataType ();

    model.getAppView () .log (colArray [i] + "a datatype" + dataType);

    colArray [i] .setDataType ("VARCHAR2 (1)");

    }

    An error occurs when I want to run this script: could not find setDataType function in the object ID.

    I can't find the right method to add/change the datatype property.

    Any information would be appreciated.

    Hi Bart,.

    Here's what's in the column in the XML file:

    
    FDB11R21
    EMPLOYEES
    FIRST_NAME
    
    2015-01-13 12:45:08 UTC
    First name of the employee. A not null column.
    HR_870
    true
    false
    1
    LOGDT024
    20 BYTE
    false
    
    

    20 BYTES

    If you need set the size in "20 BYTE" or "20 CHAR".

    Philippe

  • Create the Script to add a file in an Action name


    I have a picture, and I have a practical action that records, it cultures, he saves, cultures it differently and recorded once more. Currently, I have two options for these stops - I can save each crop in a separate folder and batch rename, or I have the break from the action he saves so I can customize the file name. What I would do is create a script (or, if there is an easier way), add this file name if it will save all simply in the same folder that I have to do it manually.

    Basically, I start with the name of the file: 'TEST '.

    for the first part, it I save as 'TEST '.

    for the second record, I want to save it as "TEST_P1".

    for the third record, I want to save it as "TEST_P2".

    I am brand new to scripting, and is my programming experience with Java and medium in my past, everything feels a little familiar. If someone could help me with this, I would really appreciate it!

    Another option is to use the Image Processor Pro script. You must create several actions to different cultures, you want to make to the original document size not a crop of harvest of a crop until the final harvest.  Don't have any records in these actions. Then just use meny file > Automate > Image Processor Pro.  Implement its dialog box to save the file names you want where you want to save them create.  You can also save that in action. The image pro script processor is a Photoshop plug-in.  In the dialog box, it will record the setting you used in the action stage.    Alternatively, you can save the configuration dialog for later use in the IPP dialog before running the process put in place.

    You can store as many files as you need with IPP and run your actions simple cultures for each size of harvest. IPP opens you simply file a copy to each of your operations and after the action is performed to save the modified copy of doctment under the name of file you set up. You can configure as many tabs as you want you can even have you resized using IPP option re-size crops.   If the script is easy to use his 10 + lines of script Photoshop...

  • How to add buttons in the script, and then click on run different codes?

    If we run the script, then it should display ok, cancel button 6 button. If we click on button1 coding with button1 dangerousness must be running and so on.

    Button1

    Button2

    Button3

    Button4

    button5

    Button6

    OK Cancel.

    Marie rosine

    // DialogSimpleButton.jsx
    // http://forums.adobe.com/thread/1327372?tstart=0
    // how to add buttons in script, which on click run different codes?
    
    // regards pixxxelschubser
    
    function SimpleDialog() {
    
    var w = new Window('dialog', '');
    this.windowRef = w;
    w.orientation = "column";
    
    btn1 = w.add('button',undefined,'Button 1');
    btn2 = w.add('button',undefined,'Button 2');
    btn3 = w.add('button',undefined,'Button 3');
    btn4 = w.add('button',undefined,'Button 4');
    btnOK = w.add('button',undefined,'OK');
    btnCancel = w.add('button',undefined,'Cancel');
    
    btn1.onClick = function() {alert("Button 1");};
    btn2.onClick = function() {alert("Button 2");};
    btn3.onClick = function() {alert("Button 3");};
    btn4.onClick = function() {alert("Button 4");};
    
    defaultElement = btnOK;
    cancelElement = btnCancel;
    btnOK.active = true;
    
    btnOK.onClick = function() {
        stuff = "your stuff";
        w.close();
        }
    
    w.show();
    }
    
    var stuff = null;
    SimpleDialog ();
    if (stuff) alert(stuff);
    
  • Add/Remove the same exact point from a drop down list

    Hello!

    I need power remove/hide and/add/view THE SAME POINT, or that it doesn't look like the same question, please see the example of what I m doing:

    When you open the document:

    01.png

    If you click 'Yes' to the first radio 4 value is added

    02.png

    If you click 'Yes' in the second radio, value 5 is added

    03.png

    If you click 'no' on the first radio, you remove the value 4 BECAUSE you remove the element #3

    04.png

    If you click on 'no' on the second radio, you delete nothing 4 BECAUSE you try to delete the point #4


    05.png

    And then you get this weird combination

    06.png

    This is the code on the first Radio

     form1.#subform[0].value_4::click - (JavaScript, client)

    if (this.rawValue == "1") {
         DropDownList1.addItem("value 4");
    }else {
        DropDownList1.deleteItem(3);
    }

    This is the code on the second radio

     form1.#subform[0].value_5::click - (JavaScript, client)

    if
    (this.rawValue == "1") {
           DropDownList1.addItem("value 5");
    }else {
           DropDownList1.deleteItem(4);
    }

    Anyone know how to remove a specific item of a dropdrown? or may not remove, hide only if this is possible... I tried to change specific values for Add/Remove always from the same point, but it did not work.

    Thank you!

    Ago, I find it odd that there is no native method xfa for the index of an item in the menu drop-down. Not documented at least (as I know).

    What you can do however, is create your own method!

    Here, in the initialize event of your highest subform you create a method that exends class object (which includes all XFA objects too), like native JavaScript:

    //@para String value of the item in the drop down
    //@return Boolean - true if item was deleted, false if not and null object if not found in the list
    
     Object.prototype.deleteItemValue=function(sVal){
     for (var a=0;a
    

    You can remove any item from your drop by modying your code:

    if (this.rawValue == "1") {
     DropDownList1.addItem("value 4");
    }
      else {
     DropDownList1.deleteItemValue("value 4");
    }
    

    Kyle

  • Functions in the script being not recognized after objects as some point

    Hi all

    I wonder if someone has understood why after normally 300 to 500 lines of JavaScript in a Script object, sometimes functions to the end are no longer recognized by the XFA processor when they are referenced ("' TypeError: Scripts.myFunction is not a function" ").

    When re-sort, further to the top of the script object, they work as expected. The line on which it no longer recognizes functions also is not always the same and I worked with some script objects with more than 800 lines with all functions still work.

    I tested Designer 9 and 10, Reader 8 9 and 10.

    At least let me know that I'm not the only one. I knew another developer who had encountered the same problem.

    Kyle

    I've never had a problem with big scripts, even with 1000 or more lines.

    Did you test your scripts JSLint?

    Dirty syntax can always have side effects.

    http://blogs.Adobe.com/formfeed/2010/09/JavaScript-lint-check-in-Designer.html

  • an error has occurred in the script on this page. __________

    Line 30 Char: 3 error: library not regitsted Code: 0 URL - file

    ; How can C:/program%20Files/Dell%20Support%20Center/sscommon/inclss_shellinclude.js I solve this

    Your problem is probably not with Windows XP, but with the Dell Support Center software.

    You may contact Dell for assistance, but they like to sometimes just reinstall XP as a "solution" to the problems.

    You can uninstall the Center Support of Dell by using Add/Remove programs and get the latest version (32 or 64 bit) from here:

    http://www.Dell.com/content/topics/global.aspx/services/en/dsc_home?c=us&l=en

    If you are not sure what version to download, to do this, and we will help you discover:

    Click Start, run and enter in the box:

    Msinfo32

    Click on OK and when the system info summary appears, click on Edition, select all, copy, and then paste the information here.

    There will be some personal information (such as the user name and the name of the system), and anything that turns information private for you, simply delete the pasted information.

    If you see this message in Internet Explorer, you can also configure IE does not ask you if you want to debug a faulty script, someone else.

    Given that most of the people have no interest in debugging the scripts (unless you are a developer of a script and it's your script), I just do not get bored with things from Internet Explorer.  You can run through scripts that have problems in your regular WWW surfing too, so disable the IE script debugger is usually a good idea, no matter what you decide to do about your Dell Support Center.

    In Internet Explorer, click on tools, Internet Options, advanced, and check the box:

    Disable script debugging

    Restart your system and try the web page again to make sure that the fit sticks...

    Do, or do not. There is no test.

    I need YOUR voice and the points for helpful answers and propose responses. I'm saving for a pony!

  • Impossible to establish a correlation between the Script

    HI - any help would be appreciated. Thanks in advance!

    OpenScript 12.5, I receive the following error message when you try to save a script of Web/HTTP protocol for load tests:

    Problem occurred:

    (RED X) "Unable to correlate the script" has encountered a problem. Exception occurred in correlating script: oracle.oats.scripting.transforms.TransformException: transformation rule threw the exception in transformStep: oracle.oats.scripting.modules.http.transformRules.cookie.ClientSetCookieDelegate. See the errorlog for details.

    "I tried to correlate the Script... option, but still error: get the following"problem occurred"message: Exception occurred by correlating script:

    Just recently moved to Windows Server 2008 from 2003. using IE11

    Tried OpenScript only on a standalone workstation Windows 7 with the same results.

    Any ideas why I get this error and how to fix it?

    Sincerely,

    David Gardner

    Yutaka Takatsuhas made the following response:

    This could be the known bug in the installer if your version of OATS has been upgraded oatmeal 12.5.0.2 of older versions.

    The bug mentioned above was created in the upgrade installer. For users improved 12.5.0.2 of earlier versions, please add - XX:-UseSplitVerifier to the arguments of start-up OpenScript as shown below.

    C:OracleATSopenScriptOpenScript.exe - configuration openscript_configuration - vm C:OracleATSopenScriptjrebinjavaw.exe - vmargs-Xmx512m - XX: MaxPermSize = 256 m - XX:-UseSplitVerifier

    Start > all programs > OATS > right-click OpenScript to select Properties > in the dialog box, copy the text in the 'Target' field and modify accordingly and stick it in return.

    For users who own 12.5.0.2 installed should already have this argument added to your OpenScript starts. This work around is required only for users who have upgraded to 12.5.0.2.5 days

    • David Gardner: Thanks Yutaka. When I saw my target in the start menu, it seemed to have the same starting point, but I think I was using an old OpenScript shortcut that was not in force. In all cases, the problem seems to have been resolved. Again, thank you.
  • I have 3 domains. A field is a constant date mm/dd/yy. The second field is a digital number (1-120) and can be changed. The third field calculates two fields 1 and 2 in the summation and shown in mm/dd/yy. How do I calculate that in the script?

    How do I calculate that in the script? I have 3 domains. A field is a constant date mm/dd/yy. The second field is a digital number (1-120) and can be changed. The third field calculates two fields 1 and 2 in the summation and shown in mm/dd/yy.

    You searched for ' add days?

    You must write a custom for this JavaScript calculation because you cannot add a number any date. Also the date strings are not just a number, even if we can convert a given date in a number for that date that represents the time form a date date (Epoch). Witn this value, we can achieve them all kinds of date calculations and collect a little information about the date. JavaScirpt uses midnight on January 1, 1970 UTC for starting point or the date of the time. Its value is zero, and every millisecond increases the value of 1. When a date string is converted to the date object JavaScirpt we have access to many properties of the date and can use several methods to extract information or adjust the date object.

    Field 1 is in the format "Date" with a format of "mm/dd/yy".

    Field 2 is in «Number» format with 0 decimal.

    Zone 3 is in the format 'None '. The custom calculation script applies to the formatting.

    The custom for JavaScript calculation area 3:

    var cField1 = this.getField("Field_1").valueAsString;

    var cField2 = this.getField("Field_2").valueAsString;

    Event.Value = "";

    If (cField1! = "" & cField2!) = "") {}

    Console.println (cField1 + "" + cField2);

    calculate that if we as no null data;

    var cDateFormat = "mm/dd/yy";

    convert start date date object.

    Kai var = util.scand (cDateFormat, cField1);

    get the date of the month;

    David var = oDate.getDate ();

    Add field 2 number of days;

    David = Number (nDate) + Number (cField2);

    of being updated for the new date.

    oDate.setDate (nDate);

    Set the field to update formatting;

    Event.Value = util.printd (cDateFormat, letter);

    } / / end of data not null;

Maybe you are looking for