Duplicate the object until the work plan limit is reached

Hello world!

I'm new to JavaScript (4 days studying) and I'm doing a duplicated object until you press the edge of the artboard.

What is a good way to do it?

---

If (app.selection [0]! = null) {}

var = app.activeDocument myDoc,

selectedArt = myDoc.selection [0];

limit =?, / / set the number of duplicates? how to stop when the limit of the artboard?

horOffset = app.activeDocument.pathItems [0] .width + 34.016, / / set the horizontal offset: width of the selection + 12 mm

myDuplicate,

i = 0;

for (i; i < limit; i ++) {}

myDuplicate = selectedArt.duplicate ();

myDuplicate.position = [selectedArt.position [0] + horOffset * (i + 1), selectedArt.position [1]];

}

}

else {}

Alert ("you must have the object you want to duplicate selected.");

}

---

I restored this code together to other scripts, but I'm stuck at the implementation of the edge of the artboard.

I tried to use limit = app.activeDocument.width, but his does not work.

Let me know if the question makes sense.

All the tips are greatly appreciated. Thank you!

Its not pretty, but it works!

Not sure this will help someone that the task is very specific.

I use this to prepare labels for printing on a roll of paper. The width of the graphic Board is limited by the width of the roll.

The height limit is not important, because the configuration document is usually only 2 rows.

Here is the code:

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

If (app.selection [0]! = null) {}

move the object to the starting position

app.activeDocument.pageItems [0] .position = [28.347,-11.338]

Make duplicates horizontally

var = app.activeDocument myDoc,

selectedArt = myDoc.selection [0];

limit = Math.floor ((app.activeDocument.width-56.688)/(app.activeDocument.selection[0].width+34.016)-1),

horOffset = app.activeDocument.selection [0] .width + 34.016, / / set the horizontal offset: width of the selection + 12 mm

myDuplicate,

i = 0;

for (i; I)< limit;="">

myDuplicate = selectedArt.duplicate ();

myDuplicate.position = [selectedArt.position [0] + horOffset * (i + 1), selectedArt.position [1]];

}

}

Duplicates a line down

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

docSelection = app.activeDocument.selection;

If (docSelection.length > 0) {}

newGroup = app.activeDocument.groupItems.add ();

for (i = 0; i< docselection.length;="" i++="" )="">

newItem = docSelection [i] .duplicate ();

newItem.moveToBeginning (newGroup);

newItem.top = newItem.top - newItem.height - 17.008;

}

}

}

else {}

Alert ("you must have the object you want to duplicate selected.");

}

The funny thing is that I don't know why the duplication of a line to the bottom of work

Also if the art is on the wrong layer, the object will not be moved to the correct starting point.

Tags: Illustrator

