creating a table of blocks of text [AS2]

Hello

I want to create a table of text blocks.

The code I use is.

for (c=0; c<5; c++) {
    tf = ("test_txt"+c.toString());
    this.createTextField(tf, 10, c*20, 80, 40, 20);
}

a = [test_txt0, test_txt1, test_txt2, test_txt3, test_txt4];

for (c=0; c<5; c++) {
    a[c].text = "foo " + c.toString();
    a[c].border = true;
    a[c].borderColor = 0x00FF00;
    a[c].textColor = 0x0000FF;
    a[c].size = 24;
}

The result I want from the code is 5 spead of frames of text on the stage, but only the last block of text is created.

Untitled-4.png

What is the right way to create the frames in a loop and then having accsesible in a table?

Thanks in advance

Trevor

The second argument of the createTextField method is the depth.  If you keep by specifying the same depth, you replace whatever you place there whenever you assign to something new at this depth.

Tags: Adobe Animate

Similar Questions

  • I created a pdf with blocks of text to fill out form. Is it possible to add a record button instead of having someone go to produce and record?

    I created a pdf with blocks of text to fill out form. Is it possible to add a record button instead of having someone go to produce and record?

    You can add a save button slot for your file, but not a button Save.

  • Problem of ball when creating tables and blocks of text in InDesign CS5

    Every time I have create a new text frame or a table in InDesign CS5 and paste information, the first row in the table or several lines of text out with chips. I don't know that it's a style at some point, I created and am now unsure how to remove or setting. I would like the new blocks of text and tables do not include by default when imported or pasted chips. Any thoughts? Thank you!

    Default values for the text in the current document are made with no selected text. Disable the chips and they should stay off (but check styles, also, you have perhaps accidentally set a style bulleted as the default and you must change the default style instead). If this is the case in all files, you must do with nothing open to reset the default for all new documents (existing files, must unfortunately be set one at a time).

  • 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

  • Anonymous blocks that goes down and creates a table

    Version: 11.2.0.3

    I'm relatively new to PL/SQL.

    We have a table named CHK_CNFG_DTL.

    I want to create a backup table for CHK_CNFG_DTL who will be named as CHK_CNFG_DTL_BKP_ < timestamp > for example: CHK_CNFG_DTL_BKP_JULY_22_2013

    Creating this backup table must be automated, so I want to create an anonymous block that will first remove the existing backup table and then create a new backup of the original table.

    The code below works fine. But the first time when you run it, the loop will not iterate because there is no such table named % CHK_CNFG_DTL_BKP.

    declare

    v_stmt varchar2 (1000);

    date of T_DATE;

    Start

    for rec in

    (select * from user_tables where table_name like '% CHK_CNFG_DTL_BKP')

    loop

    Start

    run immediately "alter session set nls_date_format =" DD_MON_YYYY "';"

    v_stmt: = 'drop table' | Rec.table_name | "purge."

    dbms_output.put_line (v_stmt);   -Old backup drops table

    immediately run v_stmt;

    Select sysdate in double T_DATE;

    v_stmt: = "create table CHK_CNFG_DTL_BKP_ | TO_DATE (V_DATE): ' in select * from CHK_CNFG_DTL';

    dbms_output.put_line ('Bkp création table CHK_CNFG_DTL_BKP_' | to_date (v_date));

    dbms_output.put_line (v_stmt);

    immediately run v_stmt;  -Creates the new table of backup

    exception

    while others

    then

    dbms_output. Put_line (rec.table_name |'-'|) SQLERRM);

    end;

    end loop;

    end;

    /

    PL/SQL procedure successfully completed.

    -Backup table was not created.

    SQL > select table_name from user_Tables where table_name like '% CHK_CNFG_DTL ';

    TABLE-NAME

    ------------------------------

    CHK_CNFG_DTL

    Of course, this can fixed by creating a table as bleow before running the anonymous block

    SQL > create table CHK_CNFG_DTL_BKP_JULY_22_2013 (x varchar2 (37));

    Table created.

    and now the block will be executed with success as

    24 end;

    25.

    drop table CHK_CNFG_DTL_BKP_JULY_22_2013 purge

    Creating table Bkp CHK_CNFG_DTL_BKP_22_JUL_2013

    create the table CHK_CNFG_DTL_BKP_22_JUL_2013 select * from CHK_CNFG_DTL

    PL/SQL procedure successfully completed.

    But it goes to production. We cannot have a table like CHK_CNFG_DTL_BKP_JULY_22_2013 without an appropriate reason.

    How can I change the code above so that if even if there is no such like '% CHK_CNFG_DTL_BKP' table, he will create the backup table?

    Hello

    Why don't you press the create backup of the loop?

    declare

    v_stmt varchar2 (1000);

    date of T_DATE;

    Start

    for rec in

    (select * from user_tables where table_name like 'CHK_CNFG_DTL_BKP %')

    loop

    Start

    run immediately "alter session set nls_date_format =" DD_MON_YYYY "';"

    v_stmt: = 'drop table' | Rec.table_name | "purge."

    dbms_output.put_line (v_stmt);   -Old backup drops table

    immediately run v_stmt;

    exception

    while others

    then

    dbms_output. Put_line (rec.table_name |'-'|) SQLERRM);

    end;

    end loop;

    Select sysdate in double T_DATE;

    v_stmt: = "create table CHK_CNFG_DTL_BKP_ | TO_DATE (V_DATE): ' in select * from CHK_CNFG_DTL';

    dbms_output.put_line ('Bkp création table CHK_CNFG_DTL_BKP_' | to_date (v_date));

    dbms_output.put_line (v_stmt);

    immediately run v_stmt;  -Creates the new table of backup

    end;

  • Addition of the new Image and text to an existing Page created with Tables

    Work in DW 5.5

    I try to add a new image/link and a small amount of text to an existing web page that was created with tables and centered.  I use AP div tags. One for the image and one for the text.  Everything works fine, but I can't get the new anchor points and to re - center with the rest of the page.  I'm not able to get around the "absolute positioning".  I tried different solutions of various tutorials but I can't make them work with tables.

    Added items are a Facebook button and text.

    Go to: http://www.sugarhollowfarms.NET/index.html See the problem.

    Help, please. I'm not that experienced.

    First, make a back up of the page before you implement the changes below!

    Take the bit of code below to

    and insert it directly after the opening tag div FWTableContainer and before your opening table tag (see location below):

    Then add - position: relative; -to the css of FWTableContainer (as shown below):

    {#FWTableContainer209091602}

    / * The div master to make sure that our contextual menus get properly aligned.  Be careful when you play with this one. */

    position: relative;

    margin: auto;

    Width: 800px;

    height: 600px;

    text-align: left;

    top: 20px;

    background-image: url(images/homepage_new3.jpg);

    border: medium solid #336600;

    position: relative;

    }

    Edit the css for FBlogo to as below:

    {#FBlogo}

    position: absolute;

    left: 700px;

    top: 380px;

    Width: 91px;

    z-index: 1;

    text-align: center;

    }

    Edit the css for bodytext as below:

    {.bodytext}

    do-family: Verdana, Arial, Helvetica, without serif.

    do-size: 11px;

    line-height: 13px;

    margin: 0;

    padding: 0;

    }

  • Overset text when you create a block of text to another object

    I apologize if this has been answered in other discussions, but the search function does not work now. I am trying to create a block of text on top a .pdf bound. I can create the block of text, but as soon as I enter the text, I get the text marker in excess on the frame, despite the fact that the frame is big enough to accommodate the text that I entered. This happens if I simply enter a single period.

    If I click on "mount the frame to the content" he develops vertically the text block until it is large enough to have a part that leaves at the edge of the linked .pdf below, and the text that I entered appears here. Of course, now, I have a block of text that is 20 times bigger that I need, and I still have no text in the position where it is needed.

    Here is a link to a screenshot:

    http://Tinypic.com/r/i3vqjs/7

    I'm still a newb on InDesign, and I hope that there is an easy solution to embarassingly on this point I should have, but any help is appreciated.

    Thank you

    You probably dressing applied on the structure with the PDF file. Either remove it, or open the options of text block for your frame on top and check the box to ignore the dressing.

  • Cannot create a new paragraph in a block of text

    User of Windows 7, 64-bit machine... ALienware i7 processer.

    I create blocks of text and you can type the first paragraph very well. When I type entry to add my second paragraph my cursor disappears. If I type it shows more red overset text.

    I checked my space, my paragraph spacing after...

    Tried many documents... PLEASE HELP ME

    Edition > shortcuts keyboard... and make a new set because you can't change the game by default.

    In the product box, select Menu Type and scroll to the bottom to insert a character to break: paragraph return and select it. Now, place the cursor in the new shortcut field and press enter on the numeric keypad. Context of you changing text, then click on assign, then OK.

  • In the book of Lightroom 4 module I would create a two pages with a text block

    I would like to use a photo as a crossover down the drainpipe. I don't see an option to include a block of text in such a provision. Am I missing something?

    I think that many of us were misled by Adobe of labelling of boxes as 'text' and 'legend' - at least, I was, at first.

    Options for text of the models aren't very versatile because their location or their size can be changed, as soon as it fill with text - that's all.

    The amazing - and unexpected-feature are legend, which in reality is the required text box area since

    (a) it adapts to the size for the amount of text - and the font size

    (b) the text can be moved in the box with the fill feature and

    (c) the box can be moved upwards or downwards with the cursor of the Offset.

    To make the legend box as it is versatile, you will need to uncheck in the Panel of the legend.

    WW

  • How to create a table with these dimensions?

    Still new in Indesign, but I need to create a table like the one below.

    Screen Shot 2015-03-10 at 2.31.25 AM.png


    Select the text tool, I created a block of text and then insert a table. However, I'm lost as to how to change the top line for the length of the two columns from the bottom.
    I looked at the options of panel paintings, but it only allows me to change the number of lines and columns.

    All advice is appreciated. Thank you.

    You must create a table with two rows and two columns.

    To select the first line and click "merge cells".

  • Divide the long text into multiple blocks of text by PARAGRAPH breaks, and not by line breaks

    I'm creating a catalog of the auction. Right now I have a long table in Word, where each line is an item in the catalog.

    I know how to place the table in InDesign and convert it to text so that each line is its own paragraph (click table > > convert table to text).

    Now, I want to run a script so that each paragraph becomes its own text box.

    I tried to use the script of Jongware mentioned on this thread (https://forums.adobe.com/thread/652308), but it breaks to the top of each LINE in its own text box, not each paragraph.

    Previously, a solution that worked for me is to manually adjust the text boxes until each paragraph is in a separate box, then use the SplitStory script to remove all the. However, the catalog has over 100 articles in there it is time consuming. Is there a way to separate each paragraph into its own text box automatically?

    Well, I guess you can set up a master page with two frames of text related to this topic.

    To keep Options (see above), choose 'Start in the new framework' rather than 'new page '.

    Create a page in the document and apply the master page.

    Then follow the first set of instructions, I gave above. For autoflowing, click inside the box of one of the blocks of text on the master page (I mean, do it on a regular page that has the master page applied; the text block should appear with a dashed line, because it is on the master page). Now, all text should flow between these two images, two images per page which gives you 1 point in each image.

  • Adding pages and blocks of text to emulate the behavior of "Smart Text Reflow"

    I create a large number of tables in a document.  If I'm Smart Text reflow on, my script is malfunctioning.  I have the start of treatment:

    1. Add a new table

    2. If the last block of text of page overflowing and then add a new page

    With smartTextReflow off, I want to assure that the executives of new blocks of text which corresponding to the main text of the page master.  It must be able to manage to get the settings from the page of left/right text block.

    I have solved my problem.  I was overthinking things!

    Given that I have selected blocks of text on master pages as the main text blocks, when you create a new page, a block of text is automatically created. So the problem is then simply connect the block preceding text for the text block that was created when the page is added.

    TableAutomation.prototype.AddPage = function() {
         var previousTextFrame = app.activeDocument.pages[-2].textFrames[0];
         var np = app.activeDocument.pages.add();
         var textFrame = np.textFrames[0];
         previousTextFrame.nextTextFrame = textFrame;
    };
    

    The cost of the above code was about 5 hours of banging my head against the wall

  • 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

  • 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

  • Paragraph split into multiple blocks of text

    Hello world

    Was wondering if you guys could help out me. I am trying to automate the process of taking each line of a paragraph (separated by newlines) forced and in him giving his own framework text, so that I can move them independently. This is best illustrated in the attached screenshot.

    Screen shot 2010-06-03 at 17.59.50.png

    Do you think this is possible via a script?

    Thank you in advance!

    Lewis

    Post edited by: GD_lewis

    Well, this image has helped a lot in providing the context!

    It works for you? Select a number of words; These will separate from its normal spaces (I use a slightly different GREP, hope it's inconsequential), then settled in the frameworks of their own alongside the current text frame.

    Then it creates a new block of text and insert the numbers of the Lotto tomorrow... oh, wait, I'm still working on that.

    Don't try this with running inside a table, or a note or really anything more complicated than a simple text frame. He's probably going to do something but I don't know what.

    if (app.selection.length == 1 && app.selection[0].hasOwnProperty("baseline") && app.selection[0].length > 1)
    {
     app.selection[0].insertionPoints[0].contents = "\r";
     app.selection[0].insertionPoints[-1].contents = "\r";
     app.findGrepPreferences = null;
     app.changeGrepPreferences = null;
     app.findGrepPreferences.findWhat = " +";
     app.changeGrepPreferences.changeTo = "\\r";
     app.selection[0].changeGrep();
     p = app.selection[0].parentTextFrames[0];
     lh = (p.lines[-1].baseline - p.lines[0].baseline) / (p.lines.length-1);
     top = app.selection[0].lines[0].baseline - lh;
     while (app.selection[0].length > 0)
     {
      f = app.activeDocument.layoutWindows[0].activePage.textFrames.add ({geometricBounds:[top, p.geometricBounds[3]+2*lh, top+lh, 2*(lh+p.geometricBounds[3])-p.geometricBounds[1] ]});
      app.selection[0].lines[0].move (LocationOptions.AFTER, f.texts[0]);
      top += lh;
     }
     app.selection[0].insertionPoints[-1].contents = "";
    } else
     alert ("please select some text to shred");
    

Maybe you are looking for

  • App crashes

    Hi, I have the latest software updates and I've tried the app from closing a reset and hard reset but it is not worked because I still cannot enter my 'contacts' icon / app as it crashes immediately.  It just started happening this morning and has ne

  • Download again the setup of Yosemite?

    Download again the setup of Yosemite? Double click on the Yosemite install (or Mavericks) results in: The choice of re - install brings another error: ERROR: This is not the right way to reinstall Yosemite. Use the installation program that you downl

  • executable of the limit of one heart

    Maybe I just missed it in my search of the forums, but I was curious to know if anyone knows how to limit an executable to a single core on a multicore LV computer?  Currently, when I try to do slow-motion at high speed of data stored, I can sometime

  • Thread SMS won't erase?

    Tried to delete a text message thread and it will not remove goes right down and the date says December 1969 can anyone help? Thank you

  • (Redirected) Monitor S2440L

    I have owned a XPS8500 with S2440L Analyzer. Lately, my monitor has develop a foggy screen inside the screen. The foggy appear in tasks.  The fog behind the glass screen disappear after a certain time, but it has more and more often. What are the cau