Select a block of text with lable

I'm coming down with a block of text from the document page 2 with label "main script text" but script below does not work.

app.activeDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;

app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;

app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.spreadOrigin;

Try

{

var jt = app.activeDocument.pages [2] .textFrames;

for (i = 0; i < jt.length; i ++)

If (.label jt [i] is 'Hand Text')

JT [i]. TextFramePreference.autoSizingType = AutoSizingTypeEnum.HEIGHT_ONLY;

}

{catch (e)}

Alert ("nothing happened");

}

Can you please help me what is the error here.

Counting with numbers index starts with the number 0.

So the second page is app.documents [0] .pages [1].

Uwe

Tags: InDesign

Similar Questions

  • [CS6] Select the block of text with a certain height and move it to a specific location?

    I have a bunch of labels on page that I need to move. All these labels are the same height (0.125 in.) so what I think is that a script could go on each page and find the article on this basis, select it, and finally, move it to a specific location of XY with a right anchor point. It would be very difficult to do? I think it would be a rather simple script.

    Thanks for any help you can give!

    No problem getting the height of a selected image and looking for images with the same height. Here is a sample script:

    (function(){
    
        function frameHeight (frame) {
            var gb = frame.geometricBounds;
            return (gb[2]-gb[0]).toFixed(3);
        }
    
        function moveFrames (h) {
            var pItems = app.documents[0].pageItems.everyItem().getElements();
            for (var i = pItems.length-1; i >= 0; i--) {
                if (frameHeight (pItems[i]) === h) {
                    pItems[i].move ([0,0]);
                }
            }
        }
    
        if (app.selection.length > 0 && app.selection[0].hasOwnProperty('geometricBounds')) {
            var h = frameHeight (app.selection[0]);
            moveFrames (h);
        }
    
    }());
    

    This move of the elements on the page with the same height as the photo selected to the top left of the page. See the move() command line 12. You can substitute your own coordinates [0,0].

  • find and delete blocks of text with the same geometricBounds

    Hi writer... .new question from here:

    mySelection var = app.activeDocument.selection [0] .geometricBounds;

    alert (mySelection);

    throughout the document, I need search and delete blocks of text with the same geometricBounds.

    If possible, the same dimensions, but not the same positions.

    Thanks for the help!

    OK Bala... .in to decimal differences, some executives have not been removed.

    I solved with "Math.round' instead of 'number '.

    ===================

    mySelection var = app.activeDocument.selection [0] .geometricBounds;

    var myWidth = Math.round(mySelection[3]-mySelection[1]);

    var myHeight = Math.round(mySelection[2]-mySelection[0]); Alert (myHeight);

    var allFrames = app.activeDocument.allPageItems;

    While (t = allFrames.pop ()) {}

    {if (t.IsValid)}

    var myTextframe = t.geometricBounds;

    var myTWidth = Math.round(myTextframe[3]-myTextframe[1]);

    var myTHeight = Math.round(myTextframe[2]-myTextframe[0]);

    If ((myWidth == myTWidth) & (myHeight == myTHeight)) {}

    t.Remove ();

    }

    }

    }

    ===================

    Now, your script works great!

    Thank you very much!

  • How to select a block of text to the Script name?

    Hello

    I have listed the text block in the code below,

    UIDRef uidreference = stories->GetNthTextModelUID(0);

    InterfacePtr<ITextModel> TheTextModel (uidreference, UseDefaultIID());

    if (TheTextModel is NOTHING)

    Break;

    IFrameList * Frames = TheTextModel->QueryFrameList();

    if (Frameworks is NOTHING)

    Break;

    AFrameUID UID = images->GetNthFrameUID(0);

    I need to select the block of text by Script name (Windows-> Utitities-> Script title).

    Please suggest the solution above the problem.

    Try,

    InterfacePtr script (content, UseDefaultIID());

    If {(script)

    ScriptLabelValue = script PMString-> GetTag();

    CAlert::WarningAlert (scriptLabelValue);

    }

  • Select the block of text on each page of a sudden and resize them

    Hello, I want to do a 400 pages of text. How can I select the block of text on each page of a sudden and change their size at the same time? (each block of text is the same size per page)

    Make a backup copy of the file incase something goes wrong, then:

    Ensure that executives align on the margins on all sides - change margins of the master page applied to achieve, if necessary.

    Allow the adjustment of the layout (layout > setting layout...)

    On the master page, change the margins to be the size you want the new text frame dimensions to be.

    If, for some strange reason, you won't use these margin settings in the layout, turn off the setting of page layout and reset them on the master page again to what you want.

  • Select the block of text to items found

    Hi experts

    Here I find etc using the character style. I found myself results. Now, what is my need I want to select the block of text for the element found.

    app.findPreferences = NothingEnum.nothing;
    app.changePreferences = NothingEnum.nothing;

    app.findPreferences.appliedCharacterStyle = "FigCallout";

    var myResults = app.activeDocument.search ();

    for (i = myResults.length - 1; i > = 0; i--)
    {
    Select the block of text where myResults [i]

    }

    I use CS2 Windows.

    Thanks in advance

    concerning

    a you are the

    Memory: .parentTextFrame myResults [i]?

  • CS5, blocks of text with the selection tool.

    InDesign CS5:

    I work on several documents that requires to move blocks of text.

    When I select the text block with the selection tool, my cursor will move immediately to the text tool.

    I'm not double click, only clicking once to select.

    I don't want to edit text, select only the text block, so I can move it.

    Is there a way to disable this feature?

    Or maybe a tip and Trick so the tool rest the tool selection and not switch to the type tool.

    Thank you in advance.

    Kathryn

    As stupid as it may sound, try a different mouse.

    We prefer to keep the choice to convert an empty block to a block of text, but here already are blocks of text.

    Bob

  • Select the block of text of XML structure

    I try to move the specific text blocks created if an XML to import to the bottom of the page (low mounting table) as info Folio and slug.

    I can choose the text associated with an XML "VTag" element, but not the text block. Any help would be appreciated.

    Thank you

    property myHoHoV: {}
    on myLoopLoop (myElement)

    Tell application "Adobe InDesign CS4"
    tell the active document
    the value moreElement for each XML element of myElement
    Repeat with 1 x to (moreElement County)
    the value of element x of moreElement em1
    Select em1
    If (the tag name of the em1 is "VTag1") then
    em2 Set to em1
    Set the properties of the display preferences {horizontal measurement units: inch, vertical measurement units: inches, origin origin: the rule page}
    at the top left anchor the transform value point of reference of the window layout 1
    Select text of em2
    Tell application "Adobe InDesign CS4"
    move the em2 text to {5, 5}
    tell the end
    end if
    Tell me myLoopLoop (point x of the moreElement)
    end repeat
    tell the end
    tell the end
    end myLoopLoop

    Hi Kyran,

    If the previous code has a problem, then try this code below.

    Tell application "Adobe InDesign CS4"
    activate
    the value myPageHeight at the height of the page of the preferences of the document 1 document
    the value myPageWidth to the width of the page of the preferences of the document 1 document
    the value myOldRulerOrigin at the origin of the rule of document 1 display preferences
    the original value of the rule of 1 at the origin of the page display preferences
    Set the zero point of the document 1 to {0, 0}
    the value mapping page active of the active window
    tell document 1
    the pgcnt value to count pages
    Repeat with 1-pgcnt p
    tell the page p
    the txtframe value to count blocks of text
    Repeat with 1-txtframe f
    the value paracnt to count paragraphs of text frame f
    tell text frame f
    Try
    TagName {} Set
    Repeat with 1 paracnt access point
    end game of tagname to (name of the tag to (point 1 of the associate XML elements) paragraph ap) as string
    end repeat
    If ((comte de tagname) is equal to 1) and (each point of tagname contains "VTag1") then
    Select
    move to {0.125, myPageHeight + 0.125}
    on the other
    don't select anything
    end if
    try to end
    tell the end
    end repeat
    tell the end
    end repeat
    tell the end
    activate
    Display dialog "process is complete...". "with the 1 icon
    tell the end

    Concerning

    MANi

  • Select all blocks of text related

    Dear all,

    My request:

    1. is it possible to select all the text frames linked to my block of text by selecting (see attachment)

    2 suppose that if we choose all the blocks of text, it is possible to set the height for all blocks of text such as 3 p or 4 p etc...

    Try the script to select all the linked text frames:

    If (app.selection [0] .nextTextFrame == null)

    {

    If (app.selection [0] .previousTextFrame! = null)

    {

    Alert ("Pass")

    App.Select (previousTextFrame.parent) & & app.select (nextTextFrame.parent) & & app.select (startTextFrame.parent)

    }

    }

    Screen Shot 2013-03-19 at 8.01.03 PM.png

    Could someone give you a solution for my application.

    Thanks in advance

    Beginner

    If you want to do is make managers of related related texts have all the same height, here's a way to do it:

    If (app.selection.length == 0) {}

    Alert ("Please select a textFrame before running this script");

    Exit();

    }

    mySelection var = app.selection [0];

    If (!) mySelection instanceof TextFrame))) {}

    Alert ("Please select a TextFrame before running this script");

    Exit();

    }

    var mySelection.parentStory = monarticle;

    var myFrames = myStory.textContainers;

    var nFrames = myFrames.length;

    for (ix var = 0; ix)< nframes;="" ix++)="">

    var myFrame = myFrames [ix];

    var limit = myFrame.geometricBounds;

    delimits [2] = limits [0] + 4;          Set the TextFrame 4 height units

    myFrame.geometricBounds = limit;

    }

    Stephen

  • I can auto adjust all the blocks of text with overset text?

    Due to several factors (change computers, versions of different fonts, etc.), I had to change most of the fonts in my text-heavy document.

    There are a lot of charts and tables in this 125-page document, and now most of all text frames have overset text.

    The new font is in fact identical to the previous one, however, there are a few differences that are causing it take more text frames. I tried to adjust the line spacing in my character and paragraph styles, but these do not seem to effect.

    Is there a way to automatically adjust all frames in excess to account for the new font?

    Thanks in advance.

    Not sure that the result will be 100% desirable, but there is a way to define all frames to auto-size...

    Run find/replace and choose the tab object.

    Down, choose the Document research: menu. Choose the blocks of text such as: menu.

    Click the icon of glass/frame next to the search Object Format field:

    In the Options of Format object search dialog box, choose Auto setting 'Off' on the text size Options > menu automatic sizing:

    Click OK, and then click the icon / window next to the subject of change Format field:

    In the change object Format Options dialog box, choose 'Height' only on the text size Options framework Auto > auto-size menu, and then click the up button in the Center in the framework - pinning proxy:

    Note: Another option for pinning would be better according to your presentations, but this setting will make executives grow at the bottom, which seems the most logical... in most cases.

    Click OK, and then change all.

  • Clone blocks of text with the titles bunch

    I hope someone out there can help us with this question.

    We have a book with an illustration on one page and a legend (list of issues) on the opposite page.

    The star of the picture must appear on both pages. The paragraph for the title style uses a format of automatic numbering.

    But we do not want the section on the right for the auto-numbering page, we want to clone what's on the left page.

    Is the a way to clone the title on page 1 (left page) so that it appears on page 2 (right page)?

    The goal is if the text is changed on the left page, the change is also displayed on the right page.

    The problem we found is that the cloned text block takes the next number of topic. For example, "1. Topic' on the left becomes "2. The topic"because of the paragraph style.

    We tried with related stories, text variables, etc., but the title on the right-hand side always takes the next number.

    Thoughts anyone?

    Thank you.

    Bruce

    InDesign CC - Windows

    Could not get this text variable to automatic numbering on the master page, but works well on the pages of the document.

    Thanks for the help!

  • Title block of text with formatting

    I'm working on a brochure that contains a number of short sections that focus on a specific topic. That's what I would do: for each section, I would like to set up a separate text frame, each with a heading formatting, as this screenshot:

    Paragraph.jpg

    I tried several approaches, but no hass gave me the kind of control I want. In the above example, I inserted an empty paragraph before the text and then pasted in text formatted in blue. I got the look I'm after, but I can't seem to be able to control the spacing between the blue heading and the following paragraph. Initially tried to put the blue box above the text of paragraph, but the only way I could keep them together was to group them, and it doesn't really work to my satisfaction. One thing I have not tried is to attach the blue box under subsection.

    Does anyone have any good solution to this?

    I think that the chassis anchor is probably the way to go. You will need to put the title in the anchored frame and place the anchor in an empty paragraph so that it can work properly, however - anchored objects are in front of the text. You can add the dressing to the anchored frame to make sure it grows the following down, if necessary, but probably will not. Applied to an anchored object text wrapping does not affect the text before the anchor (or in the same line that the anchor is positioned custom). Space after paragraph should be enough to control spacing, and you want an option to continue to keep it by the following. That can include the paragraph style applied to the empty paragraph in which you place the anchored frame. Use a different style for the text of the title itself, so you can include it in your table of contents.

  • [AS] How can I move an object, more specifically a block of text with Applescript?

    I'm converting some old scripts Quark 8 that we usually use for paging on InDesign and I'm stuck on how to move one of my items.

    It's the script WORKING in 8, Quark, that uses the command "origin".

    set origin of limits of Ad_Box to {Position_Height Position_Width}


    Is there a quick and easy way to do this in InDesign CS5? I searched Google and these forums and have had no luck.

    I played a bit with the Set function limits geometric, but had no luck.

    Thank you!

    move Ad_Box to {Position_Height, Position_Width}

  • How to select several images of text block?

    Hello world

    I'm sure it must be something obvious, but I can't get out!

    I'm trying to select multiple blocks of text. I choose a text frame and then 'shift' to select a second frame and his works fine AS LONG AS the blocks of text are not threaded. When text frames are threaded I can't select more than one at a time?

    Any help would be appreciated! Thank you.  HJ

    You can select several images (threaded or pierced) as long as they are on the same page or spread. But ID won't let you select images that are on different pasta spread.

    Ken

  • How can I create a series of blocks of text using the Excel list values?

    It is first of all, the first script I am trying to write from scratch. I'm completely green at the script and I picked up a few bits of ID Adobe scripting guide, but nothing has really stuck still relating to this particular goal.

    My supervisor maintains a master list of advertising space, with the name of the account, is the width of the space, and how space is the height, in an Excel sheet. These spaces can number in the hundreds, and I'm stuck manually drawing a rectangle for each space, which takes a lot of time.

    I would like to create / helped to create a script that will take these values and "magically" to draw these spaces in the form of blocks of text, with the width (in columns) and the height (in inches) defined by the values in the main list, as well as the name of each account in the subsequent text frames.

    The script didn't necessarily need to be able to pull the values directly from the Excel sheet; Can I transfer a file text if necessary, or directly in the script, values he change because I need it. A great thing (if she is not able to pull directly from an Excel sheet) which is the number of spaces a week changes, and so do the accounts and the width and height. Accordingly, it would be ideal that values of the sheet could be modified easily, in order to create a new set of spaces as necessary.

    Positioning for each space is not crucial, only the height and width. If they were all on top of each other on the same page, it is a result for me. The main idea is to not have to draw them all manually, one by one.

    For me, this looks like a command, but I hope that some experienced there Scripting Guys can help me, because I want to become experienced as well.

    Thus, the TL; DR version:

    -Script to draw a series of text blocks.

    -Size of the text boxes should be defined by the values width and height of spreadsheet Excel.

    -Text blocks must have the account name as content (from account in the Excel worksheet names).

    -Accounts, width and height changes every week in the Excel sheet, so must be relatively easy to exchange all values.

    -Width values on the Excel worksheet columns. It would be ideal that the script could turn those numbers into multiples of columns as necessary.

    -Script (optionally) can take values directly from Excel sheet.

    -Script (option) can set the fill color for the gray text frame. (If it works as I think, I could just select all the resulting images of the text myself and put them all to grey at the same time... I'm not lazy as )

    Thanks in advance to anyone who can help in any way possible, even if it's just a little push in the right direction. This script will save 1 to 2 hours of boredom every week.

    Look like the perfect thing for the InDesign scripting.

    I copy content from Excel to a text file, for a format easily read in InDesign, and there will automatically be a TAB for each 'cell', just using copy and paste.

    Here is a piece of code, perhaps you could go on with (the addition of variable to change pages and the location on the page and other things).

    The readFileLineByLine function, can be easily reused with any function using "recall". You simply tell the function what you want to be executed for each line of text that reads:

    const COLUMN_WIDTH = 2; // Define the column width in inch
    
    var pageIndex;
    var textFramesExported; // not implemented.
    
    // Add a new dokument. Set myDoc to app.activeDocument to use
    // the current document instead of creating a new one.
    var myDoc = app.documents.add();
    
    // The doSomethingWithTextRow function is called upon for every line of text read.
    readFileLineByLine('c:\\test.txt', doSomethingWithTextRow);
    
    function doSomethingWithTextRow(row){
        // We expect the text line to be TAB separated (\t = TAB). We get that from just copying the contents of an
        // excel file into a text document.
        var cells = row.split('\t');
        var companyName = cells[0]; // The Company name in the first slot of the array
        var width = COLUMN_WIDTH * cells[1];
        var height = cells[2];
    
        // Create a new text frame for every row handled
        if (pageIndex==undefined) pageIndex = 0; // Count up when you have exported a number of texts, I leave this for you to do.
        var newTextFrame = myDoc.pages[pageIndex].textFrames.add();
        newTextFrame.contents = companyName;
    
        // The text frame is created in the top left corner.
        newTextFrame.geometricBounds = [0, 0, height + ' in', width + ' in']; // Top, Left, Bottom, Right 
    
        // You might want to move the textframes to other positions, keeping track of how many you put out per page.
        newTextFrame.move( [10, 10] );
    }
    
    function readFileLineByLine(path, callbackFn){
        var myFileIn = new File(path);
        if (File.fs == 'Windows'){
            // This was probably added to recognize UTF-8 (even without its start marker?)
            myFileIn.encoding = 'UTF-8';
        }
        myFileIn.open('r');
        var myEncoding = myFileIn.encoding;
        try{
            if (!myFileIn.exists){
                throw('Missing file: ' + myFileIn.fsName)
            }
            var ln = '';
            while(!myFileIn.eof){
                // Read the lines from the file, until an empty line is found [now as a remark].
                ln = myFileIn.readln()
                // if(ln !='' && ln!='\n'){
                   // Call the function supplied as argument
                   callbackFn(ln);
                // }
            }
        }catch(e){
            alert(e);
            gCancel = true;
        }
        finally{
            myFileIn.close();
        }
    }
    

    The file in C:\ in my example was recorded in UTF-8 format and looks like this (showing hidden characters):

    Post edited by: Andreas Jansson

Maybe you are looking for

  • Want Sleekbook m6: Beats Audio Control Panel disappeared after the update of the 10 anniversary window

    Hello. After upgrading my OS Windows Anniersary Update 10 last week, my Beats Audio Control Panel disappeared. The audio is not yet, but the EQ settings I had set by beats do not seem effective. The IDT drivers seem to be installed and updated accord

  • I forgot my password for administrator on NB520

    Help please... I bought the Mini NB520 lately, but since I use it for quite awhile I forgot my password (Administrator). Now I'm stuck... Is it possible to replace it even if I reinstall windows 7... I really disparate... Thank you

  • The missing compiler error output

    I hope it is a simple: When I compile a program and there are errors and/or mise put in custody, opens the window output to build, but the error messages are not listed!  All this shows, it is: Build status (MyProject.prj - Debug)MyModule.cBuild fail

  • How can I recover my 8.1 deleted Windows genuine

    Hello! I really need help! I would like to recover my real 8.1 windows purchased with my laptop. There is no information about my purchases on the box, no soap operas etc. Should I contact the seller? Where can I get an Acer support? Help me please!

  • How to set my color?

    Hi experts,I have a script:app.findObjectPreferences = null; app.findObjectPreferences.fillColor = "MARKUP"; app.changeObjectPreferences.fillColor = "Black"; app.changeObject(); app.findObjectPreferences = null; app.findObjectPreferences.strokeColor