Similar Questions

  • Is there a tool or function (in Illustrator or InDesign) that selects any form and 'punches' a 'hole' of this form down through several objects for the paper or the work plan?

    Is there a tool or function (in Illustrator or InDesign) that selects any form and 'punches' a 'hole' of this form down through several objects for the paper or the work plan?

    Your objects punch must be in a large group; It will cut through all that is below.

    Create the shape you want to cut and set it to black Uni. Select your group and your form and (in the transparency palette), click make mask.

    Uncheck the Clip, and then return to the palette.

  • My file has plenty of empty space 'outside' of the work plan that I can't get rid of? How to crop the file to the artboard size real?

    Screen Shot 2016-02-12 at 1.05.55 PM.png

    Above is my plan of work and space to work, but when I try to resize the image (or save it in jpeg format to show the problem I have) there is a ton of white space outside the artboard and the crop tool and two work plan tool say that my file is not as large as the size above , but its been as big as the screenshot below.

    Screen Shot 2016-02-12 at 1.05.57 PM.png

    I can't find anyone else having this problem. Am I the only one? How can I solve this problem? It is to be a huge problem for web design. And he did it for all of my projects as web design he updated to have work plans.

    Hi Nicole,.

    I'm sure that it is a problem that we followed. We have not addressed it yet, but it's on our list of things to fix.

    Plan of work documents have a canvas in auto-expand; This is part of the user experience, which gives a feeling of infinite to the document; You can place things anywhere in the view, and they should remain visible no matter where you drag. In order to maintain this illusion, paint us the entire surface to mate with the same color outside work plans.

    Hide us this canvas from you, even if it's still there. You can see how big it is at any time by choosing "Image > canvas... size. ». That size will change as things move around, getting bigger and smaller than necessary. The hidden canvas size will break to the next more or less 'limit of diamonds", which is nominally in increments of 1024 pixels. This is done for performance.

    The problem is that the export code is really not updated as the work plans can develop and reduce the canvas. When you export a document of work plan, it looks at the current size of the Web and uses only. That's why you get that extra white space. This extra space problem happens also for other things, like thumbnails of document. We agree it's pretty boring, and as I said, it's on our list to fix.

    Try this workaround:

    1. download your ready to export document.

    2. in the work plan tool, select the gear icon (top tool bar, far right) and uncheck auto-size canvas

    3. Select the Rectangle tool and cover the artboard from edge to edge. (Snap allows here)

    4. Select the crop option. This can reduce the canvas to just the boundaries of the artboard.

    5 export under..., choose your format, for example PNG. and export.

    6. don't check any extra white space.

    Note that "Web auto-size" is a property of document-sticky and is saved with the document.

  • Photoshop 2015.5 can not export the work plan in PNG transparent

    should I upgrade Photoshop to the latest version (2015.5) and now I can not export in PNG transparent work plans and that sucks A * big time
    Anywho whenever I export in PNG or PNG8 with transparrensy, it receives a white background and space color Medallion to the index as if it was a GIF.

    All the solutions or anyone who has a script that will make the transparent PNG out of work plans?

    Are you sure that you correctly configure the work plan? The 2015.5 version to now set the background color of the artboard that is different from before

  • display of the work plan in real time for mobile devices?

    I do my design in illustrator before exporting all the assets for use in mobile applications. Is there a way to get the work plan to display on my mobile device in real time? As it is now, I have to save the artboard as an image and put it on my phone to see what it looks like.

    Hi Mike,.

    The answer would be 'no', at the present time. You are already one of the workarounds.

    Thank you

    OM

  • Could not create the work plan

    I'm trying to create another plan of work within a document. The work plan is long, but not very big. I want three plans to work on the document. Because his long illustrator doesn't let me create another work plan, as it would fall off the page. I can understand that, but I can't reorganize work plans because there is currently only one. The option is grayed out. There is a lot of room below for plans of work up to 6 I think.

    Does anyone know a way around this bug?

    Select the plan working tool and you are in mode of the artboard.

  • Presentation of the work plans and grid in 2015 CC

    Hello

    I really like the new system of work plans and I tried to adjust my existing models and systems network (for web design and app) with them in mind.

    So I created a new document, put plans in place of my work with different dimensions... and then I tried to use grid layout Panel to create benchmarks for each of my work plans.

    I can put up the original xy for each work plan. But when I use grid layout Panel, it seems that it only uses the "global origin", based on the first artboard created...

    What I see or understand, the grid layout Panel is not more useful when you're working with different work plans.

    SO I'm currently positioning my guides - a - think better methods...

    Anyone encounter the same difficulties? Just maybe workaround?

    In addition, Photoshop crashes a lot with the zoom when I slip with my mouse to zoom/zoom. I do not have this problem so I suspect that comes with the 2015 version.

    Can I disable the photoshop special zoom/zoom use one like Illustrator? (I've not seen anything in the settings. Animated zoom is already disable)

    UPDATE: Photoshop crashes every 2 minutes. I tried to reset the preferences, but it does not help. I no longer use the zoom with mouse slides, but that does not change: whatever I I had an accident after some modifications to the document.

    Really disappointed. My day is lost, and if I can't get Phtoshop to work, I also lose a project if not more...

    Thank you in advance!

    There was a bug just fixed a few days ago that had to do with large documents dimensionally with high zoom factors. If it is not specific to the work plans, a document of work plan may get in trouble more easily. Specifically, if the calculations of coordinates for the drawing overlay (for example selections) went over 32 000, we could get into trouble. For example, a document of 5000 pixels wide 800% zoom could have some contact information to 40,000. So, if your document fits this profile, it * might * be causing accidents you saw; It is difficult to be sure.

    The fix is tested in-house right now. (And no - I can't tell you when you may receive the fix - just that it's in the pipeline)

    We are certainly thinking about improvements with Guides and work plans.

    So, Yes, we read these threads, even if we don't answer every time. Thanks for the information!

  • How can I change the work plan

    How can I change the work plan

    Can you explain more? What is changing? You can use the move tool V to move the artboard, it is the tool of workplan under the move tool, which can change the size of the artboard. Move the tool will move back if you try to move a work plan or if you try to change its size.

  • The "size of Board art" seems incorrect (1/2 actual size) when you try to modify the work plan?

    Anyone had this problem before? Im working in CS4. When I try to "change artboard" to change the size of the presentation of the document, the size seems to be incorrect? In fact his appearance as a 1/2 size real. By example, if I created a new ink paper the size of the bed as: 4.25 "x 5.5" instead of 8.5 "x 11".  In the preferences, the units all seem to be configured correctly. I am able to create a box to size accurately, but not the work plan? It's never happened before. I feel that I have changed something by accident in the preferences? But can't seem to find a solution. Any help would be most appreciated. Thank you.

    Are you sure that you look at W: & H: instead of x and Y:

    A show to see artboard sovereign and after a screenshot of your document preferences.

  • CS5 - navigation in the work plans

    In the CS5 files page 34 it says "to navigate between work plans, press Alt (Windows) or Option (Mac OS down) and click a button." I am on Mac OS 10.5.8 and for the life of me I can't get this to work. Could someone please check if this does or does not work so that I can check if it's something funny to my system.

    Thank you

    Them

    ERP,

    PL. don't abuse the application before exploring its features yet. Illustrator CS5 has added huge capabilities to the several worktops feature introduced in CS4.

    No, you DO NOT need to activate the work plan for the navigation tool. Press SHIFT + PAGE down or SHIFT + PG. Prev to navigate between work plans.

    You have a hotkey of Opt/Alt + Cmd / Ctrl + 0 to 'Fit artboard in the window.

    PL. see the help documentation for the various features.

  • Snap the work plan to the dimensions of the object?

    I have irregular (as a logo). Is there a way get a new work plan to shrink automatically to the bounding box of this object?

    Yes,

    Select your object, double-click the tool work plan, this will open the diolog the artboard Options, use preset in the menu drop down and select Fit artboard of Art selected.

    This will make the art Board to the size of your choice.

  • Work plans: selection of the artboard and unlock automatic disabling shapes in the work plans - possible?

    Hello

    I easily through the General work plan, and I saw immediately, so I thought I'd put it out there. Here are my two questions:

    1. is there a way to disable the ability to move a work plan while working in it? Essentially, to block the plan in place, but not the items it contains? If you use the automatic selection and slightly approach the edge of the plateau, then swipes the entire Board rather than just a few layers / items you want.

    2 is there a way to auto unlock all layers, including forms? It can be really frustrating for fish through the layers to find the form locked in order to remove a work plan. Command + / has not worked for me when I closed a single object manually.

    Thank you very much! I hope that these are not repeated questions.

    1. Yes. Use 'Position Lock' on the layer of the artboard properly said.

    2. Yes. Select the parent group or the artboard. While holding down the alt/option key, choose "Lock all layers in artboard...» "in the drop-down menu Layers Palette.

    This should unlock all layers inside this group or the artboard.

    (Probably, the fact that the menu does not change when you hold down the alt key is a bug, but it does not)

  • Download the work plan of the selected item

    I have the script where I select objects on the artboard multiple, but I can't seem to get advice art activates the selected item. Is this possible?

    each work plan is a text element and I that they in the same position on each of their own work plans they are already a. now it fits them all to a work plan. Here's what I have so far

    doc = app.activeDocument;
    for(i = 0; i < selection.length; i++){
        var firstItemPosition = doc.selection[0].position;
        doc.selection[i].position = firstItemPosition;
        var activeArtboardIndex = doc.artboards.getActiveArtboardIndex();
        alert(activeArtboardIndex);
     }
    

    .. .or with a "brute force" approach

    // return each selected item's artboard index
    // carlos canto 09/28/2013
    // http://forums.adobe.com/message/5721205?tstart=0#5721205
    
    var idoc = app.activeDocument;
    app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
    var selec = idoc.selection;
    
    var sel = [];
    for(i = 0; i < selec.length; i++)
        sel.push(selec[i]);
    
    for(j = 0; j < sel.length; j++) {
        idoc.selection = null;
        alert('selection ' + j + objectArboardIindex (sel[j]));
    }
    
    for(j = 0; j < sel.length; j++)
        sel[j].selected = true;
    
    app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS; 
    
    function objectArboardIindex (obj) {
        var idoc = app.activeDocument;
        for(i=0; i		   
  • Align the work plans

    CC to HAVE, on a Mac

    I have 20 work plans, same size, but they are not aligned. I tried "-Fit artboard to display" but is no more.

    In addition, see how they are sitting in the middle of the pixel on the outer border? Why is this? Size of work plans is 16 x 16. I am working on a pixel grid and align with the pixel grid.

    Ideas?

    Thank you

    artboard_alignment.png

  • How get rid you of the "work Plan" and just opened a "Document?

    I am trying to open a new blank document, but the resulting page has the little word 'Work Plan' in the upper left corner on the page. I don't know what a work plan is not something perhaps in Illustrator. I wanted not a "work plan" and even spelling wants to force me to put "target".

    If someone could tell me how and why I'm getting this and help me a little to open a Photoshop Document clear, white, new, I would be so grateful. If you want to tell me briefly what is a 'work plan' and knowing I don't want one and probably never employeront such a thing...

    TIA,

    Ken

    File/new

    When you get the screen of characteristics of the document (paper size, etc.), search for "Type of Document" and select what you want.

Maybe you are looking for

  • If a document pages on iPad 2 Air can be restored?

    A document Pages deleted on iPad Air 9.3.1 can be restored?

  • Blue screen hardware malfunction

    I have a laptop Dell XPS M1710 running Vista Ultimate.  30 months, was working fine until about 3 weeks ago when I got a blue screen in the middle of a session with the following message:"hardware malfunctin"."Your system is shut down."Call your sell

  • Windows updates will not download

    I have 16 important updates for windows, but they will not download, the download icon runs forever. Thank you Post proposed by the facilitator for the appropriate forum placed

  • Voice dialing on Storm blackBerry Smartphones

    How can I burn the vocal marks for voice operated dialing?

  • Installation of creative cloud

    I use a Mac with the latest version of the software. I tried to load 'CC' and have uninstalled and reinstalled several times. Every time during the installation, I get the message "" could not start CoreSync: could not create/Library/Application Supp