Artboards and origin

Hi, I'm trying to draw some objects to fixed positions on artboards by first setting the document origin to the top - left position of the artboard. However this seems to work for some of the artboards but not for all.
Sample code:
#target illustrator
// create artboards
var CurrentDoc = app.documents.add ( DocumentColorSpace.CMYK, 595, 841, 12, DocumentArtboardLayout.GridByRow, 50, 6);
var artboardRef = CurrentDoc.artboards;
// loopt through all artboards
for ( var i = 0; i < artboardRef.length; i++ )
   // set page and ruler origin
   var RulerLeft = artboardRef[i].artboardRect[0];
   var RulerTop  = artboardRef[i].artboardRect[1] ;
   CurrentDoc.rulerOrigin = [RulerLeft,RulerTop];
   CurrentDoc.pageOrigin  = [RulerLeft,RulerTop];
   //add text to artboard
   var cTextRef = CurrentDoc.textFrames.add();
   cTextRef.textRange.characterAttributes.textFont=app.textFonts.getByName("Verdana");
   cTextRef.textRange.characterAttributes.size = 27;
   cTextRef.contents = "ArtBoard: "+ (i+1);
   cTextRef.left = +55;
   cTextRef.top = -64;
   redraw();
8 out of 12 artboards get the text at the right position (but not in the right order when I look at the artboards palette). Text for 4 artboards is placed completely outside any of the artboards.
Any help is appreciated,
Michel

Some Math operation is Ok, no need to set origin.
#target illustrator
// create artboards
var CurrentDoc = app.documents.add ( DocumentColorSpace.CMYK, 595, 841, 12, DocumentArtboardLayout.GridByRow, 50, 6);
var artboardRef = CurrentDoc.artboards;
// loopt through all artboards
for ( var i = 0; i < artboardRef.length; i++ )
   // set page and ruler origin
   var RulerLeft = artboardRef[i].artboardRect[0];
   var RulerTop  = artboardRef[i].artboardRect[1] ;
   //CurrentDoc.rulerOrigin = [RulerLeft,RulerTop];
   //CurrentDoc.pageOrigin  = [RulerLeft,RulerTop];
   //add text to artboard
   var cTextRef = CurrentDoc.textFrames.add();
   cTextRef.textRange.characterAttributes.textFont=app.textFonts.getByName("Verdana");
   cTextRef.textRange.characterAttributes.size = 27;
   cTextRef.contents = "ArtBoard: "+ (i+1);
   cTextRef.left = RulerLeft +55;
   cTextRef.top = RulerTop -64;
   redraw();

