Compare the loop still holding

I have a table that I analyze and sort in 2 different tables. The first table is that a name of part the second table is a reference number.

What I'm trying to accomplish adds the number of the room in front of the name of the party when it finds a match. However, I think that my loop to compare is false. Could someone take a look and advise a more effective loop to compare?

for (var i = 0; i < allText.length; i++) {
  for (var ii = 0; ii < allText.length; ii++){
  if (allText[i].contents == componentName[ii]){
  allText[i].contents = "(" + componentCallout[ii] + ") " + allText[i].contents;
  }
  }
}

I need to analyze the entire document to find if any block of text corresponds to the text in my table

NomComposant

The code you see works on a small scale, but when I try to use it on a document with a lot of text that he just creaking and cracking.

Anyone see a better way of this loop?

Thank you!

their return worked here too switching.

Good grip on the - 1 to bring back the legend on the correct name (even if by correcting the error is fixed too and not necessary)

as she pick up the other values that you marked above, blatant error in the code!

It's a match for C2, for example, C2 appears in something like RLY_WKTL_C2.

answer is to ensure that it matches the full name.

should be interesting to note that if no NomComposant contains a tilde "~" the script will fall on his face.

It has now decided to systematically run less than 2.5 seconds...

Give this a go...

#target illustrator  

var start = new Date().getTime();

var doc = app.activeDocument;
var allText = doc.textFrames;  

var componentName = [];
var componentCallout = [];
var z = 1;
var j = 0;
var count = 0;

for (var i = 0; i < allText.length; i++) {
    if (j < allText.length) {
        //alert(allText[j].contents);
        componentCallout.push(allText[j].contents);
        j += 2;
    }
    if (z < allText.length) {
        //alert(allText[z].contents);
        componentName.push(allText[z].contents);
        z += 2;
    }
}  

doc.close(SaveOptions.DONOTSAVECHANGES);  

//alert("Table scanned");  

var doc = app.activeDocument;
var allText = doc.textFrames;
//create new layer for affected text
try{
        var lay = doc.layers.getByName("modified");
      }catch(e){
        var lay = doc.layers.add();
        lay.name = "modified";
      }

var allText = doc.textFrames;
var componentString = "~" + componentName.join("~") + "~";
for (var i=allText.length-1; i >0 ; i--){
    if(componentString.indexOf("~" + allText[i].contents + "~") > 0){
    var componentIndex = componentString.substr(0,componentString.indexOf("~" + allText[i].contents + "~")).match(new RegExp(/~/g)).length;
        allText[i].contents = "(" + componentCallout[componentIndex] + ")" + allText[i].contents;
        allText[i].move(lay, ElementPlacement.PLACEATBEGINNING);
        count++
    }
}
//alert("Done");
var end = new Date().getTime();
var time = (end - start)/1000;
alert('Execution time: ' + time + ' seconds\nTotal textFrames tested: ' + allText.length + '\nNumber of affected textFrames: ' + count);

Tags: Illustrator

