How to move layers into group.

Hi.
I want to make group and input it's name and get layers into it.
var doc = app.activeDocument;
var layers2 = doc.layers;
var txt = prompt("Input layer group name :");
var layerSetRef = doc.layerSets.add();
layerSetRef.name = txt;
for(var i = 0; i < layers2.length; i++) {
layers2[i].move(layerSetRef, ElementPlacement.PLACEATEND);
Can you tell me why this code shows error?
Indicator shows "layers2[i].move(layerSetRef, ElementPlacement.PLACEATEND);" is not right.

I see two main problems with your code.
One is that the enum should be ElementPlacement.INSIDE when moving an artLayer into a layerSet.
The second problem is moving layers changes the index so you can not loop using the index.
Try something like this:
var doc = app.activeDocument;
var txt = prompt("Input layer group name :");
var layerSetRef = doc.layerSets.add();
layerSetRef.name = txt;
while(doc.artLayers.length > Number(doc.layers[doc.layers.length-1].isBackgroundLayer) ) {
    if(!doc.artLayers[0].allLocked || !doc.artLayers[0].positionLocked ){
        doc.artLayers[0].move(layerSetRef, ElementPlacement.INSIDE);
That should move all the top level artLayers into the layerSet. It will skip locked layers and the background layer. You could change the layer locking test to change those properties if you want to move locked layers. To move the background layer you will need to convert it to a normal artLayer before moving.

Similar Messages

  • Moving layers into Group

    I am a web designer and have created a script that puts a browser UI around a Photoshop document. The action places several images and creates several text layers. What I want to do is place all the images then add them into a group called "BROWSER". I can do this and it works fine in CS3, but it fails to select all the layers in CS4 and CS5.
    I have tried several methods which all work in CS3, but not 4 and 5. I have selected the top layer, held shift and selected the bottom layer "Add Continuous", I have selected them individually with the "Add" modification (holding down the command). After I create the selection, I try and "Make Group from layers", however, in CS4 and 5 it only places the last layer in the folder.
    I have also tried creating the Group folder, naming it and moving the individual layers into the folder. The problem here is that when moving, PS uses the layer number instead of the layer name! For instance, I have a layer call "Page Title", when using the move command it uses it's raw layer number "layer 16" or whatever.
    So sorry for the wall of text. Can anyone offer any insight? I am downloading the trial of CS5 to see if that makes a difference.

    Are all the layers visible?? I just tried recording an action in CS5 and had no problem.  I create a new document white background layer and added 6 layers. I targeted the middle layer and then recorded this action
    Alt+,   (Target bottom visible layer in this case the background)
    Alt+]   (Target next visible layer up in the stack in this Layer 1)
    Shift+Alt+. (Select continuously up the stack to the upper most  visible layer 6 layers with there visibility off between will also be selected)
    menu Layers>New>Group From Layers (Create new group named it test  and the layers were collapsed into the new group named test)
    stopped recording
    I then went back into the history palette to before the group was created where I had the 7 layers.  I played the action and it worked. Went back in time again and added layers till I had 100 layers on top of the background layers. I turned the visibility of some layers off. As long as the background layer and the layer above it as well as the Top layer visibility was on the action worked.  All bets are off it the visibility of any or those three layers are off.  The Action will fail.

  • How to move LC to Group

    Hi BPC Experts
    We're using BPC 10 MS version.  We have two GROUP and CURRENCY dimensions set up separately in our consolidation model.  Data is imported at LC (RptCurrency Dimension) and NoGroup (Group Dimension) members.  After running the currency conversion, we notice that the reporting currency is moved to the appropriate consolidated group member of the GROUP dimension, but not LC (local currency).
    My question is how to move LC currency into the corresponding members of GROUP dimension?
    Thx
    Y.Tran

    Hi Yung,
    You first need to perform a Reporting currency conversion (i.e. LC to EUR) and then perform a GROUP currency conversion (i.e. EUR to GROUP1).
    If you only have 1 currency (i.e. EUR) then you can possibly load data directly to your reporting currency (EUR) and then perform a GROUP currency conversion.
    Thanks,
    John

  • HT201737 how to move files into a finder folder

    how do I move files into an existing folder in finder on MacBook Pro?

    I am attempting to move some EXEL files that have been saved as documents.  When I open finder, these files do not appear in the recent, or last 30 days section so I need to search fro them.  When they are found they are not on the page where the folder exists so I don't seem to be able to drag them to the folder. 

  • How to move albums into the proper category in the Library?

    I don't know why an artist's greatest hits album is put into the Compilations folder, and not the artist's folder. I'd rather all their songs be in one folder, including any greatest hits. I can't seem to find any way to fix this. If I move the album into the artist's folder, none of the songs "can be found", and I would have to locate each song, one by one, which would be a major project.
    Now, I did take Sade's Greatest Hits, and stripped the songs by cutting and pasting them into a different album (Unknown Album) in her folder, however, when I tried doing that with another artist's album it refused to accept the change. So I tried going to the iTunes window & selecting all the songs, and edited the album name, from Greatest Hits, to Unknown Album (where I had placed the songs in the library folder), but it would not change the album title, no matter how many times I tried. Why would that method work for one and not another?

    Spaces has been changed to "Desktops" in Lion.  There isn't an icon for the menubar like there was in Snow Leopard.  To move from Desktop to Desktop you can use Mission control, use CNTL right/left arrows or swipe on your mouse or trackpad (depending on how you have your options set in System Preferences > Mouse/Trackpad
    Regards,
    Captfred

  • How to move music into playlists?

    I think my question is:  How can I move songs that are in "Artists" on my iPhone into a desired playlist that already exists?
    I purchased a dozen new songs.  I see the songs in iTunes, but when I click on my device "iPhone" in the upper right side of iTunes, the screen changes to highlight "On This Phone" and I see all my music.  I can find the new songs in the main list. 
    On the left side column, the header is "MyName iPhone" with all my playlists listed under.  I can see my new songs in both "Purchased" and "Music" lists.  I can also see the songs on my iPhone if I sort by Artists.
    I even bought iTunes Match thinking this would solve the problem.  But alas - I don't even know what it does, as nothing in the user experienced changed.  My songs and playlists are still on my phone as seen as always, and iTunes looks the same as it always has - maybe I just threw away $24?  (This may be a separate conversation, but I mention here because perhaps this service can be used to slve my problem?)
    How can I move songs to one of my Playlists that I created?
    Thanks for any help!
    For reference:
    MacOSx 10.7.2
    iTunes  11.1.5
    iOS 7.1

    A search on google will probably find utiltities that can be used to copy music off an iPod and onto a computer - after you've done it you then just need to do File > Add Folder to Library in iTunes (but I would advise maintaining a backup on an external drive from now on). This fairly old thread mentions some utilities that were around at the time the message was written http://discussions.apple.com/message.jspa?messageID=9990366#9990366
    In terms of getting notifications, if you go into 'My Subscriptions' on the right you should get options to 'Always subscribe to topics I create' and 'Always subscribe to topics I reply to' - selecting the first should get what you want (though I've never tried it).

  • How to move documents into a new folder in Pages for iPad

    I have several files in a folder in Pages on my, and want to move some of them into a new folder. How can I do that?  Thank you.

    copy two of them out into the "root" folder, make a new folder with those two, and then start moving the others in that you want to put together.
    Jason

  • How to "collapse" Dashboards into groups on banner

    I have a dashboard group with 5 seperate dashboard in it. All 5 of the dashboards are listed on my banner. Isn't there a setting somewhere that controls how many dashboards will be shown before they get grouped on the banner? I want to only show the Dashboard group name, and not the inidividual dashboards that make up the group...

    Not sure because I don't fully understand your question but this may help :
    Making a Dashboard-menu in OBIEE
    http://blog.trivadis.com/blogs/andreasnobbmann/archive/2008/09/29/making-a-dashboard-menu-in-obiee.aspx
    Success
    Nico

  • How to organize contacts into groups?

    Is there any support to manage contacts to organise them in groups ?
    [Topic title updated by moderator to be more descriptive. Original topic title was: "Skype support groups"]

    Hi and welcome to the Skype Community,
    Yes, that's possible. Please take a look here to learn more about managing your contacts: https://support.skype.com/en/faq/FA3281/how-do-i-add-contacts-in-skype-for-windows-desktop
    Follow the latest Skype Community News
    ↓ Did my reply answer your question? Accept it as a solution to help others, Thanks. ↓

  • How to move projects into folders

    I have many many projects
    I'm trying to keep them organised and out into folders
    This is really tricky
    I have to click and hold down and drag and then place in the folder I want
    Right now I'm uploading something to youtube
    It's really unresponsive
    When I try to drag and drop, it just doesnt like it
    I've looked through the menus and cant see anything to 'cut' and 'paste'
    Am I missing something?
    Thanks
    Omar

    thanks russ for the reply
    i mentioned youtube, since i have found fcpx to be unresponsive at times when it's doing loads of work
    i assumed this may be the problem when i've tried to drag the project into the sub folder
    just tried now. this isnt the case. it's still unresponsive
    when i drag the project up or down, nothing happens
    i managed to get the folders to start moving when i dragged up - not sure what i did
    then when i tried again, nothing happend
    i'm stumped with this one
    and this is really impacting and making it very hard to work
    help!

  • How do I move emails into file folders

    how to move mail into folders on the Mac pro

    Hi. When in your mail app you can click on the individual mail you wish to save in the mail header window. the top box not the content box. Then go to file /save and you get a drop down box where you can select where to save to and the click on save.

  • HT2476 how to build a contact group in address book

    I'm wanting to build a group of folks I do business with, how can I name the group and then pull those names that already exist in my address book into that group?

    Groups
    http://www.dummies.com/how-to/content/how-to-organize-contacts-into-groups-in-mo untain-l.html
    Smart Groups
    http://www.dummies.com/how-to/content/set-up-a-smart-group-in-mountain-lion-cont acts.html
    Hope this helps.

  • How to move a selection into another selection in elements 12

    how to move a selection into another selection in elements 12

    Open picture B, the one you wish to select something from to add to another picture.
    Use one of the selection tools, e.g. selection brush, lasso tool, to select the object. You will see an outline ("marching ants") once the selection is complete
    Go to Edit menu>copy to copy the selection to the clipboard
    Open picture A, then go to Edit>paste
    Use the move tool to position object from picture B.
    In the layers palette you should see picture A as the background layer, and object B on a separate layer

  • How to move multiple components into a Tab Component and still keep layout?

    I have created a Combination Chart with multiple combo boxes and a slider on my Xcelsius Canvas.  Now, I realize that I want to put all of this into a Tab Set Component.  How can I move everything into this new Tab Component without messing up all the layout and alignment I have done on all my components already?  I tried shift-selecting everything and doing a drag --> drop into the Tab Canvas but they just all stack on top of each other.
    Can this be done?  Would it be wiser to start a new Xcelsius document, place a Tab Set Component on the canvas and then copy --> paste from the original document into the new one? I'm reluctant to do this though (even within the same document) because it forces all components to be renamed back to their defaults such as Chart 1, Combo Box 1, etc etc.
    Edit:
    Bolded my biggest concern on this topic, can components be copy/pasted or cut/pasted and still retain their original name?

    i think this scenario would work fine for you
    choose all the components you want to move from the "Object Browser"
    you can show the Object Browser from the View Menu
    after you select them all, you can drag them to your Tab component
    or you can make them as a group, so it will be easy to move them as the same layout they have.
    to make them as one group
    select them all, go to format menu, and select Group
    now you have all of them as one item, move them to the tab and then you can ungroup them the same way
    good luck
    Amr

  • How Can You Bring Illustrator Cs5 Layers into Photoshop Cs5?

    Hi everyone, Is it possible to bring Illustrator artwork into Photoshop so that the layers in Illustrator are layers in Photoshop, and so that all the content is arranged as it was in Illustrator.
    What I have been doing is bringing in a shape or a group of shapes into Photoshop by pasting them into a layer in PS then bringing in some more stuff from another layer in Illustrator and pasting that into another layer in PS but obviously it's a mission to line up the contents again so it is arranged like it was in Illustrator in the first place.
    Any help appreciated
    thanks Gareth

    No, it doesn't say how to do it there
    Well, then you probably haven't read carefully enough about what can be set up when exporting as .psd in Illustrator.
    When you export as .psd there are several export options about preserving layers. As mentioned, there are some restrictions.
    But tell me, what is unclear about the following quote?
    Write Layers
    Exports groups, compound shapes, nested layers, and slices as separate, editable Photoshop layers. Nested layers that are more than five levels deep are merged into a single Photoshop layer. Select Maximum Editability to export transparent objects (that is, objects with an opacity mask, a constant opacity less than 100%, or a blending mode other than Normal) as live, editable Photoshop layers.
    Preserve Text Editability
    Exports horizontal and vertical point type in layers (including nested layers up to five levels deep) to editable Photoshop type. If doing so compromises the appearance of the artwork, you can deselect this option to rasterize the text instead.
    Maximum Editability
    Writes each top-level sublayer to a separate Photoshop layer if doing so doesn’t compromise the appearance of the artwork. Top-level layers become Photoshop layer sets. Transparent objects remain editable transparent objects. Also creates a Photoshop shape layer for each compound shape in a top‑level layer if doing so doesn’t compromise the appearance of the artwork. To write compound shapes with solid strokes, change the Join type to Round. Whether or not you select this option, all layers over 5 levels deep are merged into a single Photoshop layer.

Maybe you are looking for

  • UTL_TCP - connection loss

    Hi guys, I would need a help with UTL_TCP package... Oracle version is: SELECT * FROM V$VERSION; Oracle Database 11g Release 11.2.0.2.0 - 64bit Production PL/SQL Release 11.2.0.2.0 - Production "CORE    11.2.0.2.0    Production" TNS for Linux: Versio

  • Sapscript logo printing reverse

    In a sapscript, I am using a logo. In print preview, its coming fine but when it is printed, it is coming reverse. What could be the problem and possible solutions? I have seen some threads here related to that but I would like to know if those solut

  • How to find if an error log table is related to a table....???

    Hi, In Oracle 10g , maybe in older version too, there is the capability to create an error log table using the dbms_errlog package and create_error_log procedure... For exaample: exec dbms_errlog.create_error_log('EMP','EMP_ERROR') How to find afterw

  • Sending feedback by use of activity device_send_feedback

    Hi, I want to send feedback of my packing operation (hu) from aii to ecc via xi. I included in my rule z_pack that activity and also configured in img under conditions for backend messages that the rule z_pack with message type derq should be a backe

  • Execution of preparation for consolidation group changes

    Hello, In 1/2011 there was a change in the consolidation units hierarchy. A consolidation unit  moved to upper consolidation group. I cannot find in the master data of the consolidation unit , where should I update the FIRST CONSOLIDATION DATE, and t