Sort groupItems Array using the left coordinate of visible limits?

Hey all! It's been a while, but I'm back with some more busters of brain for you guys.

I'm trying to re - work a script that Silly-V wrote to me. The goal is to create a work plan around each group of a document element in the order of the top left corner to the lower right (as if reading a book). (ultimately I would like to add a provision that excludes the possibility of having a work plan contained by another work plan, but it is a luxury that I can try to find later).

Silly script works very well and does exactly what I need... about 60% of the time. The problem comes when I have an item that contains a clipping mask. Since work plans are created through groupItem.visibleBounds, Illustrator assumes that the invisible work that extends beyond the clipping mask is visible and creating a work plan that is too much.

His version pushes the visible boundaries of each groupItem in an array, then sorts the visible boundaries of the left coordinate, then pushes this sub-table in another table and at the end, to coordinate kinds berries vertically at the top... However, I'm looking to push the real groupItems in the table instead of just the visible limits. So I would like to sort the groupItems by their visible limits table and then I have the opportunity of either by creating work plans based on their visible limits or (the possibility of) loop to make each groupItem selected = true and using the fitArtboardToSelectedart() command.

I'm stuck on how to sort the groupItems table based on the visible limits... Here's what I have so far:

my inclination is to set a variable to the visibleBounds of each groupItem in temp (which seems like it would need a loop), but it's not supposed loop me XIRR...? There is something really big, I'm missing here, but I can't wrap my head around it.

Thanks for any help!

function organize(){
  var docRef = app.activeDocument;
  var layer = docRef.layers[0];
  var groups = layer.groupItems;
  var currentRowMarker;

  var groupList = []; //array of all groupItems
  var sortedGroupList = []; //array of subarrays sorted by visible bounds
  var temp = []; //temporary array for the current row of groupItems. sort this array from left to right first, then push the entire array into "sortedGroupList"


  //populate groupList


  for (g=0; g<groups.length; g++){
       groupList.push(groups[g]);
  }


  //set currentRowMarker and compare rest of groupList to top coordinate of visible bounds. push true results to temp array.


  for (t=0; t<groupList.length; t++){
  temp = [];
  currentRowMarker = groupList[t].visibleBounds[1];
  temp.push(groupList[t]);
  groupList.splice(t,1);

       for (c=0; c<groupList.length; c++){
            var currentGroup = groupList[c];
            var vB = groupList[c].visibleBounds[1];
                 if (vB + 20 > currentRowMarker && vB - 20 < currentRowMarker){
                      temp.push(currentGroup);
                      groupList.splice(c,1);
                 }
       }

  //this is where i'd like to sort the temp array

  sortedGroupList.push(temp);
  }
}
organize();

Thanks for your help, Vassili.

I've been unable to get your suggestion to work, does not mean that it was an erroneous suggestion. So I decided to go the more complicated route. I hope that I can learn about why your suggestion did not work for me in a subsequent attempt.

I am sure that this isn't the most elegant way to perform this task, but it was the only way that makes sense to me. Here's what I ended up with:

