Title of table Script

Hello

I am new to scripting indesign and use javascript / extendscript.   I paginate a document and get an array of all the tables in the paginated document using

var myTables = myDoc.stories.everyItem ().tables.everyItem () .getElements ();

I then walk through them in a loop a conditionally applying a block of code.

I need to do a little smarter and to apply different blocks of code based on the name of script.  I would like to be able to:

if(mytables[i].label=="1") {... do this code...}

Else if(myTables[i].label=="2") {... do this code...}

The problem is that I can assign a script for the table heading is found in the block of text, but not the table itself, it seems.  If that is correct, is there an easy way for me to get title of the tables the array element text frame script (I'm currently sitting on my myTables loop [i])?

Please speak slowly, or it is likely to fly right by me

Thank you

David

In fact, you CAN assign a script label to a table, either in a script or in the InDesign UI.  User interface methods are probably a little obscure... for example see http://www.peachpit.com/articles/article.aspx?p=415190&seqNum=13 for a description.

Tags: InDesign

Similar Questions

  • FDM 11.1.2.1 mapping table scripts does not accept as vba functions ' lef

    OK, in fdm 11.1.2.1 in the UD2 of IMPORTS column, I have something like "award::purpose:type" and in the mapping table script, I try to use the 'left' and 'middle' works to break the UD2 columns (delimited by ': '), then the mapping to a result to VALIDATE.

    Why simple VBA functions do not work in mapping scripts (where you have '#Script' in the column 'target Custom2')

    to simplify things, I would like the following to work (and it errors on the first line to the "left" function)
    ##########################################
    One_Award = Left (varvalues (21), 5)
    Result = One_Award
    ##########################################

    Thank you.

    Published by: 866191 on June 26, 2012 08:15

    VarValues (21) always contains the empty string values. This could be the cause of your problem. If findCol1 is set to-1, that this will cause the error you get.

  • get the table script using dbms_metadata.get_ddl but with clob field

    Thus, Oracle 11g R2...
    I use dbms_metadata.get_ddl for table scripts and it works fine...

    now, I have a table with clob field, and it does not work... I got an error "missing a closing parenthesis (ora-0907) '...
    I could paste a script I had, but I don't think that it makes no sense...

    does anyone have an experience on the use of this package on clob tables?


    TNX

    See this code.

    DECLARE
      myddl clob;
      PROCEDURE print_clob(p_clob in clob) as
        l_offset number default 1;
      BEGIN
        loop
          exit when l_offset > dbms_lob.getlength(p_clob);
          dbms_output.put_line(dbms_lob.substr(p_clob, 255, l_offset));
          l_offset := l_offset + 255;
        end loop;
      END print_clob;
      FUNCTION get_metadata return clob is
        h   number;
        th  number;
        doc clob;
      BEGIN
        h := dbms_metadata.open('TABLE');
        dbms_metadata.set_filter(h, 'SCHEMA', 'HR');
        dbms_metadata.set_filter(h, 'NAME', 'EMPLOYEES');
        th := dbms_metadata.add_transform(h, 'MODIFY');
        th := dbms_metadata.add_transform(h, 'DDL');
        --dbms_metadata.set_transform_param(th,'SEGMENT_ATTRIBUTES',false);
        doc := dbms_metadata.fetch_clob(h);
        dbms_metadata.CLOSE(h);
        return doc;
      END get_metadata;
    BEGIN
      myddl := get_metadata;
      print_clob(myddl);
    END;
    

    This procedure of print_ddl I took of the documentation.
    Use of the long VALUE. See, in the first example out put is truncated.

    SQL> SELECT dbms_metadata.get_ddl('TABLE','EMP','SCOTT') FROM dual;
    
    DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
    --------------------------------------------------------------------------------
    
      CREATE TABLE "SCOTT"."EMP"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
    
    SQL> set long 10000
    SQL> /
    
    DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
    --------------------------------------------------------------------------------
    
      CREATE TABLE "SCOTT"."EMP"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
            "JOB" VARCHAR2(9),
            "MGR" NUMBER(4,0),
            "HIREDATE" DATE,
            "SAL" NUMBER(7,2),
            "COMM" NUMBER(7,2),
            "DEPTNO" NUMBER(2,0),
             CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
    
    DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
    --------------------------------------------------------------------------------
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"  ENABLE,
             CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
              REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    
    SQL> SET LINESIZE 132
    SQL> SET pagesize 0
    SQL> SET LONG 1000000
    SQL> /
    
      CREATE TABLE "SCOTT"."EMP"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
            "JOB" VARCHAR2(9),
            "MGR" NUMBER(4,0),
            "HIREDATE" DATE,
            "SAL" NUMBER(7,2),
            "COMM" NUMBER(7,2),
            "DEPTNO" NUMBER(2,0),
             CONSTRAINT "PK_EMP" PRIMARY KEY ("EMPNO")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"  ENABLE,
             CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
              REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    
    SQL>
    
  • How to set different fonts for numbers in the titles and tables of contents

    Hello

    I noticed some people to use a different font for the numbers in the titles and tables of contents to get an extra magic. Is it possible to automate the use of fonts in paragraph styles?

    Oh and suggestions on which fonts would be a good thing for numbers?

    Thank you!

    Furthermore, you must doany of this fancy stuff if you use an OpenType font that made OSF glyphs (and if you are not you will need to set the font as part of your style). Just head on to the style definition and enable OSF there OpenType features section.

  • Table scripts

    Deal all,
    Is it possible to recover the table scripts created in a schema?

    Thanks for reading this post
    * 009 *.

    Hello

    Watch dbms_metadata.get_ddl

    Example:

    SQL> select dbms_metadata.get_ddl('TABLE', 'EMP', 'SCOTT') from dual
    
    DBMS_METADATA.GET_DDL('TABLE','EMP','SCOTT')
    --------------------------------------------------------------------------------
    
      CREATE TABLE "SCOTT"."EMP"
       (     "EMPNO" NUMBER(4,0) NOT NULL ENABLE,
         "ENAME" VARCHAR2(10),
         "JOB" VARCHAR2(9),
         "MGR" NUMBER(4,0),
         "HIREDATE" DATE,
         "SAL" NUMBER(7,2),
         "COMM" NUMBER(7,2),
         "DEPTNO" NUMBER(2,0)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"                                                            
    
    1 row selected.
    

    Concerning
    Peter

  • Concatenation FDM Import Table script

    Hi all

    First post here, so let me know if I'm making mistakes or leaving out critical information.  I'm trying to use FDM for importing a pipe delimited text file, use the mapping feature, and then export the new data to a .txt file.  The problem is that the entity on the finished side dimension must be a concatenation of the fields of the entity and the division.  What I tried to do is to write a script for the field of the entity on the tables import screen.

    Function Div_Ent_Comb (lngCatKey, dblPerKey, strLoc, strWorkTableName)

    '------------------------------------------------------------------

    "Integration oracle Hyperion FDM IMPORT script:

    '

    "Created by: cwinslow"

    "Creation date: 2014-10-09 15:34:39.

    '

    ' Object:

    '

    '------------------------------------------------------------------

    'Set variables '.

    Dim strCombination As String

    Dim strDivision As String

    Dim strEntity As String

    ' set where the combo will go

    strCombination = Trim (DW. Utilities.fParseString(strRecord, 29, 8, "|"))

    "Store column 7 of 11 of a delimited file

    strDivision = Trim (DW. Utilities.fParseString(strRecord, 29, 5, "|"))

    "To store the column 8 of the 11 of a delimited file

    strEntity = Trim (DW. Utilities.fParseString(strRecord, 29, 8, "|"))

    strCombination = strDivision & strEntity

    End If

    End Function

    Error when importing is as follows:

    Error: An error occurred importing the file.

    Detail: Object Variable or With block variable not set

    What I want to happen is when I import the file, is for the entity column show the result of the concatenation before going through the validation part.

    If you're just trying to concatenate two fields to use as a source for a mapping for the entity dimension, there is a much easier way to do this without script. In your import format to create two entries for the target dimension i.e. entity. The first line contains a reference to the field of the entity of your source (data field 8 of 29), the 2nd line will contain the reference to the field of the Division of your source (data field 5 of 29). If you do this FDM will automatically concatenate the 2 fields together for you.

  • How the County table script Fund?

    Hi all

    11.2.0.3

    I want to generate the list of counties of table in this format:

    table-nameCounty
    COUNTRY100
    DEPT10
    EMP1000
    JOBS50
    JOB_HISTORY100
    LOCATIONS200
    REGIONS300

    Can you help me the sql statement please.

    Thank you

    pK

    Hello

    Petra-K wrote:

    Hi all

    11.2.0.3

    I want to generate the list of counties of table in this format:

    table-name County
    COUNTRY 100
    DEPT 10
    EMP 1000
    JOBS 50
    JOB_HISTORY 100
    LOCATIONS 200
    REGIONS 300

    Can you help me with the script please.

    Thank you

    pK

    These numbers are the number of rows in each table (in other words, the 'SELECT COUNT (*) FROM countries' output would be 100)?

    If so, and if you're happy with an account may be estimated from the last time statistics were gathered, you can do something like this:

    SELECT table_name
    num_rows
    From all_tables
    Owner WHERE = 'SCOTT '.

    ;

    If you want the exact number at run time, you need dynamic SQL statements.  Here's a way to do it:

    SELECT table_name

    , EXTRACTVALUE (XMLTYPE (dbms_xmlgen.getxml (' SELECT COUNT (*) AS num ")))

    || 'FROM ' | owner | '.' || table-name

    )

    )

    , ' / LINES/LINES/NUM.

    ) AS num_rows

    From all_tables

    Owner WHERE = 'SCOTT '.

    ;

    Whatever it is, you get results like:

    TABLE_NAME, NUM_ROWS

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

    DEPT                                    4

    EMP                                    14

    BONUS                                   0

    SALGRADE 5

  • SQL authentication provider - create table script

    Hi all!
    I would use the SQL provider for my Web application authentication. I can't find the script to create tables of users/roles used by the provider.
    Can you suggest me a link where I can download?
    Thank you
    Frank

    Hi Frank,.

    Configure the SQL authenticator:

    Start Oracle XE DB and open propmt SQL to run commands below:

    CREATE TABLE USERS)
    U_NAME VARCHAR (200) NOT NULL,
    U_PASSWORD VARCHAR (50) NOT NULL,
    U_DESCRIPTION VARCHAR (1000))
    ;
    ALTER TABLE USERS
    ADD CONSTRAINT PK_USERS
    PRIMARY KEY (U_NAME)
    ;
    CREATE TABLE GROUPS)
    G_NAME VARCHAR (200) NOT NULL,
    G_DESCRIPTION VARCHAR (1000) NULL)
    ;
    ALTER TABLE GROUPS
    ADD CONSTRAINT PK_GROUPS
    PRIMARY KEY (G_NAME)
    ;
    CREATE TABLE GROUPMEMBERS)
    G_NAME VARCHAR (200) NOT NULL,
    G_MEMBER VARCHAR (200) NOT NULL)
    ;
    ALTER TABLE GROUPMEMBERS
    ADD CONSTRAINT PK_GROUPMEMS
    (PRIMARY KEY)
    G_NAME,
    G_MEMBER
    )
    ;
    ALTER TABLE GROUPMEMBERS
    ADD CONSTRAINT FK1_GROUPMEMBERS
    FOREIGN KEY (G_NAME)
    REFERENCE (G_NAME) GROUPS
    ON DELETE CASCADE

    Generally, customers can add users directly in DB with help commands below:

    insert into USERS (U_NAME, U_PASSWORD, U_DESCRIPTION) values ('system', 'weblogic', 'user admin');
    insert into GROUPS (G_NAME, G_DESCRIPTION) values ('Administrators', 'Administrators');
    insert into values('Administrators','system') GROUPMEMBERS (G_NAME, G_MEMBER);

    But in this case is not encrypted password then, either you can add users via the console or WLST script to be stored in encrypted form.

    We had performed above commands just to check that the user that is stored directly in the DB gets properly authenticated or not configured SQL authenticator as below

    Now start weblogic admin server and console access to create the data source by the navigation Services-> JDBC-> data sources

    Create the data source named SqlDS

    JNDI: SqlDS

    Type of DB: Oracle

    : DB driver Oracle Thin XA

    Name of the data base: XE

    DB host:

    Port: 1521

    DB user:

    DB password:

    Even the rest of the configuration and click test Configuration. If its success click on next and it targets to "AdminServer.

    Click Finish and activate chnages

    Now navigate to the areas of security-> myrealm-> suppliers

    Click new and supply the names of SqlAuthenticator and select Type of SQLAuthenticator

    Now click on newly created provider and make the indicator of control as "sufficient".

    Go to the specific page of provider:

    1. check on cleartext passwords enabled.

    2. provide a data name source: SqlDS

    Keep the rest of the parameters it is and save this configuration. It will ask you to restart the management server.

    Now, again navigate areas of security-myrealm-> users & groups >

    User created directly in the DB control is listed in the table with SqlAuthenticator, once its list, go ahead and add users as below

    B. Cretae users using the administration console:

    Sign in to the administration console

    Access areas of security-myrealm-> users & groups >

    Click the users tab and try to create the new user

    User name:

    Select authentication provider: SqlAuthenticator

    User password:

    Once the table DB check creating user, this user added with password encypted musted

    C. create multiple users using WLST script:

    File Navigave of $DOMAIN_HOME/bin and run the file setDomainEnv as below:

    UNIX:. ./setDomainEnv.sh (don't forget to put two points before /)

    Windows: setDomainEnv.cmd

    Now, change script depending on your environment below and run as suggested in step 3:

    Connect('weblogic','weblogic123','t3://localhost:7001')
    Edit()
    startEdit(-1,-1,'false')
    serverConfig()
    CD('/SecurityConfiguration/base_domain/Realms/MYREALM/AuthenticationProviders')
    ls()
    CD ('SqlAuthenticator')
    cmo.createUser ('vaishali', 'weblogic123', 'SQLuser')

    cmo.createUser ('pavashe', 'weblogic123', 'SQLuser')
    Edit()
    stopEdit('y')

    NOTE: Change username, password, and ADMIN_URL in 1st line.

    Replace the domain name "base_domain" by your domain online no.: 5

    Authenticator name change SQL online no: 6 by your authenticator name

    Next lines create users. You need to add however to users, you need to create programmatically.

    Syntax: cmo.createUser ('user_name', 'user_password', 'user_description')

    Now, to save these commands in a file with the extension .py and run as below:

    # java weblogic. WLST create_user.py

    If your script does not have to try running each command separately. For this session WLST beginning as below:

    # java weblogic. WLST

    Now run above commands in the script. You will be able to debug if something went wrong during execution of script.

    Kind regards
    Kal

  • [CS 5.5] [JS] Table script Split

    Hello

    Based on a method of line selection that I found on this forum, I created a basic split script table. Everything works fine. The script will create a new table above the old table and move all the content over the cell the curcor where, in the new table.

    Now, I would like to change the script to create a new table below the current table and move all content below the current position to the new table. The problem is the insertion point. How to create a new table after the current?

    Thanks for any comments.

    If (app.documents.length > 0) {}

    var myOldTable = app.selection [0].parent.parent;

    var myOldTablePosition = myOldTable.storyOffset; PointInsertion

    var myTextFrame = app.selection [0].parent.parent.parent;

    MyCell var = app.selection [0] .parent;

    var currentRowIndex = myCell.rows [0] .index;

    var totalNumOfColumns = myCell.rows [0].columns.length;

    var totalNumOfRows = myOldTable.rows.length;

    myNewTable = myOldTablePosition.tables.add ({columnCount:totalNumOfColumns, bodyRowCount:currentRowIndex});})

    selectRows (myOldTable, 1, currentRowIndex);

    App.Cut ();

    selectRows (myNewTable, 1, 1);

    App.Paste ();

    } else {}

    Alert ("Indesign file must be opened!");

    }

    function selectRows (Àtable, startRowIndex, endRowIndex) {}

    App.Selection = NothingEnum.NOTHING;

    var _row = aTable.rows;

    App.Select (_row [StartRowIndex-1]);

    for (var i = startRowIndex; i < endRowIndex; i ++) {}

    App.Select (_row [i], SelectionOptions.ADD_TO);

    }

    }

    ...

    The problem is the insertion point. How to create a new table after the current?
    ...

    var myNewTablePosition = myTextFrame.insertionPoints.nextItem (myOldTablePosition);

    It is the first PointInsertion after Ancienne_table.

    You must also replace:

    -Add a new table using myNewTablePosition;

    -call function selectRows (Àtable, startRowIndex, endRowIndex) use currentRowIndex to start... and -1 for endRowIndex.

    Rgds

  • Table script

    Hi, the problem goes like this:

    I have a lot of tables formatted in different ways in an Indesign 5 (Windows) file. They were built without tables and Cell Styles. Each is different from the other. I have imported equivalent tables of the word of no style, same number of lines and columns.

    Is anyone know about a script (or something of Indesign) is able to copy the content of text in a table and put its content into another table without messing up the formatting of the first table?

    I have, do the following: I select the text that is inside the second table, copy it to the Clipboard. After that I put the cursor in the first cell of the first table, select all of the cells and the past. But the formatting is changed (borders, already, fonts, etc.). What I want is just to paste the text without messing with the formatting.

    Thank you in advance,

    Maria

    Try to select your second table and Table > convert table to text and accept the default values (tabs).

    Then select your converted table and the copy. Select the region of destination of the cells in the first table and Edition > paste without formatting.

  • The document title Split String Script into an If identified

    Hello

    I have a console script that will extract the file title extension in the document properties:

    firstWord = this.info.Title.split("."); FirstWord = Event.Value [1];

    The example document title is: DWGTest.idw

    After the script is run from the console of the file extension is displayed correctly as: idw

    I now need to integrate the script with an if statement, and then perform an action.

    However, after you run the script I get a syntax error.

    Please can someone tell how can I modify the script works correctly?

    If the title in the properties of the document contains the file extension idw can create a signature field

    firstWord = this.info.Title.split("."); FirstWord = Event.Value [1];

    If (firstWord is "SDI")

    {

    var this.numPages = NUMPAGES;

    for (var i = 0; i < numpages; i ++)

    var a = this.addField ("Chk R1", "signature", 0,

    ([1093, 119.5, 1054.5, 136,5]) ;

    }

    Any help will be most appreciated.

    Thank you.

    Try to simplify it a little bit. This code tries to add a field of signature several times in the same place on the first page, assuming that there are several pages, and the rect does not seem right.

    var firstWord = info.Title.split(".")[1];
    
    if (firstWord === "idw") {
        addField("Chk R1", "signature", 0, [54.4, 136.5, 93, 119.5]);
    }
    

    Note that I changed the boundaries of the field (left and right) to try to ensure that the scope should be placed on the page. What is the width and height of your pages? The rect values can be read as "left side, top, right, bottom", with the origin (point 0,0) being the lower-left corner of the page. The values are in points and there are 72 points per inch.

  • Can any share reports Oracle Developer 6i demo table scripts?

    Hello

    I have to learn the 6i to report to my office project, I installed developer 6i report but I couldn't the demo CD, can any share the table creation Scripts (i.e., Stock, stock_history, indcat) and also the insertion of scripts for the population of data or provide the URL where I can find the same.

    thanking you in advance.

    Kind regards
    Sham.

    Hello

    Download the ZIP file and open it. In win32\pmbf\6_0_8_8\admin, there is a script demo60.sql

    This script creates tables STOCKS, INDCAT...

    Concerning

  • Insert table scripts are stored in an oracle table?

    Hello world!

    Are the scripts insert to a table that is stored in an oracle table?
    I mean, as in Toad, we do a right click on the table and create scripts insert for all lines. So can I directly go to this table (if they're stored anywhere) and look!


    Thank you

    NO, there is no place where that is stored. What the TOAD is to generate them on the fly, as it did for GVR.

    Imagine store each insert statement for each table in the database, which take a lot of space.

  • Reversal of the direction of the table - script

    Hi all

    I have a series of large Arab documents where I need to reverse the direction of the table to RTL. I cobbled together the following:

    var a = app.activeDocument.textFrames.everyItem ().tables.everyItem () .getElements ();

    for (var i = a.length - 1; i > 0; i-) {}

    a [i] .tableDirection = TableDirectionOptions.RIGHT_TO_LEFT_DIRECTION;

    }

    It seems to work but is not catching all the tables - what I left out?

    And should not be "I > = 0?

  • The script title?

    I saved my script and my project, but my script still Untitled. What Miss me?

    http://screencast.com/t/cH7i1vEn4IUQ

    Found it... it's all just not where you would think. A little awkward.

    Click on the small arrow icon next to the title of the script for a small menu on which is the ability to rename the script. Yay!

Maybe you are looking for