Selecting objects in group

Hi,
I am new on scripts, so could someone help me..
I try to access grouped object in page (type of contents - textFrames, rectangles etc.)
How make array of selected object/group in document?
Regards
xe

Hi xe,
Please try the below JS code.
var myDoc = app.activeDocument;
var myPage = myDoc.pages[0];
the below line selected the first page of the first groupd object.
//myPage.groups[0].select();
the below line is selected the first page of first group object of 1st textframe.
myPage.groups[0].textFrames[0].select();
thx
csm_phil

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 :-)

  • Powershell - Select-Object -Unique vs Group-Object

    Hi,
    I have the following problem with powershell.
    I have a list of strings call it $machine_list which
    I know there are duplicates.
    The following  code produces the following output:
    $machine_list.count -- 15375
    $a = $machine_list | Select-Object -Unique
    $a.Count -- 12134
    $b = $machine_list | Group-Object -NoElement
    $b.Count -- 12082
    I am trying to get a unique list and looking at different
    ways of doing it.
    So in my example above why are the counts different?
    Should they not be the same - $a.Count -eq $b.Count?
    I am hoping somebody can explain this in more detail to me.
    Also is there a way I can compare the results to see how they
    differ? (Comparing $a with the Name Values of $b).
    Thanks,
    Ward.

    Dirk - another way to think this out.  "group" means that each named group has a unique name.  In a list of strings the group name and object are identical so the list of group names is the list of identical strings.
    Select -unique and sort -unique produce an identical set of lists.  Select -unique, however, does not necessarily produce a sorted output although the output is guaranteed to be unique.  What you may be mixing up is that many learned to add sort
    in PowerShell V1 because they did not get a sorted output from a unique operation.  As I posted above, this issue has come up constantly as people start to learn databases.  A company that I used to work for wrote its own 'uniquing' code.  It
    always produced a sorted output as a byproduct of the method.  When we implemented SQL database technology the programmers could not understand why select unique in SQL did not produce a sorted output.  They constantly complained that it was a bug.
    In most cases we would like a uniquing operation or not sort the results.  Suppose I have a result set order a specific way.  Now I want group it on a column but I do not want the order of the records changed.  Grouping and select unique should
    not change the order.  There are many discussions in the database field as to why this needs to be.  I am not sure which set of standards PS follows.  In PS1 it appeared to follow the industry standard.  Maybe I will test it later.
    ¯\_(ツ)_/¯

  • The selected objects cannot be joined as they are invalid objects,( Compound paths, closed paths, Text Objects, Graphs, Live Paint group). You can use Join command to connect two or more paths, paths in groups; ot to close an open path.

    Hi I was trying to join two Ractangle Tool objects but getting this type of Error in illustrator cs6 :-
    The selected objects cannot be joined as they are invalid objects,( Compound paths, closed paths, Text Objects, Graphs, Live Paint group).
    You can use Join command to connect two or more paths, paths in groups; ot to close an open path.
    Please assist me asap.

    Yes, I know this is an old post, but I’m trying to clean them up. Did you solve this problem, if so what was the solution?
    This sound like a firewall issue. I would start by disabling the firewall and seeing if you can connect. If this works then you know where the problem is,
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

  • 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

  • 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 :)

  • Resizing selected objects

    Ok, so I am trying to write a script that resizes an object that is selected. I have two objects selected, the one on top is a group item, the one below it is a rectangle. I am trying to resize the rectangle to the size of the group item on top of it with a little margin around it. Here is what I have so far.
    var design = app.activeDocument.selection[0];
         var top=design.visibleBounds[1]+5*2; 
         var left=design.visibleBounds[0]-5*2; 
         var width=design.visibleBounds[2]-design.visibleBounds[0]+10*2;
         var height=design.visibleBounds[1]-design.visibleBounds[3]+10*2;
    var background = app.activeDocument.selection[1];
    background.position = (top, left, width, height);
    The problem is the last line there. I'm not sure how to manipulate the position/size of the selected object or if it is even possible I have searched for it and haven not found an answer. Thanks in advance!

    position property expects an Array, with x and y values, in that order. As for the width and height properties, use them in separate statements
    background.position = [left, top];
    background.width = width;
    background.height = height;

  • [Agentry] Identifying the selected object in multi-tab lists on iPad

    hi all,
    On iPad, we can create a multi-tab lists to group objects based on different criteria as shown below.
    In my implementation, I created a Tile Display which holds a screen set called “Lists” with multiple list screens.
    Once we select an object in one of the lists, we need to either display details of the it or execute some transactions on that object. Then I had difficulty to find a way to identify the selected object. Since this is a screen set inside a tile display. I first tried to see if I can drill down on the tile display.
    As shown above, I cannot go further on the tile display.
    Then I tried to see if I can find the object on the “Lists” screen set. There are four screens each of which has “selected object” option. During the application’s execution, the user may switch between lists/tabs. Is there any method we can figure out which tab/screen the user is currently on?  With that piece of information, I can identify the screen and then the object accordingly.
    My development environment is 6.0.42 and iOS 7.1.
    If this is not correct way to accomplish such function, is there any work around available to present a workable multi-lists tile on iPad?
    Thanks a lot.
    -Yang

    Jason,
    My following question might be a bit off the original topic. Please let me know if you want me to open a new post.
    I actually tried the navigation as well as the list selection. The navigation did happen. However, instead of presenting the Lists screen in the original tile display, a new full screen is created after the navigation which covers the original screen on iPad.
    This leads to a general question regarding the navigation on screen with tile display. For pocket PC, the navigation is straight forward as a new screen is going to be created to cover the original screen. On tablet, if tile display is used, is it possible to navigate to, i.e., activate the focus on, a particular screen inside a tile display?
    Please let me know if I make my question clear.
    Thanks a lot.
    -Yang

  • Error on selecting object in ILLUSTRATOR CC

    Hi everyone, i have problem with selecting object in illustrator CC, when i select the current object it will also select the other object, i cannot select the object i want, not on the group or clipping mask.. always highlight it both. it often times happen when i doing so much vector object. any help from you guys is so much appreciated..
    thanks
    Creig

    This has been happening through so many versions that I no longer remember when I first encountered it.
    One trick that occasionally works when you get such a 'ghost' selection;
    Create another object (a small square or whatever).
    Select it. Your new object and the ghost will be selected at this point.
    Align them using any one of the alignment buttons, it doesn't matter which one.
    Immediately undo the move (Cmnd/Ctrl + z) and deselect your new object. About nine times out of ten the ghost selection will be gone as well. If so, you can delete your extraneous object and continue working (until next time).
    It doesn't always work. But it is quicker than a restart when it does.
    --OB

  • Delete selective objects from an MA

    Is there a tool / script which allows me to selectively delete a group of objects from an MA.
    For instance if (for whatever reason) I want to delete all groups from the FIM MA CS.
    Thanks,
    Mik

    Hi Mik,
    Is not a best practice that you want to do. It's better to configure the delection rule on the MA and the Object Deletion Rule in the metaverse.
    More details here : http://technet.microsoft.com/en-us/library/jj590241(v=ws.10).aspx 
    What is the context to perform this action ?
    Regards,
    Joris
    Joris Faure

  • How to select objects marked in the layer panel?

    Hello,
    this may be simple and trivial, but somehow I fail to express it nicely so that the search engines would find the answer for me...
    so here is my question.
    Imagine that you have several objects marked in the layers panel. (by "marked" I mean, I simply clicked on the objects name in the panel)
    Unfortunately, when they are marked there, it does not make them yet selected in the main viewport.
    So - how do I make the marked objects selected without Shift+clicking every single circle on the right-end side of the object name?
    (using CS5 version of the Illustrator)
    Many thanks!

    Well, I was thinking your second-born child, Scott, but the cursor will work too.
    P-Dan: hold your option (alt) key down and drag your cursor over the NAMES of the objects (or groups or layers) in the layers panel. If you want to skip over an object or two (or 10), hold both shift and option keys down and click on the noncontiguous object you want to add to the selection. From there, with the option key still down, you can continue selecting contiguous objects. Or hold the shift and option keys down and hop-scotch through your layers panel selecting discontiguous objects at will.
    If all of this is too much for you, a viable alternative is to go into dentistry.
    May I remind you all also that Monika suggested this very technique way up high in this thread.

  • Resizing objects and groups in CS4 - different from CS3

    Hi all,
    In CS3 I used to be able to resize objects or groups of objects by just using the solid select tool and just grabbing a corner or side of the object and resizing it.  That doesn't work in CS4.  Doing the same thing only moves the image around.  I have to actually use the scale pop-up.
    I can still do the same thing an anchor or path at a time with the outline select tool.
    I'm sure there's a way to do this in CS4 and there's probably a switch buried deep in some menu to allow this, but darned if I can figure it out.

    I'm still on CS3 so I don't know for sure, but I don't think so.  It's always been a pretty easy key shortcut to hit by accident though. 

  • Selecting objects outside mask boundary

    Hi,
    On Ai CS3, while working with clipping masks I've been used to select masked objects with the direct selection tool, even the ones that fall outside the mask boundary.
    I can't do so with the CC version of Ai. Instead I have first to select it with the lasso tool. One can do so as well with the layers or else by selecting edit contents in the control box.
    So it's actually possible, but since I edit masked objects quite often those extra-steps are just annoying.
    Would be in the preferences or else some option to fix it? Or do I have to make do with some bias..

    There is at least one reason why the Edit Contents state is a bit laborious: It's too easy to exit it by inadvertently deselecting the clipping group.
    One workaround is Isolation Mode. You may:
    - Go to Edit > Keyboard Shortcuts > Menu Commands > Other Object and – for example – assign the F3 key to the Isolate Selected Object command.
    Now, whenever you want to edit the clipping object including its content just hit F3. When done hit the Esc key to exit Isolation mode.

  • Object selection wont stay on selected object

    Does anyone know of a setting or fix for this. Everytime I select an object or group above any other object, M3 grabs the the next object below. I find myself avoiding alot of elements that would look better just to avoid this bug. Any suggestions?
    This is stopping what little creativity I do have dead in its tracks.
    Nava

    Any luck on this? I use a wacom myself and didn't see this, but maybe my projects aren't complex enough...
    Patrick

Maybe you are looking for

  • Why are some movies only available in languages other than the original version?

    I have mentionned this before, and it keeps happening, and it is oh so annoying! Why in the world would you make a movie available in a translated version, but not in the original? This has happened to me several times now, and it is incredibly frust

  • My 13" late 2011 MacBook Pro will not turn on..

    My MacBook Pro only displays one blinking dot on the battery indicator and the MagSafe charger does not display and lights once plugged in and the computer does to respond when pushing the power button Please help

  • Instr function for table column

    hi, lets consider the basic soctt.emp table. i need to check for the first occurence of 'a' in the Ename column in emp table. select instr(ename,'a') from empabove function does not seem to work Please advise. Regards

  • Selling ipod mini to friend-what do I need to do?

    I am selling my mini to a friend and have left all of my songs on it. Is it possible for her to re-register it? Also, will she be able to choose what songs she wants to keep and be able to keep what I've purchased from the iTunes store? Thanks!

  • In Place structure bundle/unbundle behaviour

    Hi all, I have noticed unexpected behaviour of the in place structure at edit time.  This VI illustrates the behaviour I see.  Essentially, if you add items into the cluster above the element being unbundled in the structure, the structure changes th