Loop through the sequences selected using set of entry points into LabVIEW OI

Hi all

I have an operator Interface where the operator has the option to select specific measures and loop over the sequence selected according to the needs.

Everything works as expected, but the customer wants to remove the default loop configuration pop-up box.

Must be defined by programming the parameters of the loop (and not by the user). I figured out how to build arguments interactive but don't know how to spend it.

Any ideas / suggestions would be greatly appreciated.

Thanks in advance.

Kind regards

SS

UnspecifiedError wrote:

I am aware of this method and it works well, but the requirement is to run with the model process for example 'Test DUT' entry point

Use SequenceViewMgr.ExecutionEntryPoints to get the corresponding entry point object, and then use EntryPoint.LoopOnSelectedSteps ().

Hope this helps,

-Doug

Tags: NI Software

Similar Questions

  • To loop through the table and use the values returned in another query

    Hello

    I tried to do something very simple, but still can not.

    I am trying to iterate on a table and use each line of a column in a where clause to display a query clause.

    For example:

    I want to retrieve all users of dba_users pass it to a clause where clause in a query to show for example account_status and profile of each user. But I want to do it in a way if I can turn the result in an html table.

    I tried too much really, so I'll post something that does not work, but which I think will show the problem I have,

    BEGIN
     FOR i IN (SELECT username from dba_users order by 1)
     LOOP
     EXECUTE IMMEDIATE 'select account_status from dba_users where username like ''||i.username||''';
     END LOOP;
     END;
     /
    

    Example of what I want to achieve:

    Suppose that there are two users, SYS, and SCOTT:

    USERNAME                       PROFILE                        ACCOUNT_STATUS
    ------------------------------ ------------------------------ --------------------------------
    SYS                            DEFAULT                        OPEN
    
    
    USERNAME                       PROFILE                        ACCOUNT_STATUS
    ------------------------------ ------------------------------ --------------------------------
    SCOTT                            DEFAULT                        OPEN
    

    Thanks in advance for your time,

    OD

    Hi Bill,

    Bill Citad kirjoitti:

    What a join or a sub query going to help me? honestly

    -- join
    select
      s.sql_id,
      h.loads_total
    from dba_hist_sqlstat h join v$sql s on (
      h.sql_id = s.sql_id
    )
    where rownum < 3
    ;
    
    -- subquery
    select
      sql_id,
      loads_total
    from dba_hist_sqlstat
    where sql_id in (
      select sql_id from v$sql where rownum < 3
    )
    ;
    
    -- correlated subquery
    select
      sql_id,
      loads_total
    from dba_hist_sqlstat
    where exists (
      select null from v$sql where sql_id = dba_hist_sqlstat.sql_id
    )
    and rownum < 3
    ;
    
    -- lateral inline view (12c)
    select
      s.sql_id,
      h.loads_total
    from dba_hist_sqlstat, lateral(
      select sql_id from v$sql where sql_id = h.sql_id
    ) s
    where rownum < 3
    ;
    
  • I want to loop through the data from two different tables using for loop where the query should be replaced at runtime, please help me

    I have the data into two table with the structure of similar column, I want to loop through the data in these two tables

    based on some condition and runtime that I want to put the query in loop for example, the example is given, please help me

    create table ab (a number, b varchar2 (20));

    Insert into ab

    Select rownum, rownum. "" sample "

    of the double

    connect by level < = 10

    create table bc (a number, b varchar2 (20));

    Insert into BC.

    Select rownum + 1, rownum + 1 | "" sample "

    of the double

    connect by level < = 10

    declare

    l_statement varchar2 (2000);

    Boolean bool;

    Start

    bool: = true;

    If it is true, then

    l_statement: =' select * ab ';

    on the other

    l_statement: =' select * from bc';

    end if

    I'm in execute immediate l_statement - something like that, but I don't know

    loop

    dbms_output.put_line (i.a);

    end loop;

    end;

    Something like that, but this isn't a peace of the code work.

    Try this and adapt according to your needs:

    declare

    l_statement varchar2 (2000);

    c SYS_REFCURSOR;

    l_a number;

    l_b varchar2 (20);

    Boolean bool;

    Start

    bool: = true;

    If it is true, then

    l_statement: = "select a, b, AB;

    on the other

    l_statement: = "select a, b from bc;

    end if;

    --

    Open c for l_statement;

    --

    loop

    extract the c in l_a, l_b;

    When the output c % notfound;

    dbms_output.put_line (l_a |') -' || l_b);

    end loop;

    close c;

    end;

    /

  • The analysis through the Multi selection of values in a PL/SQL procedure

    Greetings,

    This should be an easy one for either of you, experts of PL/SQL. I'm not, so I'm not sure how to code this upward.

    I have a Multi selection page element and am passing the value of it to a routine of PL/SQL as a parameter. I am able to use the value if I spend only a value of my procedure, so I work. But not with multiple values, I need the code in the procedure to loop through the values. How do I code that a period? The procedure is relatively short and is included below. p_cell is multivalued parameter.

    Oh Yes... Probably, you need to know this. The values are coming like this - 1-3:2-3:3 - 3:5:6

    In addition, values are the coordinates XY of a grid I have a picture on the page. The routine removes certain cells (1-3, etc.) of the grid. The grid is created using HTML, so I have to remove lines of HTML to remove a cell in the grid. Just in case this is useful.

    THX, Tony

    = = = = = = =

    create or replace
    procedure qcis_remove_grid_cell (p_id in NUMBERS, p_cell IN VARCHAR2) as
    number of V_POSITION;
    number of v_position_from_end;
    number of v_line_start;
    number of v_line_end;
    number of V_LENGTH;
    CLOB v_html;

    BEGIN

    BEGIN
    Select imagemap_html in the v_html of qcis_im_template_draft
    where header_id = p_id;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    v_html: = NULL;
    END;

    V_LENGTH: = length (v_html);
    V_POSITION: = INSTR (v_html, "alt =" "|") p_cell |' « ') ;
    v_position_from_end: = (v_length - v_position) *-1;
    v_line_start: = INSTR (v_html,' < area shape ', v_position_from_end)-1;
    v_line_end: = INSTR (v_html,'/ > ', v_position) + 2;
    v_html: = substr(v_html,1,v_line_start) | substr (v_html, v_line_end);

    UPDATE qcis_im_template_draft SET imagemap_html is WHERE header_id p_id = v_html;.

    END qcis_remove_grid_cell;

    Published by: hidden November 1, 2011 08:01

    Not sure, I understand your need, but it sounded like you must decrypt a string in a set of rows. If so, I will give you 2 ideas:
    1 function STRING_TO_TABLE: http://www.sloug.org/i/doc/api073.htm
    2. other resources (regular expression or XML): http://apex-at-work.blogspot.com/2011/05/two-ways-using-string-to-table-in-apex.html

  • loop through the layers defining the lock and visibility

    I need to loop through the layers in the active document and the value of the properties of the layer is false or true.  I tried to create a loop using a method 'for', but it doesn't seem to work. I have renounced the method 'for' because I kept running into a problem.  I have set all layers with these settings just the odd ones (2,4,6, etc.). Here is sample if it was written.

    myLayer = myDoc.layers var [2];

    myLayer.visible = false;

    myLayer.locked = true;

    myLayer = myDoc.layers var [4];

    myLayer.visible = false;

    myLayer.locked = true;

    myLayer = myDoc.layers var [6];

    myLayer.visible = false;

    myLayer.locked = true;

    myLayer = myDoc.layers var [8];

    myLayer.visible = false;

    myLayer.locked = true;

    I have 208 layers, so doing it this way would be way to long. Any help would be appreciated.

    Illustrator CC 2014 running.

    After I wrote this and tested, I saw that Carlos had already answered, but I thought that I would post it anyway. Carlos KNOWS how much I love JS... ;-)

    One difference is that, since it was not clear to me which layer you talk like layer #1, I started at the bottom of the scale.  I hope this helps.  -TT

    var aDoc = app.activeDocument;
    var lc = aDoc.layers.length;
    for (var i = 2; i <= lc; i+=2) {
        var curLayer = lc - i
        aDoc.layers[curLayer].visible = false;
        aDoc.layers[curLayer].locked = true;
    }
    
  • Loop through the list in flex 4 conclusion d buttons

    Anyone know how to completely recursively loops through the list in flex 4 by pulling the bodies of buttons.  This way I can apply my effects for buttons on the screen at the same time?

    You just create a subclass of button that has the desired effect and use it throughout your application.

    Gordon Smith

    Adobe Flex SDK team

  • By default, SOUL makes an AE project with the 'no proxy use' setting?

    By default, SOUL makes an AE project with the 'no proxy use' setting? I use a lot of proxies in my files and I want to assure you that they are ignored when I went in the SOUL.

    Adobe Media Encoder encodes After Effects compositions using their current appearance. There is no control the appearance of the composition, with one exception; There is no equivalent for the controls of the render settings in the queue to return effects after. If you want some proxies to be used, or not, set up your publication for the desired configuration before that you encode in Adobe Media Encoder.

    The exception to this rule is Guide layers. In Adobe Media Encoder, right-click on an After Effects composition and choose settings from the Source, in this dialog box you can control whether or not Guide layers in the composition are rendered.

  • First Pro CC blocks when you scroll through the sequence in the timeline - Audio Waveform will Virgin first

    The description is in the title: first Pro CC blocks when you scroll through the sequence in the timeline - Audio Waveform will Virgin first.

    Just started today, will not stop now blocks after a minute or two, and he always does when I scroll through the timeline of a sequence.  First of all, the audio waveform becomes empty.

    What is going on?

    Date/time:2014-10-22 12:16:16.078-0400
    OS version:Mac OS X 10.9.5 (13F34)

    Report Version: 11

    Anonymous UUID: E1BCDCD7-6284-3012-9151-FF85491060DA

    Crashed thread: 0 dispatch queue: com.apple.main - wire

    Exception type: EXC_BAD_ACCESS (SIGBUS)

    Exception codes: KERN_PROTECTION_FAILURE at 0x000000011d74b000

    VM regions near 0x11d74b000:

    VM_ALLOCATE000000011d 748000-000000011d74b000 [12K] rw-/ rwx SM = PRV
    -> BATTERY CARE[000000011d74b000-000000011d74c0004 K]-/ rwx SM ZERO battery guard for threading 4 =.
    Battery000000011d74c000-000000011d7ce000 [520K] rw-/ rwx SM = COW 4 wire

    Thread 0 crashed: Dispatch queue: com.apple.main - wire

    Hi 5 deadly venoms

    This problem is resolved in the 9.0.1 update. Please update the application of a patch.

    Thank you

    Kevin

  • loop through the list in flex 4

    I want to loop through the list and apply the following code to each button, the checkbox and the descent down in my application

    mouseOver = "animateHover ('theComponentID').

    How is that possible?

    Hello

    This should do what you want, you must add the eventlistener now your animated can be run from the th event handler.

    protected function button1_clickHandler(event:MouseEvent):void

    {

    for (var i: Number = 0; i<>

    {

    var obj:Object = this.getElementAt (i);

    If (flash.utils.getQualifiedClassName (obj) is 'spark.components::Button')

    {

    (obj as Button) .addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    }

    If (flash.utils.getQualifiedClassName (obj) is 'spark.components::CheckBox')

    {

    (obj as CheckBox) .addEventListener (MouseEvent.MOUSE_OVER, onMouseOver);

    }

    }

    }

    private void onMouseOver(event:MouseEvent):void

    {

    animateHover (event.currentTarget);

    }

  • To loop through the structure of table - using xpath

    Hello

    My logic to BPEL process is as follows:
    a. extract the data in the variable - receiveMessageInputVariable
    The variable 'receiveMessageInputVariable' has in turn of the data in the table structure. (a set of elements)
    b. to transform the data to the target structure
    c. call the target of the link partner to store data in variable 'ServiceInputVariable '.
    The variable "ServiceInputVariable" structure is similar to "receiveMessageInputVariable".

    In the BPEL process "in the process of" level - I have catch-all exception handler - which must send the list of "elements" that failed in a BPEL proceeding.

    i. If my body of the email has the following code as below:
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER') % >

    It recovers only the first record in the table item_number structure successfully. But don't get the other records in the table.

    II. Similarly, I want to print all the elements (such as received) to be available in the body of the email in the following model:

    < % ' Save a "% >
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[1]/ITEM_NUMBER') % >
    < % ' < br / > "% >".
    < % 'Save two -' % >
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[2]/ITEM_NUMBER') % >
    ....
    ..
    < % "Nth record" - % >
    < % bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM[N]/ITEM_NUMBER') % >

    Please suggest a syntax suitable in my body of the email - which can loop through all the itemline_item table and print all item_numbers.
    (pseudocode below)

    because me in 1... ORA: countNodes (bpws:getVariableData('receiveMessageInputVariable','XXINV_ITEM_PAY_ROW_TYPE','/ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER'))
    loop
    < % ' article number-"% > < % bpws:getVariableData('i') % >".
    < % APO: getVariableData ('receiveMessageInputVariable', 'XXINV_ITEM_PAY_ROW_TYPE','/ ns4:XXINV_ITEM_PAY_ROW_TYPE/ITEMLINE/ITEMLINE_ITEM/ITEM_NUMBER')% >)
    end loop;


    Thank you
    Shakur

    Hi Shema

    Try the following approach. It can work for you

    1. create an XSD for HTML content








    2. create a XSL, can be that you must do manually, as JDev will not support transformations to HTML. This XSL will map your input XML to HTML file.
    3. create a variable in BPEL type in the XSD above
    4. use assign activity to assign the XSL transformation to the variable set to step #3


    5 copy the variable in the variable of email body



    Query = "" / EmailPayload/ns8: Content / ns8:ContentBody "/ >"

    Basically, the approach described above converts your entry to a value of string whose content is a complete HTML, and you'll use only one value to be assigned to the body of the email.

    Note: Please change the names of Variable/XPATH Expressions / / the name element from the XSL names etc. According to your BPEL file

    Hope this helps you

    Concerning
    LOC.

  • How to loop through the results of a select statement in a process flow?

    Hello

    I use Warehouse Builder 10 g R2.

    I'm trying to implement a loop in a process stream that runs through the results of a select statement.

    In pl/sql, it would be implemented as a for loop by using a slider, but I simply doesn't work how to do this using the loops in the process flow.

    Someone at - it ideas?

    Thank you
    Liffey

    Liffey,
    Look at this thread
    For or while loop a loop in the process flow

    Kind regards
    Oleg

  • To loop through the form using hypsetmembers of planning

    I create a file that is able to perform a loop on a number of intersections, by using VBA. This prevents the user to click a lot of times toe submit data.

    To do this, I use the hypsetmembers function.

    I work with the code below:

    Public Declare Function HypSetMembers Lib "HsAddin" (ByVal vtSheetName As Variant, ByVal vtDimensionName As Variant, ParamArray MemberList() As Variant) As Long

    CurrentSheet ActiveSheet.Name =

    m = HypSetMembers (Currentsheet, "Product", "HOME_PROD")

    To avoid creating me above the code for all intersections I want to take the value "HOME_PROD" and other values of a leaf in the same file is excellent. But when I try I get the return value - 15 (function contains an invalid parameter.).

    The code I'm trying to use for this is:

    Public Declare Function HypSetMembers Lib "HsAddin" (ByVal vtSheetName As Variant, ByVal vtDimensionName As Variant, ParamArray MemberList() As Variant) As Long

    CurrentSheet ActiveSheet.Name =

    UDF = "HOME_PROD."

    m = HypSetMembers (Currentsheet, 'Product', UDF)

    Is there a way to get over working code? Or what is the reason for which it gives me - 15 return value?

    Thank you very much!

    Teun Kuijten

    Looks like your form is using aliases instead of the names of members, if this is the case, make sure the macro (and the research sheet) using the same

  • Is there a way to loop through the properties of a layer groups and JUST get those that are visible?

    Hello

    I'm trying to get just the property groups that are visible to a layer in my script. Is there such a property?

    For example, when I loop through groups of properties of a shape layer, I get masks, layer, surface Options and Audio property groups Styles, when none of these are appropriate. I tried to use the (.elided) property, but it gives me just the 'Content' hidden folders within the groups of vector and 'Masks' in 'membership Options '.

    * on a side note, I got the error "not"adjustable expression"with this property, because the property is a property of the parent is hidden." When you try to access X or Y Rotation on one layer 2D. It makes it seem like there is somewhere a Boolean value 'hidden' in the property object, but I can't.

    Hello

    'elided' and 'hidden' both have purpose UI (make the lighter user interface) but are very different:

    • 'j' is a static property groups attribute (readonly, and After Effects never becomes the value internally).

    The children of an elided group are not necessarily élidés.

    • 'hidden' is NOT an attribute, is dynamic and "undocumented".

    The UI of effects after mask everything that is not necessary in the layer property tree (for example the Group of hardware options is hidden when the layer is not 3D, because it is not used anyway).

    Properties and masked groups are always there and is accessible by script, you can read their values and attributes, Scout their subtree of property, but we cannot define anything on them or select them (in both cases, that an error is generated).

    And the children of a hidden group are hidden.

    Since there is no corresponding to 'hidden' attribute, it is uncomfortable to know whether or not a property is hidden. I only see one case of 'treatment '.

    For example:

    myLayer.layerStyle is hidden? <===>! myLayer.layerStyle.canSetEnabled

    myLayer.transform.xRotation is hidden? <===>! myLayer.transform.xRotation.canSetExpression

    myLayer.mask is hidden? <===>myLayer.mask.numProperties = 0

    myShapeLayer.content is hidden? <===>fake (never hidden, even if it is empty)

    etc...

    Xavier.

  • loops through the sections XML &lt; RecieptDetails &gt; and for each record found...

    My input XML file is...
    I get this XML using file adapter...

    <? XML version = "1.0" encoding = "UTF-8"? >
    -< root xmlns:ns2 = "http://www.w3.org/2001/XMLSchema" >
    -< ns2:ReceiptBatch >
    < ns2:FileID > "99999" < / ns2:FileID >
    < ns2:Warehouse > in THE < / ns2:Warehouse >
    'L' < ns2:Revision > < / ns2:Revision >
    < ns2:DocID > A4 < / ns2:DocID >
    -< ns2:Receipt >
    < ns2:DeliveryNo > 123 - OP < / ns2:DeliveryNo >
    < ns2:ProcessDate > 112138 < / ns2:ProcessDate >
    < ns2:ContainerNo > 98765 < / ns2:ContainerNo >
    < ns2:Instructions > TREKAU < / ns2:Instructions >
    < ns2:ReceiptType > 1 < / ns2:ReceiptType >
    < ns2:SuppCustCode > 111 < / ns2:SuppCustCode >
    TREK-Cycle < ns2:SuppCustName > < / ns2:SuppCustName >
    -< ns2:ReceiptDetails >
    < ns2:Line > 1 < / ns2:Line >
    < ns2:ProductCode > 1000 < / ns2:ProductCode >
    < ns2:QuantityAdvised > 1 < / ns2:QuantityAdvised >
    < ns2:QuantityReceived > 1 < / ns2:QuantityReceived >
    < / ns2:ReceiptDetails >
    -< ns2:ReceiptDetails >
    < ns2:Line > 2 < / ns2:Line >
    < ns2:ProductCode > 2000 < / ns2:ProductCode >
    < ns2:QuantityAdvised > 2 < / ns2:QuantityAdvised >
    < ns2:QuantityReceived > 2 < / ns2:QuantityReceived >
    < / ns2:ReceiptDetails >
    -< ns2:ReceiptDetails >
    < ns2:Line > 3 < / ns2:Line >
    < ns2:ProductCode > 2000 < / ns2:ProductCode >
    < ns2:QuantityAdvised > 3 < / ns2:QuantityAdvised >
    < ns2:QuantityReceived > 3 < / ns2:QuantityReceived >
    < / ns2:ReceiptDetails >
    < / ns2:Receipt >
    < / ns2:ReceiptBatch >
    < / root >

    There are 2 tables in the database.
    Table 1 = T1743512
    Table 2 = T2743002

    table - structure

    T1743512-

    DOCO KCOO DTCO LNID LNIX LITM NOTICE USR JOBN UPMJ PID'M CKNU UREC
    123 00026 1 1 1000 1 1 123 - OP OP
    124 00026 1 1 1000 1 1 124 - OP OP
    123 00026 2 2 1000 2 2 123 - OP OP
    123 00026 3 3 1000 3 2 123 - OP OP



    Things to do are:--

    1. Research Notice T1743512 (table) with the following keys:
    1.T1743512. CKNU = < DeliveryNo > XML
    2.T1743512. LNIX = XML < row >
    II. write a record in the T2743002 table for each < RecieptDetails >. (See map below)

    Mapping of the records in the table T2743002 to < ReceiptDetails >

    EDU - "SABSSV".
    EDBT - < EDBT > (the same for all records)
    EDTN - < DeliveryNo > (from the section < reception > XML)
    EDLN - < row > (from < ReceiptDetails > section in XML format)
    EDSP - white
    DOCO - white
    DCTO - white
    KCOO - white
    LNID - white
    LITM - < ProductCode > < ReceiptDetails > section
    UORG - < QuantityAdvised > < ReceiptDetails > section
    UREC - < QuantityReceived > < ReceiptDetails > section
    USER - "SABSSV".
    JOBN - "SOA - 3PL".
    PID - 'PO-ENTRANTS ".
    UPMJ - current Date Julian
    - Hour current HHMMSS



    Please suggest the solution.

    Published by: Prashant_AP on June 22, 2012 12:24 AM

    Hello

    Solution by using a loop in BPEL;
    1 count the number of nodes for ReceiptDetails.
    2 create a counter for loop through each node ReceiptDetails. Use a while loop in BPEL
    3 search T1743512 (table) with DeliveryNo and the line. Make sure that you select the correct line from the ReceiptDetails node element node. This can be done using the counter example of xpatch ns2:ReceiptBatch / ns2:Receipt / ns2:ReceiptDetails [counter] / ns2:Line. Please use the DB adapter.
    I guess that the DeliveryNo can only appear once in the document following your example.
    4. for each receiptDetails you write a record in table too T2743002. Please use the DB adapter.
    5. Since the time increment the counter. This is to ensure that the while loop stops at the point where the counter is greater then the number of nodes to ReceiptDetails.

    I think a better solution is to make the loop in PL/SQL. It will be faster. You specify an input of type of collection in your pl/sql package parameter. Assign all items receiptDetails and DeliverNo line to the PL/SQL package. Within PL/SQL unravel you the closure. With a little luck, you have the T2743002 in the same schema to create the record too. Otherwise create synonyms of the database or database links.

    Good luck

    Thank you

    Sander

  • Scripting inDesign: Loop through the layers

    I'm doing a script that will:

    To loop through all the layers in a document.

    Add the layers unlocked in table

    Loop in this table and glue them in place on each layer.

    I don't know how to loop through all the layers.

    Here is my script (I used? to represent where would the loop through all the part of layers):

    JavaScript document

    Set up a table to keep unlocked layers

    var layercollection = [];

    Browse layers and unlocked the layercollection table

    for (i = 0;? i ++) {}

    app.activeDocument.activeLayer = app.activeDocument.layers.itemByName (?);

    If (app.documents [0] .layers.) ([i]). Locked) == false;

    layercollection.push (Layers.itemByName ([i]))

    }

    Loop in table layercollection and paste in place

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

    app.activeDocument.activeLayer = app.activeDocument.layers.itemByName (tl [i]);

    app.pasteInPlace (); Dough

    }

    Can someone help me complete my script.

    Thank you!

    Did you test them all your solutions in a real world scenario?

    Theoretically, it should work this way (if one ignores that a layer is invisible, too), but even without the problem of invisible layers app.pasteInPlace () prefer to paste into the original layer, if the option "Paste remembers Layers" is checked.

    So I recommend you do the following:

    var oldPasteRem = app.clipboardPreferences.pasteRemembersLayers;
    //uncheck "Paste Remembers Layers"
    app.clipboardPreferences.pasteRemembersLayers = false;
    
    for (i = 0; i < app.activeDocument.layers.length; i++) {
    
        //Maybe the user does not want objects pasted to invisible layers:
        if(app.activeDocument.layers[i].visible == true && app.activeDocument.layers[i].locked == false) {
            app.activeDocument.activeLayer = app.activeDocument.layers[i];
            app.pasteInPlace();
        };
    };
    //Restore the old condition:
    app.clipboardPreferences.pasteRemembersLayers = oldPasteRem;
    

    Uwe

Maybe you are looking for