Number of selected objects.

Hello,
is there an option to see how many objects I have included in my selection?
Peter "Insomnia" Spier - any ideas?
Paul

I do have work to do. Really!
But playing is more fun...
This displays the levels of nesting (if any):
// Change the following line to false if you want groups listed as single objects
var getGroupObjects = true;
var sel = app.selection;
if(!sel || sel.length==0){
    alert("No Objects Selected");
    exit();
nestedLevels = 0;
var objectNames = GetObjectNames(sel,getGroupObjects,0);
objectNames.sort().reverse();
var alertText = ""+ objectNames.length +" Objects Selected";
if(nestedLevels){
    if(nestedLevels == 1){
        alertText = alertText += " (1 Level of Nesting)";
    else{
        alertText = alertText +" ("+ nestedLevels + " Levels of Nesting)";
alertText+=":\r"
var lastName = objectNames.pop();
var curName = "";
var i=1;
while(objectNames.length){
    curName = objectNames.pop();
    if(curName == lastName){
        i++;
    } else {
        alertText += i + " " + lastName +"s\r";
        lastName = curName;
        i=1;
alertText += i + " " + lastName +"s\r";
alert(alertText);
function GetObjectNames(objs,getGroupObjects,level){
    var retVal = [];
    for(var i=0;i<objs.length;i++){
        if(getGroupObjects && objs[i].constructor.name == "Group"){
            level++;
            if(level>nestedLevels){nestedLevels=level}
            retVal = retVal.concat(GetObjectNames(objs[i].pageItems.everyItem().getElements(),getGroupObjects,level))
        else{
            retVal.push(objs[i].constructor.name);
    return retVal;
Harbs

Similar Messages

  • Script to apply a random CMYK swatches from a group of swatches to selected objects.

    I would like to write some scripts for randomising the allocation of swatches to adjacent object.
    Example:
    Imagine a map of Europe and all her nation states/territories. I have a User Defined Swatch Library. I can open the AI document it was made from as I understand from this thread that having the swatches as objects on the page makes them easier to be referenced in a script. 
    I want to iterate through the selected objects and randomly assign one of the colours in the swatch document as a fill to each object. It would be great if hidden swatches (they are all small rectangular 'colour chip' filled paths) on page were not included in the reference swatches randomly choosen from.
    Iterating the selected objects I can do, but not sure what references I need to use to create an array of swatches to randomly choose from.
    I see I can make an array of swatches using the general swatch group from Adobe's CreateSwatchGroup scripts:
    JS
    var docRef = app.documents.add(DocumentColorSpace.CMYK)
    // Create a new SwatchGroup
    var swatchGroup = docRef.swatchGroups.add();
    swatchGroup.name = "CreateSwatchGroup";
    // Get list of swatches in general swatch group
    var genSwatchGroup = docRef.swatchGroups[0];
    // Collect 5 random swatches from general swatch group and move to new group
    var i = 0;
    while (i < 5) {
              var swatches = genSwatchGroup.getAllSwatches();
              swatchCount = swatches.length;
              var swatchIndex = Math.round(Math.random() * (swatchCount - 1)); // 0-based index
              // New swatch group does not allow patterns or gradients
              if (swatches[swatchIndex].color.typename != "PatternColor" && swatches[swatchIndex].color.typename != "GradientColor") {
                        swatchGroup.addSwatch(swatches[swatchIndex]);
                        i++;
    // Updates swatch list with swatches moved to new swatch group
    swatches = swatchGroup.getAllSwatches();
    // [… etc etc]
    AS
    tell application "Adobe Illustrator"
    activate
              set docRef to make new document with properties {color space:CMYK}
    -- Create a new SwatchGroup
              set swatchGroupRef to make new swatchgroup in current document with properties {name:"CreateSwatchGroup"}
    -- Get list of swatches in general swatch group
              set genSwatchGroup to swatchgroup 1 of docRef
    -- Collect 5 random swatches from the general swatch group and move to new group
              set i to 0
              repeat until i is 5
                        set swatchesRef to get all swatches genSwatchGroup
                        set swatchCount to count every item in swatchesRef
                        set swatchIndex to random number from 1 to swatchCount
                        set currentSwatch to item swatchIndex of swatchesRef
      -- New swatch group does not allow patterns or gradients
                        if class of color of currentSwatch is not pattern color info and class of color of currentSwatch is not gradient color info then
      add swatch swatchGroupRef swatch currentSwatch
                                  set i to i + 1
                        end if
              end repeat
    -- [… etc etc]
    If someone can help me to create the Swatch Array object of swatches loaded from a seperate document (or unique layer) then I think I can work my way to changing the fill on the existing paths (the nations in my map of Europe example).
    Would be very cool if I could detect neighbooring paths (nieghbooring nations in my map of Europe example) make sure the colour being assigned is not within a certain hue/CMYK range of the random colour and if it is rechoose random colour. I have no idea how to perform the logic of determining neighbooring paths in an Illustartor script. Anybody?!
    I'd prefer Applescript for sake of readiblity and also I'm learning AS ATM. Plus I'm using Script Debugger.app (which is excellent) to work with AS and I can't seem to run JSX scripts from within Extend Script Toolkit 2 (perhaps I need to make my scripts point to Illustrator?)
    But Javascript is okay if someone has this covered already :-)

    I would like to write some scripts for randomising the allocation of swatches to adjacent object.
    Example:
    Imagine a map of Europe and all her nation states/territories. I have a User Defined Swatch Library. I can open the AI document it was made from as I understand from this thread that having the swatches as objects on the page makes them easier to be referenced in a script. 
    I want to iterate through the selected objects and randomly assign one of the colours in the swatch document as a fill to each object. It would be great if hidden swatches (they are all small rectangular 'colour chip' filled paths) on page were not included in the reference swatches randomly choosen from.
    Iterating the selected objects I can do, but not sure what references I need to use to create an array of swatches to randomly choose from.
    I see I can make an array of swatches using the general swatch group from Adobe's CreateSwatchGroup scripts:
    JS
    var docRef = app.documents.add(DocumentColorSpace.CMYK)
    // Create a new SwatchGroup
    var swatchGroup = docRef.swatchGroups.add();
    swatchGroup.name = "CreateSwatchGroup";
    // Get list of swatches in general swatch group
    var genSwatchGroup = docRef.swatchGroups[0];
    // Collect 5 random swatches from general swatch group and move to new group
    var i = 0;
    while (i < 5) {
              var swatches = genSwatchGroup.getAllSwatches();
              swatchCount = swatches.length;
              var swatchIndex = Math.round(Math.random() * (swatchCount - 1)); // 0-based index
              // New swatch group does not allow patterns or gradients
              if (swatches[swatchIndex].color.typename != "PatternColor" && swatches[swatchIndex].color.typename != "GradientColor") {
                        swatchGroup.addSwatch(swatches[swatchIndex]);
                        i++;
    // Updates swatch list with swatches moved to new swatch group
    swatches = swatchGroup.getAllSwatches();
    // [… etc etc]
    AS
    tell application "Adobe Illustrator"
    activate
              set docRef to make new document with properties {color space:CMYK}
    -- Create a new SwatchGroup
              set swatchGroupRef to make new swatchgroup in current document with properties {name:"CreateSwatchGroup"}
    -- Get list of swatches in general swatch group
              set genSwatchGroup to swatchgroup 1 of docRef
    -- Collect 5 random swatches from the general swatch group and move to new group
              set i to 0
              repeat until i is 5
                        set swatchesRef to get all swatches genSwatchGroup
                        set swatchCount to count every item in swatchesRef
                        set swatchIndex to random number from 1 to swatchCount
                        set currentSwatch to item swatchIndex of swatchesRef
      -- New swatch group does not allow patterns or gradients
                        if class of color of currentSwatch is not pattern color info and class of color of currentSwatch is not gradient color info then
      add swatch swatchGroupRef swatch currentSwatch
                                  set i to i + 1
                        end if
              end repeat
    -- [… etc etc]
    If someone can help me to create the Swatch Array object of swatches loaded from a seperate document (or unique layer) then I think I can work my way to changing the fill on the existing paths (the nations in my map of Europe example).
    Would be very cool if I could detect neighbooring paths (nieghbooring nations in my map of Europe example) make sure the colour being assigned is not within a certain hue/CMYK range of the random colour and if it is rechoose random colour. I have no idea how to perform the logic of determining neighbooring paths in an Illustartor script. Anybody?!
    I'd prefer Applescript for sake of readiblity and also I'm learning AS ATM. Plus I'm using Script Debugger.app (which is excellent) to work with AS and I can't seem to run JSX scripts from within Extend Script Toolkit 2 (perhaps I need to make my scripts point to Illustrator?)
    But Javascript is okay if someone has this covered already :-)

  • Selecting objects in a layer to copy and paste into a new doc?

    How can I select all objects in a layer and copy and paste the objects into a new document? We are having issues with the copy and paste method. Is this because it uses the operating systems clipboard?

    the sample I mentioned describes how to duplicate all selected objects in a document, using
    var docSelected = app.activeDocument.selection;
    it is usually not advice to use the selection for this kind of stuff, to work with ALL pageItems in a document use
    var allPageItems = app.activeDocument.pageItems;
    now if you only want to copy items in a layer you can use either the index number (for instance, top layer index = 0) or the name of the layer (for instance "Layer1"), use this, you don't have to select them
    var topLayerPageItems = app.activeDocument.layers[0].pageItems;
    or using the layer name
    var Layer1PageItems = app.activeDocument.layers['Layer1"].pageItems;

  • HELP! When I drag the graphics pen, it selects objects without clicking

    Having a number of problems: the graphics pen selects objects without clicking them and "slides", the machine is beachballing for long periods and applications keep quitting unexpectedly. Please help!!!!

    Welcome to the forums Monad!
    A handicap we all share here is that we are not clairvoyant!
    You give us too little to go on:
    Which G5 do you have?
    What operating system?
    What graphics pen?
    What applications are quitting?
    When did the 'beachballing start'?

  • Very slow when selecting objects

    I have a problem with illustrator CS5. Whenever I select an object on the canvas by clicking on said object Illustrator freezes for a few seconds (showing me the spinner). This happens whether there is 1 object or 50 on the canvas so it certainly has nothing to do with the number of objects. Oddly, if I click on the canvas and drag-and-select objects this does not happen; they are selected immediately. Of course most of the times I forget this and have to wait constantly because I accidently selected an object directly, which is extremely annoying and almost to the point of unworkable.
    Anybody got any ideas about how to solve this?
    Sys specs:
    MacBook Pro
    Mac OS X 10.6.7
    2.66Ghz Intel Core i7
    8GB 1067 MHz DDR3

    Many reasons, to help narrow it down create a new document draw one lement and let us know if you have a slowdown.
    Reset your preferences.
    Cmd-Opt-Ctrl-Shift when restarting AI on a Mac or Alt-Crtl-Shift on a PC to reset to the defaults.
    Flush Cache (Good for slowdown)
    delete users\(username)\library\preferences\com.adobe.mediabrowser.plist
    FONTS
    Fo you have alot of fonts loaded. You may have a corrupt font. Close any you do nto use often
    Permissions
    Run applications >> utilities >> disk utility and repair permissions.
    Ram
    Run applications >> utilities >> system profiler and check the status of your ram and hard drive
    HUH Error
    If the test you did in the beginining returned your computer to a speedy apce, search the forums for HUH error.
    OnyX
    Download onyx from apples site for your OS version and do the cleaning tab.

  • Service template problem - Unable to perform the job because one or more of the selected objects are locked by another job - ID 2606

    Hello,
    I’ve finally managed to deploy my first guest cluster with a shared VHDX using a service template. 
    So, I now want to try and update my service template.  However, whenever I try to do anything with it, in the services section, I receive the error:
    Unable to perform the job because one or more of the selected objects are locked by another job.  To find out which job is locking the object, in the jobs view, group by status, and find the running or cancelling job for the object.  ID 2606
    Well I tried that and there doesn’t seem to be a job locking the object.  Both the cluster nodes appear to be up and running, and I can’t see a problem with it at all.  I tried running the following query in SQL:
    SELECT * FROM [VirtualManagerDB].[dbo].[tbl_VMM_Lock] where TaskID='Task_GUID'
    but all this gives me is an error that says - conversion failed when converting from a character string to uniqueidentifier msg 8169, level 16, State 2, Line 1
    I'm no SQL expert as you can probably tell, but I'd prefer not to deploy another service template in case this issue occurs again.
    Can anyone help?

    No one else had this?

  • Unable to remove a host from VMM - Error (2606) Unable to perform the job because one or more of the selected objects are locked by another job.

    I am unable to remove a host from my Virtual Machine Manager 2012 R2. I receive the following error:
    Error (2606)
    Unable to perform the job because one or more of the selected objects are locked by another job.
    Recommended Action
    To find out which job is locking the object, in the Jobs view, group by Status, and find the running or canceling job for the object. When the job is complete, try again.
    I have already tried running the following command in SQL Server Management Studio
    SELECT * FROM [VirtualManagerDB].[dbo].[tbl_VMM_Lock] where TaskID='Task_GUID'
    I received this error back:
    Msg 8169, Level 16, State 2, Line 1
    Conversion failed when converting from a character string to uniqueidentifier.
    I have also tried rebooting both the host and the Virtual Machine Manager Server.  After rebooting them both, I still receive the same error when trying to remove the host.
    Here are my server details
    VMM Server OS = Windows 2012 Standard
    VMM Version = 2012 R2 3.2.7510.0
    Host OS = Windows 2012 R2 Datacenter
    Host Agent Version = 3.2.75.10.0
    SQL Server OS = Windows 2012 Datacenter
    SQL Version = 2012 SP 1 (11.0.3000.0)

    Hi there,
    How many hosts are you managing with your VMM server?
    The locking job might be the background host refresher job. Did you see any jobs in the jobs view, when the host removal job failed?
    If there is no active jobs in the jobs view when this host removal job fails, can you please turn on the VMM tracing, retry the host removal, and paste back the traces for the failed job (search for exception and paste the whole stack)?
    Thanks!
    Cheng

  • Excise Number Range for Object J_1IEXCLOC

    Dear All ,
    I am having one issue regarding excise number range for object J_1IEXCLOC and sales group : 41 Domestic. i have already maintained number range for 2009 is 0000000001 to 0000000300. Now the range is exceed and the new excise invoice is created with number 0000000001. Now i am confused if i will maintain range upto 0000000500 for 2009 then what will be the new  invoice number, whether it will be 0000000002 or 0000000301.
    Pls. Give me some suggestion, What should i do now for the number range to be in continuation.
    Regards,
    Swapnil Vaidya

    >
    swapnil vaidya wrote:
    > Dear All ,
    >
    > I am having one issue regarding excise number range for object J_1IEXCLOC and sales group : 41 Domestic. i have already maintained number range for 2009 is 0000000001 to 0000000300. Now the range is exceed and the new excise invoice is created with number 0000000001. Now i am confused if i will maintain range upto 0000000500 for 2009 then what will be the new  invoice number, whether it will be 0000000002 or 0000000301.
    >
    > Pls. Give me some suggestion, What should i do now for the number range to be in continuation.
    >
    > Regards,
    >
    > Swapnil Vaidya
    It will be 2 and not 301. This is a flaw with CIN. All transactions take place by means of internal numbers and are stored in CIN transaction tables. Hence when the range gets exhausted, the number gets reset to the beginning, yet there is no error because internal number, which is the primary key, is different.
    To solve your problem. Go to SNRO and provide the object J_1IEXCLOC and click on status. Change the status to 300 and continue with your transaction.
    Regards,
    Aroop
    PS: Your question is more relevant for SD than MM.

  • How to get paragraph number of selected text in ID CS4

    Hi,
    Can anybody help me how to get paragraph number of selected text in Indesign cs4.
    Thanks,
    Gopal

    Ah, I see -- thanks. Turns out that there's no difference in speed between texts.itemByRange(), characters.itemByRange(),and insertionPoints.itemByRange(). In a document with 170 pages of text, and with the cursor in the last paragraph, the second and third lines, below (and your function), give exactly the same result:
    t = app.selection[0];
    t.parentStory.texts.itemByRange (t.parentStory.insertionPoints[0], t).paragraphs.length;
    t.parentStory.characters.itemByRange (t.parentStory.characters[0], t).paragraphs.length;
    Peter

  • Error: Number range  for object RESB does not exist

    Hi
    I'm trying to convert a planned order (to purch requisition) partially via trxn code MD04. Upon saving I get the above error msg. The complete text of msg is as  follows. I've maitained the number ranges of all the objects specified in this error msg. Can somebody explain on how to overcome this problem?
    Many thanks
    BE
    Error Msg Text:
    Number range  for object RESB does not exist
         Message no. 61501
    Diagnosis
         The system cannot create a document for an MRP element if no number
         range or interval has been maintained in Customizing of MRP or if t
         number range you have maintained is not allowed.
         Below is a list of MRP elements that are affected:
         Number range object  MRP element
         PLAF                 planned order (operative oder simulative)
         EBAN                 purchase requisition
         RESB                 dependent requirements
         MDSM                 simulative dependent reqmts (long-term plannin
         MDTB                 MRP list
    Procedure
         Check the number ranges in Customizing. If you do not have the necessa
         authorization, please get in touch with your systems administration.

    Hi
    Thanks for the reply. But I have maintained the number ranges for matl. reservations/dependant requirements at OMI2. Here is the screen shot..Do find anything wrong with it? Pl advice.
    NR Object                             MRES/DREQ
    No.                          From Number            To Number          Curr Number          Ext
    01                           0000000001               8999999999           380                    blank
    02                           9000000000               9500000000           blank                  checked
    RB                          9500000001               9999999999           blank                  checked
    Number ranges for the plants are assigned to 01 (0000000001 to 8999999999).
    thanks
    BE
    Edited by: Brian Elfie on Jan 10, 2008 11:27 AM

  • Issue with the Data Type 'Number' in Business Objects

    Hi,
    I have an Object in the Universe where the Data Type of the Object is a number. This Column pertaining to this Object has certain values in the database out of which there is a 17 Digit Value which is 00000000031101165.
    Now, when trying to retreive the same value through Business Objects it is getting rounded off to 00000000031101200 automatically when trying to view in Webi and when trying to retreive the same in Designer/Deski, it displays as 0.000000003110116E+16.
    So, I would like to know if there is any other alternative in trying to retreive the Original Value that would not round off. Also, do we have any Limitation for the Data Type Number in Business Objects? The Version we are on is XI3.1.
    Note: There are no functions that are used on this Object at the Universe Level and would not like to use any functions here.

    What is the underlying database?
    It looks like the data is considered to have two decimals, but is rounded to zero decimals.
    Only you don't see the number formatting.
    Is this a BW query?
    Is this a calculated keyfigure?
    In the query you can specify the rounding you want and it is also possible to specify it on an infoobject level.
    Check those settings...
    Hope this helps,
    Marianne
    PS. Oh, and about the formatting, you can specify a default object format in the universe and override it on the final client (WebI, Crystal)

  • Indesign CS3: How to get the UID of the selected object?

    Hello,
    How can I get the UID of the selected object in an document?
    Thanks,
    Alois Blaimer

    Hello!
    I do not get it. Please give me some more hints.
    I only want to know if the selected object is a square and then the UID of the selected square.
    Thanks,
    Alois Blaimer

  • Querying for a script insert multiple selected objects...

    Is there a script or plugin which insert multiple selected objects in one new text frame with one click?
    And is there a script or plugin which extract the content of anchored text frame out it's frame and replace it with it's frame. and extract selected text and insert it inside a new anchored text frame in it's place? (like convert text to table - convert table to text, but instead table we use text frame)

    Hi,
    Using OMB scripting to set attribute properties in a data mapping sort of defeats the purpose of utilizing a graphical user interface to define and set properties for a data mapping? Surely the GUI data mapping tool was created to get away from writing scripts and scripting would also require that you know the name of the data mapping, table operator and the set of attribute names for which you have to write one line of script to set each property value, i.e. 90 lines to set 90 attribute values.
    Cheers,
    Phil

  • Select Object Tool Adobe Pro 9.0

    Can someone please help me. My "Select Object Tool" under Tools, Advance Editing is greyed out. Does any one know how to activate it?
    Thank you in advance
    [email protected]

    Are there any security settings on the document?

  • Create a new object that surrounds the selected objects

    Is there anyway in illustrator to create a new vector object from selected objects?
    IE if i have three rectangles selected, can I make a new vector path that surrounds them all.
    I dont mean welding a group of vectors together or offsetting a path...which isnt exactly what i need.
    What Im needing to do is create cut lines around complex vector art quickly.
    Thanks in advance.

    Mike i need to make an outline around a logo but if the logo has many elements that make up the edge of the logo does that method work?
    As the cut line needs to be a closed path
    Ideally i want to avoid tracing around the logo with the pen tool or add to shape area in pathfinder tab.
    I sure theres a really easy way to do this.
    Kurt its an interesting discussion however in need a closed path to surrond artwork and live paint does just the opposite :)

Maybe you are looking for

  • Dbms_lob.getlength() returns different values

    Hi ! I am not a developer.. So, possibly cannot answer developer specific question. We have two instances running on 10.2.0.4 but both giving different value for declare      xml varchar2(32676) := 'SELECT XT_STRATEGY, ACCT_DESCRIPTION,sum(MON_PL) PL

  • FM Derivation  FMDERIVE,FMRULES,RFMXPR47,RFMXPR49

    Hi, Please confirm what should be the sequence for the derivation steps in DEV environment: FMRULES (To select pre-defind rules) FMDERIVE (To select some function module) RFMXPR47 (conversion program) RFMXPR49 (Conversion program) or RFMXPR47 RFMXPR4

  • Flash Player 9 How to test

    Have downloaded the latest version onto my PC. I use Windows XP and firefox browser. However although it tells me the version is laoded ok I cannot seem to find a way to test if it is ok. I tried to link with an organisation through a cam2 cam servic

  • Copy control transport orders

    Hello Gurus: Quickly question: How we can modify the copy control between transport order and deliveries? I want add a conditions to copy the values of the field between the transport order and the delivery. Thanks in advance javier

  • What is this mean

    <cfhttp method="get" url="http://localhost:8500/projects/test.txt" timeout="5" />    <cfset header = cfhttp.header />     <cfif listContainsNoCase(header, "200 OK")>         <cflocation url="http://localhost:8500/projects/test.txt">     <cfelse>