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.

Similar Messages

  • Is it possible to (selectively) automatically move to next patch and start?

    .. so that (for example) my first three songs play one after the other then MS stops awaiting a play cmd?
    I can't see this anywhere in the help but it must be a frequently used function.

    I don't know a way of doing this so it automatically skips to the next patch to play after the song ends, but there are a few other ways of doing this:
    1. You could combine the three tracks into one and have it play as one Playback. Insert Markers if you needed them for navigation to each of the sections/tracks.
    2. You could have three different plug in's and play/mute the separate channel strips
    3. There is a mixer with backing tracks template that might be useful for the type of performance/functions you need.
    Try any of those, meanwhile, I'll try to think of more options.
    J.

  • Are there any plans to move the "Math Check" to AFTER the O.K. BUTTON is pushed on STEP AND REPEAT?

    One of my pet peeves is that I have to clear all the fields in the STEP AND REPEAT dialouge box before I can begin entering information.  I have been patiently waiting for this bug to be fixed.  I am beginning to wonder if Adobe is even aware of the bug?  It drives me nuts to no end!!!  I am sure it is responsible for several points in my blood pressure reading on given days.  I'll have an object selected that I need to step 7 times and I'll bring up the Step and Repeat dialouge box.  I'll enter 7 in the COUNT field.  InDesign will in some cases immediately flag the operation as not possible because there are numbers in the other two fields that I haven't had a chance to edit yet that will cause the step and repeat operation to go off the pasteboard.  It makes me MAD because it changes my 7 back to a 1 and I have to go and put in the correct values for the VERTICAL and HORIZONTAL offset fields and then I have to go back up to the COUNT field and re-enter my 7.  All of this and I haven't even hit the O.K. button yet!!!  Can someone at Adobe pleeeeeeaaaaaase inform the programmers of this glitch and have them move the MATH CHECK to AFTER THE O.K. BUTTON is clicked!  I wouldn't mind the message if the figures I entered were incorrect and I had hit the O.K. button.  But it drives me absolutely insane when it starts trying to correct me before I've even finished entering my values!
    Am I the only one?
    I would love to hear from anyone else out there that gets frustrated from this.  If for no other reason then to let me know I haven't completely lost my sanity yet.
    Thanks.
    Randy

    O.K. Peter.  I did go and file a report.  I couldn't bring myself though to call it a feature request because I clearly believe it is a bug.  A co-worker of mine and I had a long discussion about it.  He argued your side of things suggesting that the program was working as the programmers intended for it to be and because of that I couldn't call it a bug.  But, I contend that the program IS NOT working as the programmers intended for it to be because if you look at the OBJECT > TRANSFORM > MOVE item in InDesign it also brings up a dialogue box.  This dialogue box also has a PREVIEW check box on it.  If the PREVIEW check box is checked then it immediately evaluates the numbers as you enter them into the various fields.  And if you enter an invalid number it will immediately present the error message.  However, if the PREVIEW check box is left unchecked then it waits until you press the O.K. Button before evaluating the numbers and executing the move.  The STEP AND REPEAT dialogue box should behave the same way but it doesn't.  It behaves as if the PREVIEW check box is checked whether it is or not.  So that is a BUG in my humble opinion.
    Thanks for your help in pointing me to the correct form.  I'm usually so busy working that I never have time to look that kind of stuff up.
    Randy

  • Revenue element-cost center

    During automatic cost element creation, I included one of gl sales accounts which is a revenue element. (cat 11). Now when I try to post entry to this sales account, it asks for cost object (cost center?). Now I really do not want to include this sales account (rev element) in any cost center. Am I forced to create a cost center for sales so that I can post gl or customer invoice to this sales account? Or should I delete the revenue element?  I wanted to seperate all my sales accounts and group them  to a department (cost center? profit center?).
    Thanks
    Rashid

    Hoi Rashid,
    You can change filed status group or create a validation with an user exit.
    In the validation you say when the costcenter is posted on a cost element type 11 or 12 (and other cost objects) is <> blanc give an error.
    You can say to on the cost centers in the tab Control that it is not allowed to post actual revenues on the cost center
    Paul

  • Cost Element Cost center breakup

    How can i craate a report painter report for Cost element, cost center breakup???
    pl help in creation.
    Regards
    Reddy

    Go to GRR2.  Double-click on the row All Values under Cost Elements/Costs Centers.  Remove cost center in the pop up screen and click on the check mark to continue.  Now,  create another column for the cost center.  Bear in mind that, you can only do this in the copy you created.
    Please disregard my earlier suggestion.  Because if you do, it will change the whole format of the report and will not produce a suitable result.
    Regards,
    Elias
    Edited by: Elias Akorli on May 17, 2010 11:01 AM

  • Create Substitution Profit Center when billing

    Dear all
    How to create substitution profit center and this the requiredment:
    When i create billing VF01 there is tax account 21117106 and i want to substitute profit center in that account, since i maintain 3KEH.
    i have create substitution like this, in GGB1 ,>cost accounting> line item >step 1>COBL-SAKNR = '21117106' and COBL-VKORG = '3000'
    why this not worked, did i miss other config? how to assign tcode in substitution, like just valid in VF01?
    please help
    Best Regards
    adit

    Hi Aditya
    Tax account is a balance sheet account which will never flow into CO at all.. So, your CO subst will never be called for this line item
    Subst in CO can be written only for Cost Elements
    Subst in EC-PCA can be written for populating profit center in Sales orders
    But, Subst in FI can be written for all GL accounts, especially the balance sheet ones
    Hope, it is clear... You need to write subst in FI, and not in CO for VAT line item
    Regards
    Ajay M

  • Create new Profit Center?

    Hi,
    We want to create 2 new profit centers. What are the necessary steps to be consider before create a new profit center? Is it reqd to create Profit Center Group, Standard Heirarchy, Dummy Profit Center etc., I am very new i.e., y am asking basic things.
    Is there any way to copy from existing profit center? or can i copy profit center group from existing PC group in TC: KCH1? If i can do this i think all profit centers are copied to new PC group. How to achive this?
    Thanks

    Hi
    1. set controlling area (OKKS)
    2.maintain controlling area settings(OKE5)
    3.create dummy profit center(KE59)
    4.set control parameters for actual data(1KEF)
    5.maintain plan versions(OKEQ)
    6.allow balances to be carried forward(2KET)
    7.maintain standard hierarchy(KCH4 in IMG  or KCH1 in Easy Access)
    8.Create profit center(KE51)
    9.Assignment of profit centers in cost centers(KS02)
    10.creation of revenue elements(KA01 or FS00)
    11.maintain automatic account assignment of revenue elements(OKB9)
    12.defone number ranges for local documents(GB02) both for actual and plan documents.
    13.choose additional balance sheet and P&L accounts(3KEH)
    These are the configuration steps.
    Standard hierarchy and dummy profit centers must to be created before creation of profit centers.
    Regards
    Venkat

  • How to create New Work Center

    Dear Experts
                      How to create New Work Center?, what are all the inforamtions  need while creating workcenter.
    Regards
    Rajakarthik

    Hi,
    In addition to the above post, you need to identify that:
    1. Whether you need separate activity types and cost center for the newly created work center. These details are entered in the Costing View of the Work Center.
    If these are required then use KL01 to create new activity, KP26 to define the activity price.
    If required create cost element using T Code KA01 and Cost Center using KS01.
    Take help from the CO guy on this.
    2. Also  you need to ask the concerned about the operating times for the wor center. That is Start time and End time of WC. It is used for capacity evaluation and scheduling of the orders. It is maintained in the capacity view (Bottom left Button in the view).
    this view will also contain the details regarding the calendar, to be assigned to the work center, if needed. Collect details for this requirement. Also you can assign a different calendar to WC apart from factory calendar.
    3. Find out whether this WC will be operating in shifts or not. Accordingly maintain the details.
    Hope it is useful for you.
    Revert for clarifications
    Regards,
    Rohit.

  • I have created several short (3-5 minute) movies using iMovie 10.0.6 and Yosemite.  I want to create one movie that includes these short movies that I can then either burn to a DVD or show in iMovie's Theater.  How can I do it?

    I have created several short (3-5 minute) movies using iMovie 10.0.6 and Yosemite.  I want to combine those short movies into one movie that I can loop and burn on a DVD or show in iMovie Theater.  How can I do it?  The movies are now shared to iTunes.

    Another easy way to fix this.
    What I've noticed is that upon upgrading your projects and events to work with iMovie 10, initially it will work... Until you quit iMovie and reopen it again. Any events with hashtags will show up without the star next to the iMovie event. SO, if you happen to read this, after upgrading to iMovie 10 from its predecessor, immediately change the event name to NOT include a hashtag/pound symbol.
    Otherwise, if it's too late, you can either do the above or this...
    Hold down option and click on iMovie. This will prompt you Locate, Create a New Library, Cancel this window, or Choose a different library. What you want to do is create a new library, call it whatever you want to, this will only be temporary. After the program opens, it should be a blank Library. Then go to File > Open Library > iMovie Library (your original library) and proceed to change the name of your events. Quit the program. Go into your Movies folder in Finder, delete the library you temporarily created, and your back in business.

  • How do you connect your photoshop elements on your computer to your account online? and how do you create a customized url? how does the gallery work and how do you access it? i have trouble signing in on my program from my computer to connect to the onli

    how do you connect your photoshop elements on your computer to your account online? and how do you create a customized url? how does the gallery work and how do you access it? i have trouble signing in on my program from my computer to connect to the online photoshop, and I really want to create my own customized url and post photos to my gallery and share them with the world, family, and friends, but i need help because i can't figure how to do any of this, would really appreciate feedback and assistance, thanks, - claire conlon

    To add to sig's reply, "calibrating" does not calibrate Lithiu-Ion batteries, it calibrates the charge reporting circuitry.  If you look at the effect of deep discharging Lithium-Ion batteries in the data from the independent test group, Battery University, you will see that doing so shortens the life of the battery significantly. It looks like an optimum balance between use and life is at a discharge level of 50%.

  • Error during creating a work center

    Hello everyone,
    I am creating a work center and i get the error , activity type not set up in cost center ( error message cr061) . I tried doing all the possible settings , tried in kp26/kp27 . but didnt work . Can anyone give me the solution .
    thanks & regards ,
    Bhavna

    Hi
    Go to costing tab in the work centre and assign activity type and cost center to work center.
    regards
    Srinivas

  • I can no longer drag and drop things in Photoshop Elements 12. I can move things with my keyboard, but not my mouse. WHAT IS HAPPENING?!

    When I got Elements 12 (May 2014), I was able to drag and drop things such as cut/pasted items, watermarks, etc. As of 2 weeks ago, I can no longer use my mouse to drag and drop. If I try, it just snaps back wherever it was before I tried to drag it. With that said, the item will move if I use my keyboard. It takes an eternity. WHAT IS GOING ON?! I just really want to use my mouse again...

    Install the 10.10.1 update. That should do it.

  • Adobe Premiere Elements 12 doesn't import MOV Files

    Hi, All!
    I'm working on Windows 8.1 64 bit and use Adobe Premiere Elements 12. I've downloaded and installed on my PC latest version of Apple QuickTime 7.7.4.1680.86 from http://www.apple.com/quicktime/download/
    I've trying to use some free stuff from http://www.detonationfilms.com/Stock_Directory.html and mix it with my video. You may download example of Pre-Keyed Explosions using direct link: http://www.detfilmsshockwave.com/DVExplosion01.zip or any other stuff from this site...
    ...but my Adobe Premiere Elements 12 with installed the latest updates doesn't import these MOV Files with codec PNG Image
    In fact, Apple does not offer ProRes components for QuickTime on Windows, but I don't know do this problem interact with my trouble?
    IMHO, it's best  to look at the crash logs for QT32Server! I've found executable QT32Server on my PC in next folder:
    C:\Program Files (x86)\Adobe\Elements 12 Organizer\CAHeadless\32\Adobe QT32 Server.exe, but can't found any import logs on my Windows 8.1 including hidden folders. I have trying to check the windows events log for errors %windir%\system32\eventvwr.msc /s but it contains no necessary items.
    I have trying to re-install version 6.5.2 of Apple QuickTime, but without success. May be I must try to install any other older version, i.e. 7.5.5 ?
    I think perhaps such behavior of Adobe Premiere Elements 12 is in design?
    May be I'd try third party free video converter, like SUPER e.t.c. to convert MOV container to AVI?
    Please help me to find a way to fix this problem.
    Sincerely yours,
    JennyK
    http://jennyk.ucoz.ru

    Jenny Koltsova
    What is this "codec PNG image" that is contained/wrapped by the .mov format? What are the video and audio properties of this video...frame size, frame rate, interlaced or progressive, pixel aspect ratio, et al.
    It sounds like you have Premiere Elements 12 is running on some version of Windows with QuickTime (latest version) installed on the same computer as Premiere Elements. Great. Requirement for QuickTime met.
    Where is this PNG.mov coming from? And what type of .avi were you thinking to convert to?
    Premiere Elements 12 Publish+Share/Computer/QuickTime does offer an export with a PNG video codec with the .mov file extension. I am in the process of exporting my Timeline to that type of file and then determining if I can import that back into Premiere Elements 12 project.
    When your png.mov will not install into Premiere Elements 12 on Windows 8.1 64 bit, what is the specific message that you are getting from the program at that time.
    More shortly after my export of the png.mov is finished. Any minute now.
    ATR
    Add On....The png.mov produced by Premiere Elements 12 Window 7 64 bit could be imported into a Premiere Elements 12 project. I am now going to my laptop which has Premiere Elements 12 on Windows 8.1 64 bit to do the same thing and see what happens there. Back soon.

  • Profit center document created but profit center not updated in FI document

    Hi Experts,
    I have a strange issue; we created FI document via billing document (SD) where in profit center document got created but profit center is not updated in FI document.
    We have separate table to identify the profit center by customer.
    Please let know what could be the cause or reason for this kind of scenario
    Thanks,
    VK

    Hi Krishna,
    Though ur question seems very old, but now i got the same requirement as like you.
    So if you remeber what needs to be done for this issue thats very good help to me.
    My Requirement is : I have created Service Entry Sheet by referring PO and while releasing this Service Entry Sheet system is generating MIGO Doc and FI documents in background.
    And I have updated PERNR (Persnoal No.) in MSEG-SGTXT by using enhancment but it's not populating in BSEG-SGTXT.
    And I found an internal table while debugging i.e ; like ACCIT (not exactly ,similar to this ) where i have updated pernr and sgtxt but same thing will not available in FI Doc display (BSEG-PERNR or BSEG-SGTXG)
    So could you plz suggest what needs to be done to achieve this. Im assuming that, is it possible through BTE (Business Transaction Events) ?.  if yes, plz tell me how to proceed.
    Thanks
    Madhan

  • Unable to create the Profit center groups

    Hi,
    We have created new company codes in R3Dev and also created the
    validation rules for the same. We have assigned the Set ID's to the
    validation rules. These Set ID's gets created when profit center groups
    are created for the new company codes.
    We have transported the company code configuration settings and the
    validation rules to R3QA.
    Now in R3QA, when I try to create the profit center groups in KCH5N for
    the new company codes, it says "the group already exists".This is
    caused due to the SET ID's which also got transported along with
    validation rules. I have checked the table 'SETHEADER" which shows the
    SET ID's for the new company codes.
    Could you please a solution to resolve this issue.
    Thanks
    Rakesh

    Hi Mohan,
    Since Set Id's have moved to quality along with vaidation rules, I am to create the profit center groups, as it says the group already exists. I believe the set Id's need the master data maintained in R3Q, before they are transported. Since this is not maintained, with the transport, the data is sitting for Set Ids at the table level (Table: SETHEADER),  because of which I am to unable to create the profit center groups.
    Thanks,
    Rakesh

Maybe you are looking for