Similar Questions

  • my calendar has frozen after trying to move a clip in e-mail by using the calendar; still frozen after that force them to leave

    my calendar has frozen after trying to drag and drop a piece of mail to the calendar; still frozen after forcing them to leave... using OS X v 10.9.5

    Get the error that civilian could not be refreshed... requires a force quit and then when reopened, get the same message

    Try restarting your Mac in safe mode:

    -Stop your Mac

    -Wait until your computer turns off and after that press the power button

    -Just after you hear the startup tone, press in and hold the SHIFT key

    -Release the SHIFT key when you see a gray Apple sign and the progress under this sign bar

    -Once you see office, start a scan Disk Utility to detect and repair file system errors (remember to choose your primary hard drive)

    -Click on the disc to check, then, if requested to solve the problems on the repair disk

    -After that click on verify disk permissions, and then click Repair disk permissions

    -Once the process is complete, stop your Mac and turn it on again after 30 seconds

    I hope this helps!

  • delete or rename custom loops added to the loop library

    Is it possible to delete or rename a loop added to the library of the loop? I misspelled a loop while creating and now it is saved, but it seems I can't rename it. I tried to look for the "My curls" folder in the apple loops folder, but I don't the have not found.

    Hello

    joctrf07 wrote:

    I tried to look for the "My curls" folder in the apple loops folder, but I don't the have not found.

    'User' loops are stored here:

    Macintosh HD > users > 'You' > library > Audio > loops Apple Loops > SingleFiles

    The library of the user is hidden by default. A way to get these is to use the Finder > go to menu while holding the Option key. The library is displayed in the menu reach.

    TDC

  • Lenovo Y410P was stuck in the loop of auto repair, but it came out

    So my Lenovo Y410P was stuck in the loop of auto repair, I tried holding the power button and F11 and on as the third seeks the laptop turned on as usual. But now I'm afraid to turn my phone off, how do I know if the problem is solved? And if it is not, what should I do?

    TookMeAWhile wrote:

    So my Lenovo Y410P was stuck in the loop of auto repair, I tried holding the power button and F11 and on as the third seeks the laptop turned on as usual. But now I'm afraid to turn my phone off, how do I know if the problem is solved? And if it is not, what should I do?

    Check the system for corruption files by running sfc/scannow in an elevated command prompt.

  • RunState.ProcessModelClient. how to access the results of markets located in the loops?

    Hello

    In my sequence, I have to perform an analysis of the results before I have the MainSequence and return to the process template. Basically, I need to check made some steps has passed.

    I access the results using RunState.ProcessModelClient. Using what I have access to the list of results. I would like to write that I have access to each result but I can't because I spotted the results of steps which are curly are not accessible (they are not there); However, they are on the report.

    How is it possible? How do I access results in a loop? Where are they?

    K.

    Hello

    not too painful:

    the loop results in the usual place online, it's just the layout that will look like a little confusing:

    You use some revisions of my TestStand (you are in 3.1)

    The Runstate.ProcessModelClient is actually a copy of the space of time edit, not space running - it's the SequenceFile type, which means that even if you can see the layout of the result containers that belong to each step, they are there permanently, and not filled in this place from the moment of execution.

    At the level of the mainsequence, you're still in your client, then you can go to Locals.ResultList directly.

    In there, you have the singular element that is the result of the first and the only stage of your Mainsequence of your.

    Inside there is the. TS. SequenceCall container. It is effectivey the resultlist gait that calls (always Mainsequence) seq1 so inside that, there is an another ResultList.

    It's the ResultList for sequence "Seq1".

    Which has a single item since this sequence has only one step inside of type SequenceCall.

    [0]. TS. SequenceCall.ResultList.

    From there you can see a lot of results even if you have only 4 effective steps in this sequence.

    12 results covers:

    3 iterations of ('for' 'Test2' 'end').

    and then the last 3 items are "Test1" loop 2 times more.

    When you set a stage of the loop and include you the results of each iteration, you get these results (2 in your case) more a global success-failure based on the criteria (your care ot 100% must pass in order to study the step successful when all iterations are complete.)

    Note in your pre Expression where you change the name of the step on the fly, your labeled Test2 incremental changes the name from 'Test1' + Str (Locals.LI), and the Test1 marked step uses the same expression for this will look slightly confused that you cross your results.

    Hope that helps.

    Thank you

    Sacha

  • How do you compare the data collected continuously?

    So, I'm stuck on the basic architecture, therefore, hoping that you can push took me.

    What I have is a VI that measures the tensions permanently, then, I have a flow of power from DAQ hardware data points.  What I WANT is to act on the data points of tension, only, which are larger than the previous points.  For example, I want to act on the first data point, since it will be the most important, since there is nothing to compare to, then I want to compare the points of data subsequent to the first, until there is a greater than the first data point.  Then, I want to compare tensions the NEW value more and so on, etc. and act only on the NEW larger value.

    Consider this list of data points and corresponding outcomes:

    2 LAW

    4 LAW

    3. DO NOTHING

    3. DO NOTHING

    4-DO NOTHING

    5 LAW

    4-DO NOTHING

    5-DO NOTHING

    4-DO NOTHING

    3. DO NOTHING

    6 LAW

    I've been watch combinations of them for WHILE loops and shift registers and the tables, but the table would get so huge so fast and the MIN/MAX value of the TABLE palette function would get pretty slow and I don't need to evaluate all previous data.  I just need to be able to identify the highest value and then compare it to the following values until there is a NEW larger value.  It's a bit like how the warriors would fight several opponents until they lost and then, there's a new champion, and all subsequent warriors are compared to the new champion and so on and so forth.

    You have any suggestions on how to achieve this?  I'm puzzled.

    Thank you

    Dave

    Yes, either case will work, I put it in the structure case just to show that you need to put in there if you want to use.

  • lets stop the loop parralle notification

    Hello

    Everyone

    I created several loops producer/connsumer.

    A loop producer is business event that hold value control change of FP and then send queue consumer loop (solenoid)

    The other separate producer loop is to NEITHER 9213 display Temp data, I use another loop of consumer to acquire the data of NI9213

    I don't know if I can use notification to stop the two pairs of earrings.

    I hope that when I click on stop the whole process in PF button, then, the True value is sent to the notification. The NI 9213 producer loop then get this message to stop the loop. Now, stop process only control solenoid buttonhole since this button is in the structure of the event.

    I tried the notification. When I put wait notification NI 9213 looping, this loopkeep wait any notification and doesnot monitor temporary data

    Thank you


  • Servo motor gets stuck in the loop

    My project is to control two motors from the pedals with LabVIEW in combination with UMI-7774 and PCI 7350.

    I use a traditional format of State Machine to simultaneously control two motors according to the absolute position mode.

    In one of the first States, both motors are wound manually by using the speed mode (to make a desired voltage).

    In a later State, the motors are wound to a position specified by the user when you press a foot switch. When you press the other pedal, they are then held in the previous "original" position

    After the first "Tension" indicate when the winding engine and the course due to the pedals is running, the program gets stuck in the State of wind.

    Although drivers are told to go to a specific position, they never move and that's why the program is unable to move to the next State.

    I've attached a screenshot of the winding State where the program is stuck (the engines are not mobile, so when the final position is to compare it with the desired position, the loop continues to go).

    Help, please.

    CAT

    I solved the problem.

    States "Wind engine left" and "Right wind engine" speed has been put back to zero. When the program moves toward States of wind/flow, the speed is always zero (the engines cannot move).

    I simply set the speed value desired in each of the States LBL/RBL (that allowed the engine to get to the position of desire).

    Thanks for all the help,

    Catherine

  • compariing of data between iterations of the loop

    I am data acquisition of temperature with a Thermocouple NI 9213 drive and DAQ Assistant in a while loop.  I need to compare the temperature of a channel in an iteration of the loop with the temperature of the same string in the previous iteration.  The data collected in each iteration are delivered to a chart and a data storage file.  I know how to get the temperature from the data table in the current iteration, but don't know how to get the temperature of the previous iteration, except perhaps by reading the entire file in a table, determining the size of the table and query the last entries. This seems a bit ridiculous for each iteration of the loop and perhaps even embarrassing.   Any suggestions?

    Put the data in a record time difference. The left terminal of the shift register will have the data of the previous iteration.

    Lynn

  • Compare the table

    Hello:

    I need to compare two index table, to see the file please, and if there is no specific line or column changes then indicate any number of line and colunm

    How can I do in labview

    Thank you

    Brice

    I have created 2 examples in the attached VI.

    The loop at the top of the page search for any line that indicates the index of the first inconsistency and incompatibility.

    The loop at the bottom search all mismatched line/column, regardless of having previously found it an inconsistency in the same row.  It gives you a complete list.

    The example (s) should give you an idea of how to do to implement your solution.

  • by comparing the average centroid location to the location of the center of gravity measured

    I'm using labview 2015 to design a laser alignment system, using a contoller ag - uc2 and an optical mount piezo driven two webcams. The establishment, is that the webcams are positioned behind the mirrors, which are somewhat permeable, so the webcam will get a shot where the laser beam is pointed. The laser must be aligned manually first, and after that it is satisfied with the alignment, this program will be run once to run in the background. control the position of the laser a few times per minute to correct the thermal drift. After it is first of all, I would like the program to take maybe 10-15 images, to find a location to center of medium severity on each of the mirrors, then switching to compare new images of this center of gravity of the model. My problem is that I can't imagine a way to get a picture of model and have that info Reports to the next iteration of the while loop to the overall program be carried out. I have tried using the structures of the case, which, I imagine, will eventually be the solution, but it did not work as expected. I put the case structure to run based on the value of the indicator loop iteration of the main loop, and I got a while loop in there with registries to raise the center of gravity of this loop and store this information for the next loop to shift. I can see after running the program why my implementation does not work, but I don't know how I can design something that will have an average of several images. I think I should use learn and compare the model, but I don't know how I can convert a cluster (centroid) type of data appropriate for the model comparistion live if you have any suggestions for my existing code or want to offer a different approach, I appreciate it. Also let me know if you need any other screws included.

    In the past, when I had to switch between two 'modes', if you do, I used two consecutive loops while, one for the first mode and one for the second, or I would put Boolean register to indicate that, two modes, the loop was offset.  If you start in a mode, and then more later switch to another once and only once, then you can use a node 'OR' like a lock to power the old way, so the first true feed you of keeps it true until the next time that you run the VI and it returns false.

    I would also add that I looked your VI and the method that you use on average 10 images, while innovating, is usually not a great plan.  Instead of having 10 shift registers build an array of fixed size, just have a table in a shift register, add each new measure at the end and the VI means in the range of mathematics/statistics to calculate the average.

  • Then the loop or VI runs more slowly, and then demanded

    Hello LabVIEWists,

    I developed a small VI for the monitoring and recording of data. Unfortunately, the while loop, I use to ask for samples of each iteration is not execture as fast I asked by placing a hold until the next ms VI. Even if I change the time of 100 ms to 10 ms, execution speed does not change.

    Anyone has any idea why?

    File IO is generally slow.  One thing you could do to speed to the top of your loop is to move the screw of file spreadsheet reading out of the loop and use autoindexing to iterate through your columns.  You should probably use Transpose table 2D to the index on the size you want.  Also, you loop must be a loop FOR.

  • too long in the loops of whlile (timed)

    HY

    I am: routinely labview developer course made, advanced no performance (not even as it may seem, I need that).

    Programm: multi all structure of event loop with lines of command for each loop, more a single elemnt queue for each loop running as a variable. network communication trought the queues is possible! Many hardware addons as controller PXI Motion and IO digital communication, RS232 communication with several controllers different als separated loops. The software also works without connected hardware components.

    problem: lines of "continuous loop" rate should be less than 5 ms, but is about 15ms/iteration at the present time.

    hardware: computers 2core, WinXP32bit, LabVIEW9

    goal: improve rates of loop of the "continuous loop.

    What has been tryied and tested:

    OK, I tried many things, partially with success.

    -make Subvi returning some of them are used many times at the same time in each loop (see hierarchy VI)

    -increase in speed Subvi with code improvements, partially with success

    -Analyze with the profiling of the VI

    Question:

    When I was profiling the performance of my VI, I have identified that summarizing the duration of the Subvi "Continuous loop" does NOT match the current loop duration. they are about 20-30 ms, whereas they should be according to the number of tracks and the total corresponding to 3ms. in other words, it is factor of 6 to 10 slower than it should be in my point of view. I don't really have an idea of why this happens. the printscreen and its corresponding information is without another iteration loop (deque just waiting) running.

    I tried to get more details and made a few tests and comparative analysis with my continuous loop. He showed that this additional time (latency? so high?) is not actually produced by the continuous Subvi and also not part of the loop deque. It seems that almost all the time of the loop is displayed once the code for the loop is finished... and before the beginning of the loop, somehow...

    If you have any suggestions or information, why this is the case, or if you even have ideas for improvements or references, please let me know.

    attached is viewed from the corresponding part of the program. I don't want to the public the entire program for everyone. If you have any ideas or need the code for the specific tests, please send an e-mail directly to stefan.hartmann (at) psi.ch.

    best thanks in advance

    HY

    OK, I found the problem. the long time of iteration is produced mainly due to a queue which was to load and write the string array of 100 x 100 several times by iteration. This is the reason why time iteration actually has been measured so high and produced a further delay by iteration, next to the slot-VI-times.

    I solved this problem by maintaining the use of queues in 100 with chain 1 x 100, where I actually just need a queue by iteration and not the 100 x 100. This means at the time of iteration about 2 Ms!

    see you soon

  • compare the mixed data clusters which include some floats

    Did someone come up with what they consider to be a slick way to compare groups of mixed (including floats) data for functional equality (close enough)? Are all I have manged to come with specific-the-cluster screws using a while loop with a case statement internal focus on the index to scroll the cluster element by element to make comparisons, using an appropriate method to compare the floats that can accept a tolerance.  I thought that maybe someone can already built a more generic solution based on clusters of variant data conversion and then direction each piece of data to a correct comparison for its data type.

    The attached Zip file has versions v7.1.1, v8.0 and v2014 my VI for this comparison. I need to rework the managed case RefNum objects to the fact that they will be digital or ASCII (e.g.: VISA). I also added an error output to make it easier to tell when the process runs off the rails. At this point, I'll say I'm done with this, because what I created, this is what I need to do and the elves of the forum NOR are harassing me to mark something on this topic as a response. Enjoy!

  • Notifier release outside of the loop of consumption

    Hi all

    I use a notifier to a stop button.  My stop button was not stop in one of the cases (1 error to wait on the notice in hand MTTF.vi).  I've highlighted the code and noticed that when I pressed stop, the notifier has been released prior to notifying the consumption loop.  When I published the notifier outside the loop of consumption, my error has disappeared.

    Looks like a simple fix which is awesome, but ine everything I've read or seen so far, that the release was out of the loop of producer.  Is there a drawback to doing it this way?

    A more common way to deal with this should treat a mistake to wait on notice as a stop condition, because the error indicates that the notifier has been released, and the only way that can happen is that the loop of the producer ended.

    The way you described, you could get in a situation where the producer loop stops but the consumer does not and since the Notifier is not released until the consumer left, the loop of the consumer will never stop because he always waits for a notification that will never come (but the declarant is still valid, if it continues to wait).

Maybe you are looking for

  • Backups Time Machine missing after model clean install

    For a Mac using Time Machine to back up, is there a way to clean install OS X for a new internal SSD and keeps backups Time Machine historical which have been made using the previous internal SSD?  While as I use it to back up the new internal SSD TM

  • Ask my Portege 7020 CT at startup for the BIOS update disk

    I have a Toshiba Portege 7020CT and he will not start to the top as it does for a bios update disc be inserted into the floppy drive, and then press any key.Can someone explain had to get the disc to update bios please and how to fix it? Thank you ve

  • How to perform the two steps in parallel?

    I have always used the sequential execution, but now a situation that two steps must be performed in parallel (one step sends data to a device and another step cut the power to the unit with a delay). How it can be implemented in TestStand?

  • to upgrade my N100

  • 15 - N075ED: HP pavilion 15-n075ed SSD

    I changed the HARD drive of my HP Pavilion 15-N075ED. The keyboard cable (see photos) is simply too short to connect it to the motherboard. How on earth I'll plug the cable from the keyboard to the motherboard? Keyboard cable Here below you can see t