While loop goes infinitely?

I have this script that detects the layer tone and it duplicates if he finds her.  For some reason, it does not accept my = true to the end game and continues to duplicate the layer until I have finished the script.

var match = false
var front = /fr/gi;
var back = /bk/gi;
var outfit = /ou/gi;
var currentDoc = activeDocument.name;

while(match === false) {
    for(i = 0; i <app.documents.length; i++)
        if(front.exec(app.documents[i].name) || back.exec(app.documents[i].name) || outfit.exec(app.documents[i])){
            for (n = 0; n < app.documents[i].layers.length; n ++)
                if(app.documents[i].layers[n].name === 'Tone'){
                    app.documents[i].layers[n].duplicate (app.documents.getByName(currentDoc))
                    match = true
                    }
        }
}

What I am doing wrong?

Are you sure the inner loop both ends.  Looks like you can miss one {or two in the statement. After the match = true; Statement add a break; Statement at the end of the loop n also it is an empty space between the n and the ++ in the n for instruction.    in the i loop which ends and loop that maybe he should for (i = 0; (i

I don't know javascript and also find

If (front.exec (App.documents [i]. Name) | back.exec (app.documents [i] .name) | outfit.exec (app.documents [i]))

strange, the first two have .name and the last of them is not where you set front to back, and held in the same way.

Tags: Photoshop

Similar Questions

  • What is the best way to run multiple instances of the class containing infinite while loop?

    Hello

    I have a several instances of the class (say a, b, c,...) that have the same parent and I want to run the same methods overridden to all instances in parallel.

    For example:

    a.init ()-> a.run ()-> a.stop ()-> a.run ()-> a.stop ()->

    b.init ()-> b.run ()-> b.stop ()->->->

    c.init() ->           ->             -> c.run() ->               -> c.stop()

    ...

    See the attachment for more details.

    The problems are now:

    1. the 'run' - method does not return until it receives the external trigger

    2. everything to run methods return in a different time

    1 chip means I can't use autoindexed for loop because in this case b.run () will have to wait before the end of a.run (), right? Is it possible to run to the loop in parallel?

    2 chip means that an object must be able to run and stop independently from others.

    What is the most elegant solution? The solution copy - paste in the attachment works for 3 instances, but there are currently 10 and more is coming.

    Juha

    In fact, what I wanted to know was "how to add the 'P' loop '... Easy, after you ask the right question.

    In the attachment, there is a test.vi that has two numerical indicators in a certain time-infinite loops. If I leave the parallelism, the two digital are incremented infinitely. If I don't allow parallelism, only the first is incremented (he never leaves the infinite while loop).

    To solve my original problem, I can make an init-start-stop branch within a loop-parallel-indexing for and make sure that there are the same number of instances of loop as there are objects in my array of objects (object array is an autoindexed in the loop for).

    Also good point about the vis environment. I should also add that.

  • How to stop the While loop in the Structure of the event with the same button?

    Hello

    I have a problem. I want to use a single control to activate an event in a structure of the event and the same control to end a while loop in this case.

    It is possible to use 2 controls to do this, but I need to be alone.

    Thank you

    You should NEVER place while loops inside the case of the event, and it is never necessary to do. Think about it: all you have to do is spin the code. You can easily use the outside while loop for everything. Simply place the code of the loop internal (without the inner loop) inside the case of delay and manipulate the time-out period between a pending finished and the infinite (-1), depending on the State of the Boolean value.

    A very simple example (LV 8.0)

  • When boolean is set to skip a step in the while loop

    Hey guys,.

    I have a program that controls a fan that pumps gas at a certain speed. This entire process is run in a while loop. When we move from the gas by a gimbal which is located on the front, we immediately jump in a cycle of breakdown and then goes back to the pumping of the gas at the rate previous, but we do not know how to achieve this. Can you guys give advice? Thank you!

    Sincerely,

    The Z.

    Hello,

    A shift in your loop register may be able to achieve this type of functionality. If wire you the switch in the shift register to the right and register in the structure in case of wire left shift, the loop must travel once more before moving on to the HP gas. Here is a link to a tutorial on shift registers:

    http://www.NI.com/gettingstarted/labviewbasics/shiftregisters.htm#shift records

    -Erik S

  • Measurement of time in a While loop

    Greetings gentleman;

    I'm kinda new to Labview, and although I sought an answer without assignment, I wasn't able to find one.

    So here my question, I would like to know how I can measure the time a loop sequence, in other words, what time is my point of view VI to run the main loop together?

    A little explanation, the attached VI tries to be a Markov chain, it takes some values in the first case structure based on the previus loop, then, if the values are correct, it passes to the next step and so on. It's pretty simple, and yet, my problem lies in the measurement of time. Since it is a 'distribution', it would take infinite time to execute a simple loop if it does not fulfill the characteristics, but it is scheduled to meet them so an average time should work.

    So, if you look to the while loop, should the big one, I want to measure how long I take for a ride.

    Thanks for the help, I'd be happy to read some ideas on how to measure this.

    Kind regards

    IRAN.

    You will find examples in the example Finder OR by searching for 'speed test' or ' reference '.

    Essentially, you create a flat sequence structure inside of your loop. In the first image, you measure the current number of cycles. In the middle frame, you run your code. In the last image, you measure the number of cycles again and subtract the first number of this. This gives you the run time to execute the code.

    You can see a page of the community about it here.

    There is a high-resolution time tick count VI hang out somewhere which is great for benchmarking and improving efficiency, used instead the number of cycles (ms) primitive.

    Edit - remember where he was

    https://decibel.NI.com/content/blogs/EvanP/2010/10/04/tick-count-us--microsecond-timing-granularity-...

  • while loop: delay enforcement and continuous updated: VI back to fake out of time?

    Hi all

    I want to control the time of execution of a while loop. I want the user to have the ability to decide how long he wants to run the while loop. The while loop is used to update certain values, then it should run continuously, not only run once and wait (that I could easily using the synchronization functions).

    I used the time up VI as suggested in this post:

    http://forums.NI.com/T5/LabVIEW/how-to-create-a-time-control-for-while-loop/m-p/2530212/highlight/FA...

    and works well, but the while loops are integrated into another loop for and when Goes to the next iteration, the elapsed time Boolean result is set to true and it does not run at all (I think that's the problem).

    Can I return the Boolean result of the elapsed time VI to false, after reaching the target of time? That would solve my problem, I think that...

    I attach some of my VI, although I don't know that it could be useful for you...

    Thanks for your help

    Use the iteration for while loops count and an equal to zero? node.  Then the output of the comparison at the entrance to reset the elapsed time functions.  The idea is that reset you on the first iteration (when I = 0).

  • Once when a structure deal is real in a while loop

    Hello. The first time post here to forgive me. I tried looking for answers in the forums, as well as to try the solution myself, but nothing helped.

    That is the problem. I'm currently collecting signals of tension using the DAQ assistant. When a certain threshold voltage is reached, the 'real' case would go. I am currently using the shift with the while loop register so the number of output "digital 2" would be like while running in a loop. However, I want to only register a single case that long voltage above is greater than the threshold.

    For example. When the voltage is greater than 3V for awhile, he recorded only 1. Then the tension could plunge 3V. The next time that the voltage is above 3V again he would record a 2. So on and so forth. I have attached a picture of my diagram below. Thanks for the help!

    Keep the status of the threshold is reached in a record time difference.  Run an AND with the inverse of the value in the shift register and your new threshold detection.  The result of the AND goes into the structure of your business.

    EDIT: I just threw this example together.  I used a feedback node, because it would be cleaner.

  • start stop multiple while loops

    I have a fairly large VI that works while several loops with the strutures case inside.

    I would like to be able to close and on all looped programmatically according to events. (complete cycle or cycle started)

    I need to store my data in a table, but whenever I turned off the while loop data I gathered is lost.

    It goes like this-measure analog voltage - put it in a digital indicator... now I want to put it in a table only once by my machine cycle.

    If the opeator push the reset button, the table is available for acquisition of report generation.

    Any help would be appreciated.

    Thank you

    It's here.

  • Use of LabView delay in a while loop instead of use the inherent instrument of time loop.

    I have a lmg500 sez I use. It has the possibility of continuous measurement of data, with a cycle of user control loop (always using a while loop but the delay comes from the instrument). The problem is that the time of the loop is not constant. Can I use a very short time (100ms) as the cycle of the instrument of the time, but use a longer period in time loop collect data?

    I know that many instrument offers the same capabilities, so the issue is relevant to each of them.

    Thanks for any help

    You're not going to be accurate with Windows. The time between samples should be that you have programmed the instrument (i.e. the time between each value in the table 1 d) but the rate of the iteration of a while loop always will be the subject of a jig on a bone not real-time.

  • Updated entries on day of a Subvi with while loop

    Hi there guys! It's my first serious experience with LabVIEW, so the question may seem trivial to you, but it's not obvious to me how to solve this problem. So I do an installation that integrates a number of flow regulators, a temperature regulator, DAQ, some taps and a mass spectrometer basic tasks. All these must be automated using LabVIEW. I started by doing a VI for each separate task is going very well. Now I need to combine the latter in an experience of master VI, and of course I run into trouble.

    The problem is that I want of course to control this experiences with some selected buttons/dials/what is on the face before of the main VI. However, each of these VI runs a while loop in which fact acquisition of continuous/data communication / whatever. Of course, I want to change settings online. If I just naively tie them at the entrance to the Subvi these will be read only when the Subvi is started, not during each iteration of the while loop.

    I added a very basic example of the problem, so we are all on the same page. The main VI has a button, the State which should update something in the Subvi. However once the Subvi is started it takes control of the execution and the hand-VI seems to be ignored (appears to hang) even if the program has a lot of spare time to read the buttons and put on day of admission. What is the official solution for this kind of problem? My experience in programming that I prefer to keep the intact Subvi, so I can use it as a reusable standard library. Of course a similar question can requested the sub - VI output which will be updated only once the execution is completed (which is never during normal operation).

    PS. I'm using LABView 8.6 on XP

    The best way to set up a BT program must initialize first your settings, and then launch a while loop where you communicate/aquire data or whatever, then after the while loop is finished close and clean up your references.

    Inside the while loop, you can place your code in many of the screws and it is possible to run those in parallel, but I defenetly does not recommend the use of loops in slot face, especially without having to open the front panel or a stop test.

    If your code is completely executed up to your Sub - VI, the main.vi will wait for the sub - Vi ends before continuing the code.

  • Need help to use while LOOP to run immediately

    Hello

    I use the Oracle 11 g R2 database.

    I need to use 'while' below statement so that I'm going to immediate execution with the following ranges in a LOOP.

    USING 100, 200
    USING 201, 300
    WITH THE HELP OF 301, 400
    USING 401, 500
    declare
    v_maxseq_id number:=100;
    v_minseq_id number:= 500;
    
    begin
    --WHILE LOOP
    
    EXECUTE IMMEDIATE 'insert /*+APPEND*/all into stage_parsed_while
    select * from STAGE_PARSED_h2 WHERE src_file = ''a'' AND load_date = ''03-apr-2013''
    and seq_id between :1 and :2'
    USING v_minseq_id , v_maxseq_id ;
    
    
    end;
    Kindly help... Thank you

    Your syntax for the While loop:

    set serveroutput on;
    declare
      i pls_integer := 101;
    begin
      while i < 500 loop
        dbms_output.put_line('Min :: ' ||i || '; Max :: ' || to_char(i + 99));
        i := i + 100;
      end loop;
    end;
    
    anonymous block completed
    Min :: 101; Max :: 200
    Min :: 201; Max :: 300
    Min :: 301; Max :: 400
    Min :: 401; Max :: 500
    

    And Yes, I'm agree with suggestion of knapen to accomplish the task with a single static SQL, rather than go for dynamic SQL (which is the first wrong approach) and then using loops to slow further (which would be another mistake).

  • Madman of while loop

    Hello. I'm working on a game in the interest of learning Java and the TicTacToe class, and while I have my main class, the test file does not quite work. It print the table correctly, but it does not perform the actions of loop, it's supposed to. In line 29, it jumps to the line 39 instead of going 30 online, when I see (by using the debugger to browse) the variable gameOver is false. The class with methods file is:
     
    package tictactoe;
    
    /**
     *
     * @author user
     */
    import java.util.Scanner; //bring in the scanner
    
    public class TicTacToe {
        Scanner sc = new Scanner(System.in);
    
        public char[][] Board = new char[3][3];
        public int Move;
        public int player;
        public boolean isValid;
        public int winner;
        public int playerMoverow;
        public int MoveRow;
        public int playerMovecolumn;
        public int MoveColumn;
        public char turn;
        public int Movecount;
        public boolean gameOver;
    
    public TicTacToe(int player, int Move){
        if (player == 1) turn = 'X';
            else if (player == 2) turn = 'O';
    }
    public void setBoard(){
        for (int i=0; i<3; i++){ for (int j=0; j<3; j++){
            Board[i][j]=' ';}}
    }
    public void setMove(int Move){
        if(Move<4){MoveRow=0;MoveColumn=(Move-1);}
        if(Move>=4&&Move<7){MoveRow=1;MoveColumn=(Move-4);}
        if(Move>=7&&Move<10){MoveRow=2;MoveColumn=(Move-7);}
    }
    public void changeBoard(){
        Board[MoveRow][MoveColumn]=turn;
        Movecount++;
        if (player == 1)player=2; else if (player == 2)player=1;
    }
    public void isValidMove(){
        if (Board[MoveRow][MoveColumn] != 'X' && Board[MoveRow][MoveColumn] != 'O'
                && Movecount < 10)
            isValid=true;
        else isValid=false;
    }
    public void displayBoard(){
        for (int i=0; i<3; i++){
        System.out.print("\n[");
        for (int j=0; j<3; j++){
        System.out.print(" "+Board[i][j]);}
        System.out.print(" ]");}
    }
    public void findWinner(){
        if (Board[MoveRow][0]==turn && Board[MoveRow][1]==turn &&
                Board[MoveRow][2]==turn) winner=player;
        if (Board[0][MoveColumn]==turn && Board[1][MoveColumn]==turn && Board[2][MoveColumn]==turn)
        winner=player;
        if (Board[0][0]==turn && Board[1][1]==turn && Board[2][2]==turn)
        winner=player;
        if (Board[0][2]==turn && Board[1][1]==turn && Board[2][0]==turn)
        winner=player;
        if (gameOver=true)
            if(winner!=1 && winner!=2)
                winner=0;
        if (gameOver=false)
            winner=-1;
    }
    public void endTurn(){
        Movecount++;
        if(player==1)player=2; else if(player==2)player=1;
        gameOver=true;
        for (int y=0; y<3; y++){for (int z=0; z<3; z++){
        if (Board[y][z]!='X' && Board[y][z]!='O')gameOver=false;}}
    }
    public int determineWinner(){
        return winner;
    }
    }
    and the test file that will ignore the while loop is as follows:
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    package tictactoe;
    
    /**
     *
     * @author user
     */
    import java.util.Scanner;
    
    public class TicTacToeTest {
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            int Player;Player=1;
            int Moves;Moves=0;
            boolean gameOver;gameOver=false;
            boolean isValidMove;isValidMove=false;
    
            Scanner sc = new Scanner(System.in);
            TicTacToe game1 = new TicTacToe(Player, Moves);
            
            game1.setBoard();
            while(gameOver=false){
                while(isValidMove=false){
            System.out.println("Player "+Player+" enter move (1-9)");
            Moves=sc.nextInt();
            game1.setMove(Moves);
            game1.isValidMove();}
                game1.changeBoard();
                game1.displayBoard();
                game1.endTurn();
        }
            game1.findWinner();
            System.out.println("Winner: "+game1.winner);
            game1.displayBoard();
      }
    }

    Once again, code for conventions!

    Look at your outside while the loop condition and try to find the place where you change the condition.

  • How to increase code efficiency in a while loop (using PXI5105 for sampling outside signal digitalizer)

    Theoretically, we want the PXI-5105 (digitizer) have 302 record with each record has a 1260 sample (the save operation is inside a while loop) in approximately 30ms, however we have found that for each period (30ms), the PXI5105 only perform about 10 records. It is so wired. I wonder if the operations inside the while loop consume more time (for example 3MS), so that he cannot have 302 records even the PXI-5105 have 60 M/s speed of sampling. Is it true, you can find my labview code and if possible can you give me some suggestion in the most short time of operation of the loop.

    Please find attached labview code.

    Hi g_l_g_s,

    The digitizer PXI-5105 acquires data at the speed that you specify and stores the data in its memory embedded (up to 512 MB). The data is then sent to your computer when the Multi Fetch Cluster.vi is called. In VI that you posted, you are only fetch record during each while the loop iteration. If you want to retrieve 302 records you will need to specify 302 files in the horizontal Timing.vi to configure. For more information about scanners, you might find the DevZone, hereuseful.

    To determine the amount of time it takes for each while the loop iteration, you can consider using the structure of code in the example comparison community calendar, which is located here.

  • structure of the event + while loop

    Hello, I am trying to understand how to unite two while loops in attached VI for half a day

    The first loop creates a state machine solid which reacts on each key and runs one of the structure cases. (that part works very well)

    The second loop, always generates the random number, but it stops the generation during the time where one of the structure cases events are executed. (this is the part ticky)

    Any suggestions?

    If you want your random number to stop so that the user triggered events are running, you should be able to simplify your design a lot.

    It can be done with a loop using the case of timeout.

  • Retaining the last value without a while loop

    Hello

    I'm using LabVIEW 2013. My VI is attached. I'll send in a 'Curr. Random random numbers TestPlan Row"time. I'm eager to keep his last number, whenever this VI is not called and then reset the value to its new value whenever the VI is called again and a new number has been sent. Also attached is a screenshot at the VI.

    Please note that I can't use a WHILE loop, so it must keep its value in a different way...

    Thanks in advance for any help!

    SM

    Maybe a feedback node?

Maybe you are looking for

  • Could not load the profile Thunderbird after chkdsk

    A ran chkdsk at windows startup and reported no errors or bad sectors. After that... When I started TB, I got the message "TB is already running but is not responding". I clicked on CLOSE THUNDERBIRD and got the message "Cannot load your TB profile."

  • graphic writing 3D MPEG

    Is Hi possible to convert a general mpeg video 3d chart? I already have a vi that converts a polar route image in a video, I was just wondering if it was possible, the 3d locations? so in other words: You can convert directly or You can convert a 3d

  • CQ56 power on password

    I have an error code need to reset the password of the bios 59583211

  • LabVIEW crashes when loading a project programmatically

    Hi guys,. I write a VI that loads by program a major project and then programmatically perform some tasks of generation. It is to set up my server to auto (apparently a VM) builds. I got some success with it, however, it is not stable at all. I find

  • Any time I try to access the web site GOOGLE, this message 404 not found (nginx)

    Any time I try to access the web site GOOGLE, this message appears. Any suggestions as to what is the cause and what is the fix. Thank you