find a block of text on the page with the name of script

Hi all

I need to create a script for

find a block of text on the page with the script titled "xxx".

and read its contents into a variable.

The content of the text block is a number.

Thank you

Hello Roberto,

Welcome to the forum,

This is the textFrame marked on the current page.

var myLabel = "Foo", // change to label
      myPage = app.properties.activeWindow && app.activeWindow.activePage,
      myTextFrames = myPage.textFrames.everyItem().getElements().slice(0),
      l = myTextFrames.length,
      myVariable

while (l--) {
    if (myTextFrames[l].label != myLabel) continue;
    myVariable = myTextFrames[l].contents;
    break; // presuming there's only one "Foo" labeled frame on the page
    // Otherwise you'll nead an array
    }

alert(myVariable)

Trevor

Tags: InDesign

Similar Questions

  • Blocks of text on the Pages of body 'Buried' after update of the Page Master

    I have a background full screen on my main page (on the left in this case) that integrates static graphics and borders for certain master pages. I use the borders/boxes for NOTE and END of text on some pages. Blocks of text on these master pages do not overlap. I added text blocks with my icons and the text of the note to these body Pages that I need them. All great so far.

    I decided to update the background chart on page master to change colors, etc.. All files are linked.

    Now, with funds master page updated, these pages where I added text blocks are 'buried' as on a sublayer. I checked that my Master Page background images are "sent back". I tried to wear my text boxes at the front on the Pages of my body, but they are still hidden. Interesting as the anchored frame (the icon), I attached to each NOTE or TIP point appears, but the text is not. Also, I can see and select the contours of the block... the text is hidden. If I drag the fame to another part of the document (for example, on top of another Master Page text frame sank, while the text is displayed.

    There is no image on the master page to the enclosed area. I wonder if that's what I need trouble. Just add a backstory (not attached flow)?

    Advice before I go and screw something else?

    It is what it is supposed to look like (1). Image (2) what I mean now.

    V7Page2.jpg

    V7Page.jpg

    Thanks Arnis,

    It was the property of skin! How simple... I didn't have on this subject.

    Solved!

    To answer you question, however... my approach for the construction of this new model was:

    1. I created a graph from bottom (full page) to contain the image of brand and imported/positioned.
    2. I placed the header and a footer frame and filled with content.
    3. I placed the blocks of text with streams (as a single stream in this document).

    I'm not dropping blocks of text for the content of the body... except for these tips and remarks. I don't want to use a workflow for this because I never know where they'll pop up and I want to be able to (position) specifically on each page. Is this a good approach?

    Yes, I'm aware of the continuous line down the block of text NOTE you mentioned. Originally, I had all the text within the limits. When I have updated master, all offbeat pages (only in blocks of text body page with notes/tips). I repositioned and they flow very well now.

    Thank you very much for your help continues with it. Why these problems always pop nitpciky - up to date - not when things are slow!

  • 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.

  • CS5 - most effective way to wire and independent streams of two blocks of text in the same document?

    Greetings...

    I am responsible for creating a 100-page instructor guide and I looking for a little guidance in the use of independent text blocks that thread the length of the document.  The idea behind the use of two columns, is that the first column (left) must be used for the notes 'instructor-only', advice, etc..  The second column (right) should be used for the text of the student guide.  Two columns (or blocks of text) would need to move independently of each other.  In other words, when the left column is filled with text placed on the page, the flow of additional text in the left column on page two, left column on page three, etc.  Same thing applies to the right column.  There is no link or thread of the text between the two columns on the same page.

    I tried to reproduce this in a two-column table format, however, the table row height is limited and overset text will not continue the table in the block of text on the next page.

    Thank you in advance for your help!

    Set up master page text frames.

    If you use facing pages, put on the student to the student and executive trainer instructor on master pages.

    Be very careful when your document is redéroule however. Take a look at this discussion, we had recently on the subject:

    http://forums.Adobe.com/message/3588735#3588735

    HTH,

    Substances

  • How to set remote spaced further icon to display more text for the name below?

    Windows 7 desktop has many icons with similar names. I want that name under the icon. How to set remote spaced further icon to display more text for the name below?

    Right-click on the desktop and select Personalize.

    Select the color of the window

    Select the appearance settings advanced.

    Select the drop down next to the element

    Go down and select icon spacing (Vertical)

    change spacing next to size according to the needs.

  • JS script to add custom text and the name of file to file info in the title of the document

    Would be very happy for any help with this one...

    JS script add custom text and the name of file to file info in the title of the document

    Thank you very much

    Super: O)

    I have a folder of say 50 images and I want to run a lot of JS script

    example in the title of the document: image Nr 81205

    custom text is 'image Nr' + '81205 file name.

    activeDocument.info.title ="Nr of pictures"+ decodeURI(activeDocument.name);

    This would be correct without seening the ext file

    Thank you very much

  • Help w. blocks of text in the Master Page

    Hello

    I need to do a simple task, but it seems impossible.

    I do a large number of documents of the same type and stlye. Lets say, something like a certificate or diploma. They all have the same design, and the only thing that is different in them is the text in 2 areas that each text a. say that if we follow the example of certificate on each card, I have to put in the same text two boxes - 'the name of the person' and 'date '. So I have to set a beautiful master page with 2 text boxes that I can fill in for each card. Given that design can change, I need to be able to move the positions of the boxes on the master page, after I filled out their. I have to be able to change the case, the police and other properties of text in each box. For example, I when I have done 1000 certificates and filled respectively 1000 names and dates of receipt and then I decide that I must place the box with the name on a different position on the page and also to change the properties of the text, as Times New Roman to the Georgia. And to do it from the master page or another effective way without changing each certificate.

    So far I managed to place the boxes on the master page, and I saw that I can replace the text in each certificate and always be able to move the position of all the boxes on the master page. But I can't find a way to change the properties of text boxes.

    Thank you very much for your help!

    The trick is to not move the text block on the page of the document, or you need to move each one individually. If you want to move them all, move on the master page. If it's just a few, you need to move those appearing on the document pages and lose the connection to the master page.

    And you need to use styles if you want to make a change that will change everything. A paragraph style should do, unless you want different text within a paragraph attributes. In this case, apply styles of character for different pieces. And substitute styles locally.

  • Blocks of text on the Master Pages with CS3?

    I produce a catalog in CS3 on my Mac using OS Mavericks.

    I put in place of master pages with square 6 graphic blocks on each page. Each of them has a CAPTION below, in which I put up as a block of text. I clicked on "Apply Master pages", but when I go to the blocks of text pages are not displayed to the top. The only way I can enter captions on pages is by creating new blocks of text, 6 on each page, which is very tedious and time consuming. What I am doing wrong?

    Thank you.

    Welll...

    As bob says it is not Quark where you can just click to type in a main frame, but you CAN Cmd + Shift + click to override the main chassis and type in it. You might be better off, however, with a framework prédimensionnée and style in a library that you can drag onto the page and position. My feeling on frameworks masters get substitution is that they probably shouldn't be on the master page at all.

  • Can't add placeholder text data merge for all blocks of text on the document

    I'm trying to put together a script that loops if all pages in an indesign file, search all text frames label caption1, caption2, caption3... (whenever you get to a new page, the number of text images label starts again from 1) and add a placeholder in the text data fusion: caption1, caption2, caption3... but this time, when you get to a new page the number continues to go... caption4, caption5 and so on.

    Page 1 - image text = caption1 = tag > data merge placeholder = < < caption1 > >

    Page 1 - image text = caption2 = tag > data merge placeholder = < < caption2 > >

    Page 1 - image text = caption3 = tag > data merge placeholder = < < caption3 > >

    page 2 - text = caption1 = image tag > data merge placeholder = < < caption4 > >

    page 2 - image text = caption2 = tag > data merge placeholder = < < caption5 > >

    Currently, the script is adding placeholder text merge data only for the two text frames first (out of 6) on a page (about 8 pages) and just the first image of text on the page two (out of 3)

    Any help will be greatly appreciated

    Here's the script:

    myDocument var = app.activeDocument;

    -SOURCE DATA CALLS FUSION

    main();

    main() {} function

    myDataSource var = File.openDialog ("Please select a datamerge source", "text files: * .txt");

    If (myDataSource! = null) {}

    myDocument.dataMergeProperties.selectDataSource (myDataSource);

    myDocument.dataMergeProperties.dataMergePreferences.recordsPerPage = RecordsPerPage.MULTIPLE_RECORD;

    }

    }

    -MERGE OF DATA FIELD

    function get_field (captionString, myDocument) {}

    fields var = myDocument.dataMergeProperties.dataMergeFields;

    for (var f = 0, l = fields.length; e < l; f ++) {}

    If (fields [f] .fieldName == captionString) {}

    Returns the fields [f];

    }

    }

    Alert ("error: did not find all the fields with the name" + field_name);

    }

    THE TEXT - ADD PLACEHOLDER DATA MERGE

    var countFrames = 1;

    for (i = 0; i < myDocument.pages.length; i ++) {/ / TOTAL NUMBER OF PAGES in the DOCUMENT}

    var capPerPage = 1;

    for (x = 0; x < myDocument.pages [i].textFrames.length; x ++) {//COUNT TEXT TOTAL IMAGES PER PAGE

    If (myDocument.pages [i] .textFrames [x] .label < 0) {}

    Alert ('can not find any image caption');

    } ElseIf (.textFrames [x] myDocument.pages [i] .label == 'caption' + capPerPage) {//IF IT IS A TEXT LABEL of IMAGE 'caption1' EXECUTE

    var captionString = "caption" + countFrames;

    var myTextFrame = myDocument.pages [i] .textFrames [x];

    var myDataMergeProperties = myDocument.dataMergeProperties;

    var myTextFrame.parentStory = monarticle;

    var myStoryOffset = myTextFrame.parentStory.insertionPoints [-1];

    var myNamePlaceHolder = myDocument.dataMergeTextPlaceholders.add (monarticle, myStoryOffset, get_field (captionString, myDocument)); ADD DATA FUSION TEXT HOLDER TO THE TEXT BLOCK

    countFrames ++; INCREASE THE NUMBER TO ADD DATA FUSION TEXT PLACEHOLDER FOR THE NEXT BLOCK OF TEXT

    capPerPage ++;

    }

    }

    }

    Hello

    To verify this change (replace for...) loop)

    var countFrames= 0, currLabel, capPerPage;
    
    for (i=0; i
    

    Notice countFrames starts at 0.

    Jarek

  • 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

  • How can I move a block of text from the head of <>tag area within the &lt; body &gt; tag box?

    I am retarget approximately 2500 html files and a block of text should be moved to the head of <>mark the surface of the < body > tag. It must immediately follow the < body > tag. Here is an example: < h3 > heading < / h3 > < p > A bunch of text here, blah blah < /p >.  I find the block using a regular expression < >(.*?) < p > h3, but do not know what to do after that.

    If you just want to move the

    and

    on theand in thethe following regular expression work:

    (

    [\s\S]*?

    )([\s\S]*))

    Replace in the field, use this:

    $2$ 1

  • Second block of text during the first

    I have a doc who, for some reason, has a new block of text layered on top of one.  Typing goes into the new framework and I can't change the original text.  I can delete the new framework to obtain the actual text, but it happened on all pages of the doc.

    My question is, where it comes from?  I didn't add it, and it was not there a month ago.  I have rename the stream and the new framework is called flow of A, which is the default value and which should not exist anymore.

    What gives?

    Docs framework must have a stream called default 'A' - even if delete you or rename, the next time that FM open the doc it will create the flow of 'A' and plunk on the pages of body, always above any other flow, using a 'frame size to default text flow.

    In some docs to the unusual requirements (aviation manuals) I've resized the frame of 'A' on the master pages to be, say, 1 "x 1" and moved to the outside corner of right-to-left page and then created named needed additional streams. I then use flow one as a container for the markers that were later taken over by interpolations to dynamically fill created lists of markers or headers/footers body - the applicable page.

    Sheila

  • Blocks of text in master pages

    I put a block of text or any other image on a master page and it will appear on all normal pages. However I can't use any of these images on normal pages, such as putting the text in them or a picture. I need to create a text block and others on all normal pages each time. I tried clicking on the master text frame in the new Document menu, but it makes no difference. What is the point of putting images on a master page if they cannot subsequently be used? They are intended just to display things like page numbers or chapter heads? I must admit that I am new to ID of Quark.

    On the 'normal' page, to release a master page item, you click on it with the black arrow while pressing Ctrl + Shift (Mac: Cmd + Shift).

    You can now add text to the text frame.

    The advantage of this is that if you change the position or size etc. of the text frame on the master page, all of these images on normal pages will change as well in the same way.

    If, however, you add text to the image on the master page, then all the blocks on normal pages you have overridden and text added to manually will not change.

    Ariel

  • Way to block hours texts outside the list of contacts in the end?

    I keep getting texts at 02:00 in the spam that wake me up. always a different number of front.

    There must be an easy way to block all texts apart from my list of contacts during certain hours? I can't be the only one to experience this.

    Hello

    Drag to the top of the control panel culminating point halfmoon homescreen that donot disturb

    Put it on every night.

    See you soon

    Brian

  • Align the planning of block of text to the width of the screen

    I want to show the text and some menu items perfectly aligned in the upper part of a wide screen.

    There is an example of what I mean at the top of this message compose the page with bread at the top left and the menu at the top right. In the case of the page I see the guy on the left is much larger than the type on the right, so I want the baseline of the line upwards across the screen.

    It's pretty easy using CSS and Dreamweaver, but I can't figure out how to get the same effect on the edge of reflow.

    Not quite if I followed exactly your problem, so I tried three ways to show how to keep the text alignment bottom even when they are of different sizes. I have the Margin, Padding and line height. Check out the project attached reflow to see.

    Download the project: https://creative.adobe.com/file/0484eb2d-b3bc-431d-98a9-865d51cb448a

Maybe you are looking for

  • How stop the highlighting of search terms entered?

    With multicolored highlighting in the text in the results of the research is SO distracting. Please, someone tell me how I can turn it off.

  • Adobe Reader for Palm OS Tungston 5

    Anyone know why my keyboard sometimes when using Adobe Reader and don't go down when I press the arrow down?  The keyboard up and down in all other functions, as it should, but the arrow seems to be grayed out when ever I open Adobe.  I read a long d

  • Looking for drivers for Satellite A300 - 1-4 Ubuntu

    Hello I bought a new laptop A300 - 1 4 & I installed Ubuntu 7.10 OS on & my problem that some drivers were not working.So if anyone could help me by sending the Wirless Card & Lan drivers & generally all the appropriate drivers for Ubuntu I will be g

  • PID or something else?

    Hi all I have a control system of gas through a set of rooms.  The responses of the system is very slow at first, but then very fast and the PID is therefore not able to prevent a go-around.  I tried to adapt my system to use the Autotune PID or PID.

  • Manipulate the object in another QML file

    I have a drop down menu with some functions that modify sldiers Beach onTriggered: {} Slide1.toValue = 10 } It works fine, but when I move the piece that has the cursor in another qml file and include it like that... {MyInclude} } It stops working. S