Repeat for each artboard problem

I have a script that make makes guides around the edge of the artboard. It works fine when you only have one artboard but has issues when there are more. Can anyone see what's wrong here?
#target illustrator
var docRef = app.activeDocument;
var artboardRef = docRef.artboards;
//repeat for each artboard
for(i=0;i<artboardRef.length;i++){
  //get artboard size
  var left=artboardRef[i].artboardRect[0];
  var top=artboardRef[i].artboardRect[1] ;
  var right=artboardRef[i].artboardRect[2] ;
  var bottom=artboardRef[i].artboardRect[3] ;
  //create lines
  var lineLeft = docRef.pathItems.add();
  var lineRight = docRef.pathItems.add();
  var lineTop = docRef.pathItems.add();
  var lineBottom = docRef.pathItems.add();
  //set line points
  var leftmargin = (72);
  var rightmargin = (72);
  var topmargin = (72);
  var bottommargin = (72);
  //set line points
  lineLeft.setEntirePath([[leftmargin, 0], [leftmargin, bottom]]);
  lineRight.setEntirePath([[right - rightmargin, 0], [right - rightmargin, bottom]]);
  lineTop.setEntirePath([[0, 0 - topmargin], [right, 0 - topmargin]]);
  lineBottom.setEntirePath([[0, bottom + bottommargin], [right, bottom + bottommargin]]);
  //make lines guides
  lineLeft.guides = true;
  lineRight.guides = true;
  lineTop.guides = true;
  lineBottom.guides = true;

you have hard coded "0", it needs to be changed to variables, otherwise it will point to the same x or y coordinates
//set line points
  lineLeft.setEntirePath([[left+leftmargin, top], [left+leftmargin, bottom]]);
  lineRight.setEntirePath([[right - rightmargin, top], [right - rightmargin, bottom]]);
  lineTop.setEntirePath([[left, top - topmargin], [right, top - topmargin]]);
  lineBottom.setEntirePath([[left, bottom + bottommargin], [right, bottom + bottommargin]]);

Similar Messages

  • When working with multiple artboards, are there separate layers panels for each artboard?

    Just started working with multiple artboards in ai but have read nothing about the layers panel, whether you use one layers panel for all the artboards or if the layers panel is duplicated so there is one for each artboard.

    I don't really understand your problem, but I've had headaches with managing a GUI before (as many programmers have, I'm sure).
    My best advice, if the scheme your using to build and manage a GUI is too confusing for you, the programmer, to easily understand/manage, change the scheme. Even if this means recoding a good deal of your program (though, hopefully, you've kept the GUI as seperate from your functional code as possible) it should be worth it.
    Perhaps a clearer explination of your problem would help better illustrate your problem?
    -Rejun

  • New layer for each artboard

    Hi,
    I've just recently started learning Illustrator and have used photoshop for a long time.  I have been getting on OK and yesterday had a file open with about 4 different artboards (was making wedding invitations) and went to start a 5th one and decided to add a new layer to this artboard and it then struck me that all the artboards had exactly the same layer!  Now as a photoshop user this bamboozled me and the photoshop part of me gets annoyed, because I would like every artboard to have a different set of layers so that they are always separate.  Can anyone tell me if I'm just not grasping how illustrator does things or is there a way to set up illustrator to have a new set of layers for every artboard?  Is it just a case that I have to create a new layer for each artboard manually?
    Sorry if this is a basic question, but I've searched for this answer but couldn't find it.
    Cheers in advance.
    Oh and just in case, I'm using CS5 on an iMac.

    and the photoshop part of me gets annoyed
    You need to "turn off" the photoshop part of you when working in Illustrator. Two entirely different worlds, and rightly so.
    because I would like every artboard to have a different set of layers so that they are always separate.
    If that's what you want, there are other programs in Illustrator's category which provide that. Corel Draw X3 is one example. In real use, though, page-specific layers is not the panacea you may think. It has resulted in much tedium and confusion and consternation in the Draw community.
    If you insist on working that way, there's no reason you can't set up your file with top-level Layers coresponding to each Artborad. But you'll probably soon find it more cumbersome and tedious than actually practical.
    Forget trying to think of Illustrator Layers and Photoshop Layers as similar things. They are not. Two entirely different constructs. That's a good thing. They should not be made to "work alike." If anything, Photoshop just needs to change the name from "Layers" to "Films" or "Overlays" or something like that, to help stop this widespread misconception among newcommers.
    JET

  • XML INVOICE Report RAXINV, Taxline is repeating for each invoice line

    Hi Tim
    Thanks a lot for your blog
    Greeting !!
    I have successfully created XML report for AR invoice Printing learning from your blog but stuck to a problem , whenever Invoice is having multiple lines ,say 20, then for each invoice line there is tax line printing 20 times like this:
    PART NO.| CUSTOMER PART#/DESCRIPTION | UNIT PRICE | QUNTITY|
    A123 | 34 WELD-ROD | 52 | 22 |
    Tax Exempt @ 0.00
    A234 | 238-AL WIER | 63 | 55 |
    Tax Exempt @ 0.00
    ........ Assume there are 20 lines then tax line also repeating 20 times which i don't want .It should get printed only once if it is same
    pls help me to achieve this
    Thanks
    Rahul

    Thanks Tim for Your Instant reply.
    I have gone through your duplicate line elimination but my requirement is not this
    I'll explain it, I am using LINE_DESCRIPTION tag for printing item description and this tag have two value for it, when the LINE_TYPE =LINE then LINE_DESCRIPTION tag is printing the line description and if LINE_TYPE =TAX
    then LINE_DESCRIPTION tag is printing the taxline information. Now if I have 20 lines in Invoice then the tax line will also repeat for 20 times, and if i use duplicate line elimination logic and I have same item it'll not print that item, some times whole invoice become blank.
    So I want to print 20 lines and out of that 15 lines are have same tax rate then it should print once at the end of 15th line and for remaining 5 lines if tax rate is different for each line then it should print at the end of each line (5lines)
    In the linetreevariable i used <xsl:variable xdofo:ctx="incontext" name="invLines" select=".//G_LINES [LINE_TYPE!='FREIGHT']"/> i.e. I want only line type=LINE and TAX
    Thanks
    Rahul

  • Independent layer sets for each artboard

    Currently the layer structure is the same over all artboards in a document. I would like to  start a new artboard with layers independent of the existing ones. A layer set will depend on the kind of artwork you create on a particular artboard, and is meaningless when you start a new artboard. So I would suggest to start each artboard with its single default layer, and add new layers only for the artboard I'm currently working on.
    Extra credit for the option to copy a layer structure from one artboard to another, though I'm not sure I'd use that much.

    Great idea/suggestion. It seems so logical and straightforward I am bewildered that this feature is not yet included in Illustrator.

  • Header row repeat for each page?

    Hi all. I have a rtf template with a table with 4 rows and lets say there 4 rows are headers but doesnot have any formfields....
    I have a seperate table with form fields beneath it. I need my header tbale to be displayed on each page in output.
    I am unable to do it.
    It is really urgent.
    Can any one please help.
    I searched for solutions in this forum. It didn't work.

    Hi ,
    Check this i think it will helpful for you
    http://winrichman.blogspot.com/2008/09/repeat-table-header-in-all-pages-in-bip.html
    see the comments also in that link...
    Thanks,
    Ananth

  • Pages paragraph headings repeating for each page

    The heading for my doc is repeated at the top of each page, when I only want it on the first page. How do I limit a heading to the first page?

    Insert a Section Break at the end of page 1 and set the subsequent pages to not Continue on from Previous.
    Peter

  • Message output(IDoc) from MIGO creates multiple idocs repeats for each line

    Hi Experts,
    We want to send one idoc message thru MIGO output message control upon posting at HEADER level regardless of how many line items are there on the Purchase Order.
    Using MIGO we are doing a 101 goods receipt on a PO with 3 line items and we are getting 3 idocs created with the same information form the message output control(basically it is at item level).
    I don't know if this is how standard SAP designed the MM message output control.
    From MIGO or MB03 there is no option to display the messages at the header level because you have to go thru the line item details to see the messages
    I have also tried the collective slip option on MIGO and it did not work(help suggests that it will combine everything in one output)
    Can you please let me know if there is a config or development that needs to made on controling the message output at the header level from MIGO.
    Thanks for all your help
    Shraj

    Hi Sri hari Raju.
    Did you solve this problem?
    Can you tell me how?
    Thanks

  • Export Crosstab to Excel : Header Columns repeated for each page !

    Post Author: maagik
    CA Forum: Exporting
    Hello,
    I work with CR 10 and I want to export a crosstab to excel through the api included in VS2005. I choose an export standard. The excel file is right generated BUT in each page break, the header columns are repeated. I don't want to have the header colums because users made some post calculation in the generated files. Does anybody have an idea to remove it ?

    Hi Kranthi
    You can try exporting your report to Excel Data only format as it retains the column width.
    While exporting apply the options like Maintain Column Width etc (as per your requirement).
    Hope this helps!!
    Regards
    Sourashree

  • Image repeates for each page

    I have insert an image in the main section it reapeats for every page.
    If I insert the image in the header it display on the fisrt page..without any data
    I want to display the image just on the first page of the output.How do I do that???

    Create a field , say field_a in your layout and give it a source of page number. Make it invisible.
    In the format trigger for the image try this code:
    if :field_a = 1 then return(true)
    else
    return (true);
    end if;
    Good luck

  • I have several recuring alarms set up on my calendar for each day of the week. In the past few weeks, an alarm will occasionaly notify me roughly 15 minutes to an hour and a half late. These daily alarms are identical and repeat every day.

    I have several recuring alarms set up on iCal for each day of the week. In the past few weeks, an alarm will occasionaly notify me roughly 15 minutes to an hour and a half late. These daily alarms are identical and repeat every day and there seems to be no apparent pattern to why or when an alarm happens after the event is past.

    I assume you meant iCal rather than iTunes? Yes, iCal the time zone is correct. The delayed alarms only happen sporadically. Since I posted this message, the problem stopped happening every day at the same time, but it still happens occasionally with no rhyme or reason as to when. It's gotten so that I can't depend on my iCal alarms anymore.

  • 1 computer, 3 Mac OS user accounts, iTunes account for each Mac OS user, authorization problems

    We have 4 computers for 3 people in our household: 1 iMac (recently purchased), 1 MacBook Pro, and 2 MacBooks. We were previously running off of just the MacBooks (1 for each person), but we decided to buy the iMac and use it as a hub for all of our pictures, music, movies, etc. We were sold on this idea after learning about the "Automatic Downloads" feature, where all content would 'just sync'. We each have a separate Mac OS user account on the iMac, with our own separate content libraries. We each have a separate iTunes/AppStore account. It seems like a good idea until...
    When I tried to turn on Automatic Downloads in iTunes on my iMac, I got this message: "You can auto-download purchases on this computer with just one Apple ID every 90 days. You cannot associate this computer with a different Apple ID for 87 days". I tried to turn on Automatic Downloads on my MacBook Pro, when I got this message: "You can auto-download purchases on this computer with just one Apple ID every 90 days. You cannot associate this computer with a different Apple ID for 90 days". I did not necessarily want to download the apps/music/books to this computer anyways, as the reason we bought the iMac was to serve as a hub for all of this content, but it was still frustrating to see that message.
    I have tried everything suggested on the authorization troubleshooting pages and forums (e.g., authorizing, de-authorizing and de-athourizing all, and reauthorizing), but I have not had any success. I have contacted Apple several times, but I get tips on how to ensure that I have the most up-to-date version of iTunes on my computer, or how to manually download pre-purchased content. I will not begin to explain how frustrating these low-level responses are when the issue is much larger.
    I have a few theories of why this is happening, one of which is that we will only be able to authorize one of the users iTunes accounts to this iMac (despite the fact that we are using separate Mac OS user accounts). This may be the case if iTunes authorization identifies or registers the computer based on its serial number (or some other unique identifier), rather than the Mac OS user account. If that is the case, then I suspect that purchasing this iMac as an automatic download hub for 3 separate Mac OS users was pointless, and I will gleefully warn anyone away from trying to do that.
    So my question(s) read(s): How does iTunes account authorization identify/register with the computer? Is it authorized to the computer serial number, or could it be authorized to a Mac OS user account?
    However, if my above theory is true, then my question is: Do I have any other options?
    Thanks!

    I just had this problem because I logged into a friend's account on the computer I'm on now, and used the Previous Purchases feature. Well, that in turn deactived my use of the iCloud and iTunes Match on this computer when I signed back into my personal iTunes account. iTunes Support was no help, they just gave me a scripted response I would find online myself. Tried many different things, but what actually worked, was changing the Computer Name on this computer, and rebooting. Now, iTunes recoginzes this computer as a new device, yet, still is one of the 2 authorized computers on my iTunes account. Try changing the Computer Name on your troubled machine, then try associating it once again, see how that works out for you.

  • Problem For/Each statement (or the problem is the MouseListener...)

    Hi guys,
    I'm making a program in java for school.
    Now I have this:
              for(Stap2TrampolineModel trampoline : lijstTrampolines)
                   trampoline = new Stap2TrampolineModel(0,215,100,"Poing",lijstKinderen); //model
                   trampolineView = new Stap2TrampolineView(trampoline); //view
                   trampolineController = new Stap2TrampolineController(trampoline, trampolineView); //controller
                   trampolineView.setBounds(trampoline.getXInvoer(),trampoline.getYInvoer(),trampoline.getFormaat()+1,20);
                   add(trampolineView);
                   repaint();
    and in the mouselistener this:
    public void mouseClicked( MouseEvent e )
              System.out.println(lijstTrampolines.size());
              // Onderzoek of met de rechterknop is geklikt
    if( e.isMetaDown() )
         // x = e.getX(); (for later needs)
    //y = e.getY(); (for later needs)
    lijstTrampolines.add(trampoline);
    repaint();
    The program should display a "trampoline" when I click...but it doesnt. It is added to the list, because I can see that in the console because of the System.out.println
    But it doesn't show the display I want. When I delete the for each statement, it does show the "trampoline". So the mouselistener works (it gets added when I click) and the arraylist works (it shows that in the console), but the for each statement doesnt work...
    Anyone knows how to solve this problem?

    Where is this foreach loop located? In inialisation presumably. But that's over and done with when your mouseListener is called. I'd guess your list is empty when the loop is called, and it does nothing.
    Your mouse listener, when it adds a trampoline must also add a trampoline view object. And the repaints don't do you any good, use revalidate() after adding a trampoline view to recalculate the layout.

  • Footer information not repeating under for-each

    Hello,
    I am trying to customize Loan Statement to show the first as summary and the rest for the details for each loan. I need to print Payment information and Bar Code at detail level for each loan. In order to control the position of the bar code, I have to put the payment stub in the footer. But the information under the footer is not repeating the information for each Loan instead it only shows the information for the first loan. Could anyone please help? Thanks.

    Hi
    Can you tell me how you are exporting to Excel? The correct way to export a Crosstab is to select the Export to Pivot Table option from the file menu and not by clicking the Export to Excel button on the tool bar.
    If this does not help, out of the box, Discoverer suppresses the repeated Group Sort items and sends a Blank space.
    This behavior is controlled in a pref.txt setting called ExportGroupSortedItemsAsBlank on your Discoverer server. When set to 1, Discoverer exports non breaking rows as empty cells, when set to 0 the value of the group sorted items are repeated. However, according to the comments this is supposed to only affect exports to CSV and TXT.
    Best wishes
    Michael

  • Problem to calculate the coherence (using NetworkFunction-VI) with only 1 row of data for each, the stimulus and response input

    Hello,
    I am trying to calculate the coherence of a stimulus and response
    signal using the Network Functions (avg) VI's. The problem is that I
    always get a coherence of "1" at all frequencies. This problem is
    already known (see KnowledgeBase document: Why is the Network Functions (avg) VI's Coherence Function Output "1"?).
    My trouble is that the described solution (-> the stimulus and response input matrices need to have at least two rows to get non-unity coherence values) doesn't help me much, because I only have one array of stimulus data and one array of response values.
    Thus, how can I fullfil the 'coherence-criteria' to input at least two rows of data each when I just have one row of data each?
    Any hint or idea is very much appreciated. Thanks!
    Horst

    With this weird board layout, I'm not sure whether you were asking me, but, on the assumption that you were, here goes:
    I found no need to use the cross-power spectrum and power spectrum blocks
    1... I was looking for speed.
    2... I already had the component spectral data there, for other purposes. From that, it's nothing but addition and multiplication.
    3... The "easy" VIs, assume a time wave input, as I recall. Which means they would take the same spectrum of the same timewave several times, where I only do it once.
    I have attached PNGs of my code.
    The PROCESS CHANNEL vi accepts the time wave and:
    1... Removes DC value.
    2... Integrates (optional, used for certain sensors).
    3... Windows (Hanning, etc. - optional)
    4... Finds spectrum.
    5... Removes spectral mirrors.
    6... Scales into Eng. units.
    7... From there, you COULD use COMPLEX-TO-POLAR, but I don't care about the phase data, and I need the MAG^2 data anyway, so I rolled my own COMPLEX-TO-MAG code.
    The above is done on each channel. The PROCESS DATA vi calls the above with data for each channel. The 1st channel in the list is required to be the reference (stimulus) channel.
    After looping over each channel, we have the Sxx, Syy, and Sxy terms. This code contains some averaging and peak-picking stuff that's not relevant.
    From there, it's straightforward to ger XFER = Sxy/Sxx and COHERENCE = |Sxy|^2 / (Sxx * Syy)
    Note that it uses the MAGNITUDE SQUARED of Sxy. Again, if you use the "easy" stuff, it will do a square-root operation that you just have to reverse - it is obtained faster by the sum of the squares of the real and imag parts.
    Hope this helps.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks
    Attachments:
    ProcessChannel.png ‏25 KB

Maybe you are looking for