for (s=temp.length; s>0; s--){
  var placeholder = 0;
  var farthestLeft;
  var deleteIndex;
       for (a=0; a 
         

Tags: Illustrator

Similar Questions

  • When I use the left arrow FF tends to go back two screens instead of one. Also when I close a tab (Web page or e-mail) FF and TB sometimes both minimize

    When I use the left arrow FF tends to go back two screens instead of one.
    Sometimes when I create a new tab it opens two instead of one.
    Also when I close a tab (Web page or e-mail) FF and TB sometimes both minimize
    When I opened a project in Tbird, if I close it, the set of Tbird farm.
    When I create a copy of the project and save to drafts, when I recover, there many other added characters generally upper and lower case or some other character.
    Both applications are up to date.versions 38.0.5 & 31.7.0
    Help!

    Start Firefox in Safe Mode to check if one of the extensions (Firefox/tools > Modules > Extensions) or if hardware acceleration is the cause of the problem.

    • Put yourself in the DEFAULT theme: Firefox/tools > Modules > appearance
    • Do NOT click on the reset button on the startup window Mode safe

    You can also try another mouse in case there is a problem with your current mouse and check the double-click setting in the mouse driver software.

  • Cannot display web pages on explorer 8 without using the left/right scroll bar.

    I rebooted my system yesterday and now when I visit a web page on explore 8, I have to use the left/right scroll bar to view the entire page. Before I rebooted and am went full-screen page would correspond to the size. The graphic and type are larger, and I wouldn't change a thing.

    On the command bar, there is a marked entry Page.  Until it clicks.  (If you do not see this, right click on the toolbar of the tab and then click the command bar to add it to the other toolbars).  Now, go to Zoom and the size of the text and set each as required to get the page fit on the screen.  For me it works with the format as smaller text and 150% Zoom, but it may be different for you depending on the size of your screen and your graphics hardware.  If it's just a problem of zoom (and you don't need to adjust the size of the text), then there is a Zoom control on the right-hand side of the bottom bar State which also allows you to adjust the Zoom level on what meets your needs (and there are a little faster to join then the menu bar).

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • I WANT TO CHANGE MY CODE TO USE THE LEFT BUTTON = PREVIOUS IMAGE / RIGHT OF THE IMAGE NEXT TO ANY KEY KEYBOARD = NEXT IMAGE. HERE IS MY CODE.

    I WANT TO CHANGE MY CODE TO USE THE LEFT BUTTON = PREVIOUS IMAGE / RIGHT OF THE KEYBOARD = NEXT IMAGE TO

    ANY KEY = IMAGE NEXT. HERE IS MY CODE. PLEASE HELP ME OBI WAN KENOBI, YOU'RE MY ONLY HOPE:

    Stop(); stage.addEventListener (KeyboardEvent.KEY_DOWN, changeSection); function changeSection(event:KeyboardEvent):void {switch (event.keyCode) {case Keyboard.RIGHT: nextFrame(); break; case Keyboard.LEFT: prevFrame() ;}}}}

    Your problem seems to be a matter of not understanding what version of the code that you use compared to what your file is configured to use.  Your other display uses AS2, so if you want this to work you must set the parameters of publication for AS2.

    If your file settings are for AS3 code that show you in this announcement will be suitable for this because it is the AS3 code.  The function would change to what is shown below.  Mgiht want to use a listener KEY_UP instead of a listener KEY_DOWN.

    function changeSection(event:KeyboardEvent):void {}

    nextFrame();

    }

  • Initialization of an array to match another size of array using the formula node.

    I want to get a few different pictures of the same length and constants in the formula node and output a table corresponding to their length after some minor calculations. Another post, I discovered that I can simply initialize the table as such:

    float pp [100];

    The problem is that I find myself with a much bigger picture than what I need. I want to do is something like:

    float [n] pp.;

    where n represents the entry of an array size in the form node or is something like:

    n = sizeOfDim(td0,0);    Here I use a table 1 d

    None of these methods seem to work. How do I initialize my picture 'pp' such that it matches the length of array 1 d of "td0?

    The more likely your initialization externally.  Create an entry named pp and wire td0 inside as well.  Now create an output with the pp even name and it will contain an array of the desired length.  Of course, this assumes that you want to edit all items in pp.  Otherwise, just use initialize the array to create a new table and feed in the length of td0, and whatever default value you want (ie. 0 or NaN).  The blank values will keep this value after the node of the formula.

  • The invisible layers using the text returned on visible layers

    I'm working on a newsletter page 8 for a customer. There are 5 versions of the newsletter of new pages 3-6 are common to all the 5 editions, pages 1-2 and 7-8 is unique to each version. I use an InDesign document with 6 layers, 1 layer of background (#1) pour common/story layouts and a separate layer for each version (#2-#6). When laying on the stories of page 7 (a single page) my invisible layers affect the provision on visible layers. I have a story on layer #2 all plotted, so when I move to the layer #3 I disable #2 and light #3 which should give me a blank page to work with. The page appears empty, but when I add my pictures and text, information on layer #3 is being moved by what looks like a build-up of layer #2. Why is this invisible layer affecting the layout on a visible layer? How do I fix this so I don't have to go back and rebuild individually 5 versions? Thank you!

    It is exactly as expected. If you want to disable, open the properties of the layer of hidden layers, and it can be.

  • Using the text input box (character limits)

    Hey guys, I come to you once again a simple question this time hopefully. I use areas of text entry receipts Records of users that appears on a slide via the legend using the "$$TextEntered$ $" method. However, I have noticed that with my text entry boxes, for a reason, even if I type in 20 characters in the main entry text box, only a maximum of 15 appear in the legend of $$ $$TextEntered. Any ideas on how to increase this number of characters?

    You set the number of characters at the time wherever you need to insert the variable in the legend.  If you add just $$ at both ends of the name of the variable in the legend, then you haven't seen the dialog box allowing you to specify the number of characters allowed.

    Remove the text in your legend display and insert the variable, but this time click the Insert Variable in a few insignificant appearance, provided in the text caption properties tab.

  • Sorting table 2D using the formula node

    Hello

    • What l am trying to do is kind of numbers in groups.
    • A group consists of the numbers that are equal, or step upwards or downwards by a single value. Each group must be assigned to a column. E.g. O column of the table of entry test would consist of 5, 4 and 3, but not the 9 and 10. These values belong to column 1. However if the adjacent cell in the column was not empty then 9 and 10 would stay in column 0
    1. To better understand the programming formula node went to 1 d. I found that each cell is not treated individually with my code.
    • The final table of the orange entry test is that the data type l want to sort a 2D picture that ends up the same size chart.
    • In the code l provided my goal to compare each cell of each column line to determine if a cell is equal for example a = b, a + 1 = b or a-1 = b If Yes, then these values are in the right column. If this is not the case, a sort must be made to put a value in the right column it is.

    This is my first shot with node formula and l must admit others examples l found a bit confusing how a result has been obtained. I prefer to do any programming in labview instead of going to another program for results l am after. I tried to picture of programming just for this problem and found to grow big and very complicated then stopped l. For me the road to node formula should be simpler and more compact. My last resort is to use Excel but l still hope to do all the programming in Labview l you end up with a more dynamic program.

    Concerning

    Michael

    Hello

    You are brilliant... bloody!

    I just couldn't she would repeatedly using tables, l have been on it for weeks. I never thought about how you solved this problem.

    I hate excel and text. I am graphically spirit therefore l such as labview.

    I had a solution in Excel yesterday, but your solution is much better than what l came with

    I'm very grateful

    Thank you

    Michael

  • CS6/Mac Air - can't find windows that I cut using the left top of the page.

    When I click on the yellow button in the middle (with less than bar inside) corner of an open window top / left canvas he reduced the file and you can see close and melt doen in the Photoshop icon on the toolbar at the bottom. How can I find these windows to reopen or expand to my window of Photoshop? Cannot find it anywhere. I know that they are still active, as I have not clicked the close button red, only the button reduce.

    It reduces the file and you see it close and melt doen in the Photoshop icon on the toolbar at the bottom.

    How can I find these windows to reopen or expand to my window of Photoshop?

    This tutorial Mac OS X help?

    Reduce Dock clutter in OS X in minimizing Windows in their App icons

  • Sort records by using the approval date in HRMS

    HII All

    I have a table that displays the records after search
    on the search page

    now, I want to add a column over at the end of this table which shows the date of approval
    This approval approved by a Director with different ID and password

    How can I see the date of approval of the vacancy?


    and I also want to show a drop down list with options ascending and descending
    on this basis the column date of approval must be sorted

    How can I achieve this?

    Hello

    If the display attributes are available in VO (responsible for display in the columns of the table) to the corresponding fields, you can

    1.) create the areas through customization.
    2.) extend the controller and order by condition dynamically in the PFR on the VO responsible to display the value in the columns of the table.
    3.) something, you need to check if you are able to add the action event ppr on falling down during the creation of this area through customization, and even then set the ppr on this field in the PR of the extended controller method.

    If the corresponding attributes are not available you must extend the VO (responsible for display in the columns of the table) too.
    Thank you
    Pratap

  • Does anyone else have a problem with the left speaker is much lower than the right?

    Any source that I use the left speaker is much lower than the left. If I put my finger on the right I can feel the pressure of air pushed but not by the left. Is it an iPhone defective 7?

    Hello, TopDog16!

    Welcome to congratulations on getting a new iPhone and Apple support communities 7.  From what I see in your post, you have any questions on the stereo speakers in your new iPhone.  I would be happy to help you with that!

    Indeed, your iPhone has holes on both right and left sides on the lower edge (on each side of the connector of the Lightning).  The holes on the right are only speaker on this edge of the phone, however.  The other speaker in the pair is at the top of the phone, where the cut is, just above the screen.  Check here to see if sound comes out.

    This page has a large diagram of the iPhone of 7 speakers (in the section entitled "Buttons and external connectors"): iPhone 7 - technical specifications

    Have a great rest of your week!

  • HP ENVY Notebook PC m6: after updating windows 10 touchpad freeze shortly after using the keyboard

    Hello

    I've updated my laptop it has windows 8.1 to 10 and for a few days then my touchpad/pointer has been gel 4-5 seconds after I touch any key on the keyboard. for example. If I hit enter then I can't move the pointer for a few seconds... I can always use the left and right click while the pointer does not move.

    Everything worked perfectly until I upgraded to windows 10 and everything else outside the mouse freezing seems to work properly after the upgrade.

    Any help fixing this issue would be greatly appreciated, thanks!

    Hello @juibre,

    Welcome to the Forums of HP Support!

    I understand that you are having a problem with your TouchPad and wanted to help you!

    For starters, can you provide me with the product number of the laptop?  Here is a link, you can use that will help you find your model and product number: How can I find my model number or product number?

    In the meantime, please see the post by Member of the DanG82community.  In this post, you will find details of disputes with keys touch after installing Windows 10: Re: How do I solve the Post-Windows 10 questions about HP laptops Upgrade

    Please let me know if this information helps you solve the problem by marking this message as 'accept as Solution' , this will help others easily find the information they seek.  In addition, by clicking on the Thumbs up below is a great way to say thank you!

    Kind regards!

  • How to trace mutiple tables on the left and right value axes?

    Hello world

    I have a problem (I hope that little?) ... I have a chart 2D with 6 columns of data that I need to plot a graph... I would like to 0 on the left axis and tables 1 to 5 draw using the left axis... I tried using clusters to group the two sets of data connected to a loop for each axis. But it does not work... Can't seem to find anything online to help with this...

    Any suggestions would be greatly appreciated.

    Kind regards

    Jack

    Do not worry... Found this link...

    http://digital.NI.com/public.nsf/allkb/049C7E362BE4270A8625756E005CC46F

    Thanks for vewing...

    Kind regards

    Jack

  • My photos will open VLC with the left click. Need to open context menu for images

    When I double left-click on the icon my images the VLC page is displayed in the upper left corner of the screen and nothing happens when I click on the arrow of VLC playback. The same thing happens with picture files.  I've never had this problem before and cannot find a "Restore Defaults" to return to normal. Help, please!

    HI Milton,

    Explore the My picture folder in your My Documents or navigate to the location of the image. Click right-> one of the image-> Openwith files select "choose program"-> select "Windows fax and picture viewer"-> Tickmark "always use the selected program..." -> Ok.

    You will be able to open the rest of the images using the left-click in the picture windows and fax viewer, if you use another program, you can select the program accordingly.

    I hope this helps.

  • When I open an email, the screen is shifted off center to the left about 3 inches.

    Original title: Live Mail opens to a quirky screen

    When I opened a mail on Windows Live Mail 2012, the screen is shifted off center to the left about 3 inches. My arrow on the right does not have to re-center the page so I can't use all the controls on the left or read the email because the left is not visible. How can I fix it?

    Not sure what you mean by the arrow on the right.
     
    Make sure that the Central box in the top right is a unique place. Take the banner at the top and drag the window where you want it. Close all other windows first and this one last and Windows will remember the size and placement.
     