Similar Messages

  • Problem with editing the size of artboard and objects in illustrator!

    I was using a custom size of artboard in illustrator, but I now I want to change it to A4 size for printing. However, when I change it to a A4 size artboard, the size of objects on that artboard remain unchange. As a result these objects do not fit the new size of artboard. Are there any way that I can change both the size of artboard and objects at once? Thank you!

    Probably not.  Don't suppose you have a proportion scale handy?  Alright, don't worry about it.  Give me the size of your original ( in inches ) and the size of A4 ( in inches ), I can give you the scale percentage ( you input into the scale dialog box ).  Whatever you do, keep your original file and do the enlargement on a "copy" of the original.  You already have the new artboard, not it is just a simple matter of enlarging the artwork to fit the new size.

  • Create element at center of artboard, move to next artboard and repeat

    Hey All! I've been lurking around here for quite some time and i've always been able to find what i needed. Until now. =)
    I'm writing a Javascript to create multiple rectangles on the center of the active artboard and then repeat for all remaining artboards. However, i'm getting hung up on how to shift focus to the next artboard. I've read about  "setActiveArtboardIndex();" but whenever i try to use this feature, i get the error "setActiveArtboardIndex(); is not a function".
    Here's the code i'm working with. Could anyone please tell me how to get the loop to switch to the next artboard before creating the next set of color blocks?
    //Beginning of Script
    #target illustrator
    if (app.documents.length > 0) {
    var docRef = app.activeDocument
    else {
    alert("No Document Open");
    //Add Color Block Layer
    artLayers.locked = true;
    function existBlockLayer(layers, name) {
        for (i=0; i<docRef.layers.length; i++){
            if (layers[i].name===name) return true;
        return false;
    if (existBlockLayer(docRef.layers,"Color Blocks")) {
        var removeLayer = artLayers.getByName("Color Blocks");
        removeLayer.locked = false;
        removeLayer.remove();
        var blockLayer = docRef.layers.add();
        blockLayer.name = "Color Blocks"
    else {
        var blockLayer = docRef.layers.add();
        blockLayer.name = "Color Blocks"
    blockLayer.locked = false;
    //Get Document Swatches
    var swatchList = docRef.swatches;
    var artLayers = docRef.layers
    var aB = docRef.artboards
    var colorList = [];
    for(var k=0; k< swatchList.length; k++) {
        if (swatchList[k].name.toLowerCase() != "thru-cut" && swatchList[k].name.toLowerCase() != "[registration]"//
        && swatchList[k].name.toLowerCase() != "[none]" && swatchList[k].name.toLowerCase() != "cut line"){
           colorList.push(swatchList[k].name);
    //Create 1 Color Block per Swatch and Apply Swatch
    for (var a=0; a<aB.length; a++) {
        var aBLeft = aB[a].artboardRect[0];
        var aBRight = aB[a].artboardRect[2]
        var aBTop = aB[a].artboardRect[1]
        var aBBottom = aB[a].artboardRect[3]
        var W = (aBRight/2);
        var H = (aBBottom/2);
        var posH = (H/2);
        var posW = (W/2);
        alert(W + " width " + H + " height");
        var activeArtboard = aB[a];
        //var aBPlus = setActiveArtboardIndex(a);
        for(var c=0,len=colorList.length;c<len;c++){
            var newBlock = docRef.pathItems.rectangle(posH, posW,10,10);
            newBlock.stroked = false;
        for (var i=0; i < colorList.length; i++) {
            docRef.pathItems[i].fillColor=docRef.swatches.getByName(colorList[i]).color;
    artLayers.locked = false;
    blockLayer.zOrder (ZOrderMethod.SENDTOBACK);
    blockLayer.locked = true;
    Thanks in advance all!

    woah... ok. so what  you posted didn't really work (i had made a revision to that part of the code after my initial post. i realized i was dividing by two twice, so i removed one of those. as a result, i had to remove this "var posW = aBLeft+(aBRight + aBLeft)/2" and i had to add the right edge and left edge instead of subtracting).. but i removed some stuff and switched my variables and now it does work. this is what i ended up doing
    for (var a=0; a<aB.length; a++) {
        var aBLeft = aB[a].artboardRect[0];
        var aBRight = aB[a].artboardRect[2]
        var aBTop = aB[a].artboardRect[1]
        var aBBottom = aB[a].artboardRect[3]
        var posH = (aBRight+aBLeft)/2;
        var posW = (aBBottom+aBTop)/2;
        var activeArtboard = aB[a];
        docRef.rulerOrigin[aBLeft, aBTop]
        aB.setActiveArtboardIndex(a);
        makeBlocks();
    So.. i'm really glad that it's working.. but i don't really know why it is.. as has been the bane of my existence as a self teaching coder.. if you have a moment, could you explain what's different about my part and your correction? I'm sure something like that will come up again in the future and i'd love to know where i went wrong. =)
    I really really appreciate your help, kind friend. pixxxel schubser
    Oh and one more thing, if you could. Is there a cleaner way for me to negate those certain swatches? I know i can put them in an array,  but it doesn't seem to work when it comes time to say "if swatchList[k].name != [array of colors not to use]". I'd like this thing to be as nice and clean as possible when i surprise my boss with it.. Almost like it looks like i knew what i was doing.

  • Add a simple switch to PDF Reader to change between MY-VIEW and ORIGINAL-VIEW

    I would like to open pdf file with my same default viewing preference *every single time* that I open a PDF file, regardless of what the original document creator set as the default view.  It would be nice to have a SIMPLE switch between MY-VIEW and ORIGINAL-VIEW.  It's very frustrating to have to keep switching my view preferences every time I open a new file with a different default.

    Thank you Bernd, but that is only part of the solution.  For example, I do set the Page Layout to 1-page-continuous.  MOST of the time it keeps this setting, but some documents either override that setting, or perhaps it reverts back to a default (maybe with version upgrades?).  The other part is that I always want the menu-bar and toolbar to show up.  Some documents hide these when they open.  I realize that I can hit [F8] and/or [F9] to toggle these, but there are additional settings.  I also want to always have the selection tools available, etc.  Bottom Line: I just want a collection of settings that I can call up with a single, simple shortcut or button, so I don't have to perform multiple steps just to get the tool back to my standard configuration whenever something changes it.

  • CS5 - how to delete artboard AND the art on it

    Hello!
    Is there a way to delete an artboard and everything on it with one command?  I always have to do <shift><o> and <delete> for the artboard, then <esc> and select the art to delete it.

    it's doable with a script, but still 3 clicks away...I don't know if it is more productive for you.
    #target Illustrator
    /* CS5 Only. Deletes the active artobard
        along with the contents. Select something before running.
    var idoc = app.activeDocument;
    var activeAbIndex = idoc.artboards.getActiveArtboardIndex();
    idoc.selectObjectsOnActiveArtboard();
    app.cut();
    idoc.artboards.remove (activeAbIndex);

  • Dispute case -- Co-ordinator and Origin field

    Hi All,
    Dispute case is created. I went into Change mode, trying to populate Co-ordinator field and Origin field. These fields are greyed out and not ready for editing. Even though Attribute profile is changed to modifiable, i am not able to change. Help in this reagard is appreciated.
    Thanks
    Rajanikanth.

    check all of the options in the attributes profile
    on the far right is editable on creation only or something like that.
    the other thing to check is that you are editing the correct attribute profile linked to the dispute case...

  • Data source and origin of ELM&status profile means

    Hi SAP gurus
      Data source and origin of ELM&status profile means ..

    We did delete and recreate...

  • Need help on folders in thumbdrive, external harddisk become shortcut and original folder become hidden

    hi
    I would like to ask whether does Microsoft have a solution on this issue 
     need help on folders in thumbdrive, external harddisk become shortcut and original folder become hidden. and there will be a Recycler hidden folder, inside is a randomName.exe file(with a lady image as the program icon). Once the user click on the
    shortcut of the folders, it will activate the .exe file and install onto Windows and with any pendrive, external harddisk plug to the infected machine all will be affected when plug to a clean machine and the cycle repeat itself.. by infect other
    clean machine.
    Please help as this is affecting my company of 400+ users! on window 7 pro x86 and x64
    the problem is that we have a lot of pen drive, portable external harddisk using in the office..
    thus is there 1 Microsoft patch to solve this issue once and for all... to prevent the autorun to activate?
    Jaslena

    the problem is that we have a lot of pen drive, portable external harddisk using in the office..
    is there 1 Microsoft patch to solve this issue once and for all... to prevent the autorun to activate?
    This is just because of infection is propagated.. As a result files are hidden..  attrib is great as it is suggested by S Guna . May be you can make a batch file or something like that? But there is a chance of reinfection if you don't clean your infected
    systems as well as your pendrives..
    Plug your infected flash drive and 
    Use one scanner at a time
    Download hitman pro 3.7 (shareware and can be activated for 30 days free)and have a full system scan including your pendrive.. http://www.surfright.nl/en 
    And/or
    use malwarebyte have a full system including your pendrivescan http://www.malwarebytes.org/products/malwarebytes_free/
    And/or
    Use Kaspersky Virus Removal Tool  downloaded from uninfected pc and transfer to you pc and install and have a full system scan
    http://www.kaspersky.com/antivirus-removal-tool?form=1
    If everything fails, you can use offline bootable resccue cd and do a full system scan... 
    https://support.kaspersky.com/viruses/rescuedisk
    http://windows.microsoft.com/en-us/windows/windows-defender-offline-faq
    or hitman kickstart bootable pendrive
     http://www.surfright.nl/en/kickstart
    Then 
    (1)Check whether your files are hidden.. Most of the time files and folders are hidden as a result of pen drive malware infection..
    It will change the attributes of the files/folders.
    In that case u can use attrib command and
    attrib -s -h -a -r
    This is how it is used.. attrib method is common for windows
    http://www.pcandtablet.com/windows-7-errors-and-crashes/191/i-cant-view-my-pendrive-contents-in-my-laptop-when-i-plug-pen-drive-and-open-it-it.html
    (2)If data is deleted you can try recuva.. freeware to recover data.
    http://www.pcandtablet.com/windows-8-1-software/1302/how-can-i-recover-shift-del-file-or-file-after-emptying-recycle-bin-in-windows-8-1-a.html
    Hetti Arachchige V Aravinda | Network Administrator (B.Sc, MCP, MCTS, MCSA, MCSE, MCITP, CCNA, CEH, MBCS)| http://www.windowstechinfo.com |

  • How to get the ammendment sales order number and original sales order no?

    Hello sir's,
    Please tell me the table for ammendment(revised) sales order number and original sales order no.
    Thanks in advance,
    vikram

    Solved

  • Why do I have Original TV and Original Television listed

    Ok so I'm new to Mac and iTunes.
    I'm converting and sorting my music collection and have a few Soundtracks from movies and Television shows.
    In the 'Artist' listing I now have seperate sections for TV and Television soundtracks, can I delete one and just use the other?
    Actually I'd like to join: Original Soundtrack, Original TV Soundtrack and Original Television Soundtrack!

    Thanks, you were almost correct
    I had to change the 'Album artist' from the variations of Soundtrack, now they are all 'Original Soundtrack'.
    Cool thanks.

  • HT4623 why my ipphone can not be activated when I updated to IS06? My iphone is 3gs and original locked but now it's offical unlocked before i updated to ISO6

    why my iphone can not be activated when I updated to IS06?
    My iphone is 3gs 8g, and original locked but now it's offical unlocked before i updated to ISO6.
    iphone information:
    iphone 3gs
    Model:MC640LL
    SN:84xxxxEDG
    <Edited By Host>

    That means your phone is now a brick. Congratulations.
    That's a risk you take when you decide to hack the phone.
    You can't get any help here. Discussing hacked and jailbroken devices is forbidden by the terms of service.
    Maybe you can find something on google that will help you.

  • Avoid modified and original folders

    Hello,
    I started to sort my pictures thanks to the roll rather than thanks to the albums. This way, I save times when archiving: no need to export all your albums, you can directly copy the sorted roll folders from your Iphoto library. Those folder can be directly open and your pictures viewed with any kind of software. My problem is the modified and original automatic folders, Because, I need to move the content of the modified pictures into the originals ones and replace the duplicate. It is the way I have found to merge the original and modified pictures of the same roll. Is there a way to avoid the creation of the modified folder. I would like to have all the picture of one roll in the same folder in my photo library. I could make duplicate of the picture I want to keep the original but with all the pictures in the same folder.
    Thanks in advance.
    Aude-Line

    Hi, ohdelyne. What you are trying to do is substitute your own photo organizing scheme for the one that iPhoto imposes, and that enables iPhoto to function. If you do that, iPhoto won't function.
    If you want the benefits that iPhoto offers, you must leave the contents of your iPhoto Library folder exactly as iPhoto has arrranged them. If you arrange them differently, you won't be able to use iPhoto at all, and you shouldn't try. Instead, use a different photo viewing application and do all your organizing manually.
    Some Mac users find iPhoto's inflexible organizing scheme annoying or inconvenient for some purposes and perfectly acceptable for others. Such users (and I'm one) import some photos into iPhoto and let it organize them, and keep other photos in folder hierarchies they've created in the Finder, and use other applications to view, edit and manage them. This can be a fine alternative to handling all one's photos the same way. I have about 100,000 photos on my hard drives, and only about 20,000 of them have been imported into any of my ten iPhoto libraries.
    Maintaining multiple iPhoto libraries for diffferent purposes or categories of pictures can also be very helpful in overcoming the disadvantages of not being able to alter the structure of a single all-encompassing iPhoto Library.
    Message was edited by: eww

  • Diff between ides and original package

    can any one tell me what are main diff between ides and original package
    thanks
    with regards,
    phani

    HI.,
                  IDES saytem is like a play ground in which we do all the transcations,But in Real time systme we dont have as many reference clients as IDES systme have,We have one reference client 0001 In real time systme as their land scape is laid as development,Testing & Production systems
              Important thing is all the screens & T.codes are sames in both
    REWARD if helpfull
    Thanks & Regards
    Narayana

  • RTMPE between Edge and Origin

    Hi,
    I would like to know when this feature will be available. As well as rtmpe between FMLE and Origin.
    Many thanks.

    I will check with product managment about these features and get back to you.

  • How do I rescale artboard and content, but keep the same path width

    Hi,
    I have a project with a lot of artboards with content set-up inside each artboard - actually a series of icons.
    I'd like to resize all of the artboards and the content, keeping the same line widths.
    I can use the 'save for web' feature to scale the existing artboards/content, but I don't want the line widths to be scaled too.
    I have failed to find a script or feature that would allow me to do this and save me from manually resizing every artboard and the content.
    I'll immediately hold my hands up to having a minimalist knowledge of illustrator.
    Any thoughts? I'm surprised it's not a feature of 'save for web'.
    Currently using CS6.
    Thanks,
    Paul

    No, rescaling the paths inside illustrator keeps the path width the same. It's the 'export for web' dialog upscaling the content is also upscaling the path widths. I can understand why it does that, but surprised it it ignores the scaling strokes option and doesn't provide that option itself.
    Thanks for the suggestion, though.

Maybe you are looking for