Maybe you are looking for

  • After mainboard replace my HARD drive with password works on TECRA S11?

    I hope that my local service center will replace my TECRA mainboard (later I'll tell why). Will my drive HARD with the password protection work and my files accessible encrypted fingerprints after a motherboard CPU replace? Windows 7 Pro will start i

  • creating a dll from simulink model labview requires visual studio

    I asked the same question on the forums of Simulink, but maybe someone here has the answer: I am trying to do this here: http://zone.NI.com/DevZone/CDA/tut/p/ID/3447 However, I get the following errors of the workshop of Simulink in real-time: Error

  • Acer laptop opportunity; looking for a good OS software

    I recently bought an Acer laptop from a computer retailer.  The computer model is ZG5.  Only, the computer was shipped with a power supply cord.  I don't have a backup of the operating system drive.  The computer running XP Professional.  The windows

  • EA3500 EA4500 PPPOE issue resolved

    The question: Usable size MTU packets drop when it is connected to an ADSL Modem in bridge with EA series router connected via PPPOE mode. How to identify the issue: The router will connect using PPPOE and displays the IP address normally in State. I

  • "IE stopped working" messages when I log onto the MSN/Hotmail e-mail account? Difficulty?

    Logging into mail works but only seconds later, IE stop working pop boxes.  I stopped using this Dell laptop for my email. I ran the registry error corrections and scans with no positive results.  Add - ons have been eliminated... at least I think.