Find a specific Sublayer and move to top level layer

I have a lot of illustrator files that are organized by a template size. The layers are setup so that the top level layer is always Template. However the sublayer I need to move to the top level could be called 42 Pg Border or 30 Pg Border or 24 Pg Border.
Is there a way for a script to search through the layers and if it finds "42 Pg Border" or "30 Pg Border" or "24 Pg Border" in the sublayer Template it would move it to the top level but if it doesn't see one of those it doesn't give an error?
I'm still new to scripting so the extent of my knowledge on this is to scan all the layers and unlock them. Then look for a specific layer name. It's the sublayer and moving it to the top level that I am not sure of.
Here is my current code:
var doc = app.activeDocument;
var allLayers = doc.layers;
for (var i = allLayers.length-1; i >= 0; i--){
    allLayers[i].locked = false;
    if (allLayers[i].name == "42 Pg Border" || allLayers[i].name == "30 Pg Border" || allLayers[i].name == "24 Pg Border") {
        alert("I found the " + allLayers[i].name + " layer")
    } else {
        alert("Not the right layer")
Any help would be greatly appreciated!
I am using CS4 on a Windows 64 Bit PC with JavaScript

OK so that code is really close! I tweaked it a bit. I kept getting an error that said cannot move a locked layer. So I just made a loop to unlock ALL the layers first thing. Then to get rid of some of the "extra" code I wrote I changed this line:
if (layer.name == "42 Pg Border" || layer.name == "30 Pg Border" || layer.name == "24 Pg Border") {
to this.....
if ((layer.name).substr(-6) == "Border") {
So now instead of looking for 42 30 24 (and other border templates I may have to add) I just told it to look at the 6 characters at the end of the string (which will always be the word Border).
OK so now the code runs and does what it is supposed to but I am getting an undefined in my javascript console in extendscript. Any ideas?
Current updated code:
var doc = app.activeDocument;   
var allLayers = doc.layers;  
var count = 0;
for (var z = allLayers.length-1; z >= 0; z--){
    allLayers[z].locked = false;
for (var i = allLayers.length-1; i >= 0; i--){ 
deeper(allLayers[i]);
  if (count == 0){ 
     alert("No Border Layer Found"); 
function checkLayer(parent,layer){    
    if ((layer.name).substr(-6) == "Border") {   
  layer.move(allLayers[0],ElementPlacement.PLACEBEFORE); 
        ++count; 
function deeper(parent){ 
var subLayers = parent.layers; 
  if (subLayers.length > 0){ 
  for (var i = subLayers.length-1; i >= 0; i--){   
  checkLayer(parent,subLayers[i]); 
  if (count>0){return} 
  deeper(subLayers[i]); 
  } return 

Similar Messages

  • How Select All Text Objects with Specific Contents and Move to Top-Center?

    Mavens,
    In a ~230 page InDesign CC Book (9 INDD files), on about ~35 pages, there is a small text block with the word "NOTES."
    Currently, the NOTES text block is in the Middle-Center of the page. I would like to find a way for InDesign to move all ~35 instances of the NOTES text block to the Top-Center (of the page each text block is on).
    Is there an easy way to do this with Edit --> Find/Change?
    Thanks!

    Probably not.
    That text block really belongs on a master page applied to those 35 pages, and if it is, all you have to do is move it on the master page. If it isn't, you've got some work to do. Probably easiest to fix one, then coy it and use Paste in Place on the other pages, and delete the frame that's in the wrong place.

  • [svn:fx-trunk] 9924: Empty design layers with id' s are now persisted and declared as top level properties.

    Revision: 9924
    Author:   [email protected]
    Date:     2009-09-02 09:11:03 -0700 (Wed, 02 Sep 2009)
    Log Message:
    Empty design layers with id's are now persisted and declared as top level properties.
    QE notes: None
    Doc notes:  None
    Bugs: SDK-22904
    Reviewer: Paul
    Tests run: Checkin
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22904
    Modified Paths:
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/InterfaceCompiler.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/analyzer/SyntaxAnalyzer.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/builder/DocumentBuilder.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/dom/DocumentNode.java
        flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/rep/MxmlDocument.java

    I seem to have fixed it by putting <div  class="clearfloat"></div> after the navigation bar?

  • Accessing a function from a movieclip form a top level layer

    Im having a dillema. my whole game rests on being able to
    access functions from a movieclip inside a movieclip in a top level
    layer called "Cards" to another layer called "Functions". I've used
    this code:
    play_modifier_card(this.num.text);
    to access this function:
    function play_modifier_card(card_num){
    trace(card_num);
    It works OK when the function is in the movieclip but not
    when it is in a top level layer. I tried
    "_root.play_modifier_card(this.num.text);" but it didn't work. Any
    help appriciated. Thanks in advance.

    _global.play_modifier_card(card_num) {
    trace(card_num);
    }

  • Using iPad air, iPod, iCLoud and WinPro 7 - I am not finding all my tunes and movies among all these devices.

    When I orignally installed iTunes current update, and tried to move about the devices iTunes would crash. I uninstalled it, then reinstalled it. It seems to be stable, however as  before I am not finding all of my TUnes and Movies on all my devices.
    Any one?
    Thanks-

    Hey thomnj,
    From what I understand, it sounds like after uninstalling and reinstalling your iTunes as a troubleshooting step, you're now missing some of your media? I would troubleshoot the issue with the steps in here:
    iTunes: Finding lost media and downloads
    http://support.apple.com/kb/TS1408
    Welcome to Apple Support Communities!
    Best,
    Delgadoh

  • HT204370 where do I find my purchased TV and Movies in my library. How can I access them easily??

    What is the easiest and fast way to access my purchased TV and Movies without having to tab thru so many steps??!!

    Huh?
    Click Movies under Library.
    Not sure what you are talking about.
    Please explain

  • Find all music files and move to one folder for all of family to access, find all music files and move to one folder for all of family to access

    I seem to have music files in various places on my laptop, on my husbands computer and our main imac.  What we want to do is put all music on imac so when each of us logs on we have the same files availabe in itunes, but we logon seperately so we can have different playlists and checked music. So here is what I want to do:
    Find all music files on each computer seperately and put everything in one folder one each computer, so three folders total to start...
    Move my husbands itunes library and my itunes library from each of our laptops to our main imac, making one huge itunes folder
    I want to store our music on an external hard drive, which I have, so I have a full library for backup purposes.
    I want all future music downloaded on any of our laptops to transfer to the main imac computer, again to keep one main library
    I want all video, apps, books, etc on each laptop to be available in one file on my main imac also so we can all use them
    So mainly I want to organize, organize, organize and put everything in one spot so things don't get all messed up and some items are only accessible to me some times and not my husband or vice versa.  We want to share everything we can so we don't have to pay twice. I have read many instuctions, but nothing seems to be helping me and was hoping someone could...
    Thanks, l

    I am totally running into the same issue as well. On top of that, when syncing to my iPhone, it took some of the tracks from my iphone and recopied them to the iTunes library, as new files, so now I have a ton of duplicates, and tons of tracks that can't find the iTunes folder, so they have the little "!" next to them.
    It would be really nice to have someone answer this question. I didn't think, moving my iTunes library to a bigger external hard drive would have caused all this madness

  • Setting and calling top level varialbes

    Is there away to call and set a top level variable from a
    child component that way i can access the variable no matter where
    i am from inside the application. For example i have a login
    component that gets the userid. I would then like to set that
    userid to a scope that can be accessed from any other component as
    i use the userid to validate other cfc calls and so on.

    Application.application should get you there.
    i.e. Application.application.myVariable

  • MobileMe top-level folders not accepting mail messages

    Strange thing...
    Now that iPhone has "push" mail, I decided to take all my mail from Mail.app on my mac up to my MobileMe account. I wanted to do this as-is, but it's not quite that simple... However, the whole folder structure and all e-mails therein are now happily living in MobileMe.
    Except that they are not! All the Top-Level folders that contain other folders are now white in Mail.app, and don't exist at all in MobileMe. It's as if all folders were one level higher than they should be - all folders directly contained in a white parent folder appear as top level folders in MobileMe!! On the iPhone, they do exist, but their names are greyed out. Both in Mail.app and on the iPhone, they are empty and you cannot add mail messages to them even though, in Mail.app "on my Mac" they still contain mail and will happily accept mail messages...
    What gives? Is there something I need to do to change them from "folder folders" into "mail folders that happen to also have folders in them"???
    G>

    Not a single answer or post on this...
    I decided to create new folders and add a dummy place holder message in them, then move over all the subfolders to this one. There was a bit of strange behaviour when synchronising with MobleMe (old folder disappeared without my deleting it, etc) but now all is well and all my top level folders can accept mails.
    During the process, it seems like MobileMe didn't know that these folder existed - when renaming or deleting them, I do an error saying that they did not exist. Indeed, on MobileMe, they did not exist and this resulted in all the first level subfolders being at the top level in me.com - very messy. It looks a lot better now!
    G>

  • Move Tool makes the layer disappear

    I'm having so many problems with CS5 bugs...so here's another one.
    If I try to move a layer, sometimes it will completely disappear. This is usually right after I have pasted something but it can also happen with type.
    If the layer is Type, I can select the type and find that it's moved off into Siberia (off the page) and I can then bring it back.
    If it's bitmap, I can't find the thing again and have to delete the layer and repaste.
    Any clue what's up or how to fix it?

    In Photoshop, Edit - Preferences - Peformance, look for the [  ] Enable OpenGL Drawing setting.  Disable and restart Photoshop to test.
    I haven't used a touchscreen, but I can imagine the driver that's intended to interpret touches to move things around could interfere with normal mouse operations.
    Also, one other thing that's very basic but worth checking:  If your mouse is wireless check the batteries.  Also try a different mouse.  Physical mouse problems could possibly be a factor.
    Just a comment about what you mentioned in the original post:  Photoshop doesn't really seem buggy when the system its being run on is solid.  It's a very demanding application, and it can seem as though it's faulty when some of the complex things it relies upon - such as the OpenGL implementation on your GPU - are actually at the root cause.
    -Noel

  • Name from the Top level Parent

    I need to write a property to retrieve value from the top level node. My current heiarchies are:
    A1
         A2
              S1
              A3
    B1
         D2
              S1!Shared
              B2
    C1
         C2
              S1! Shared
              C3
    The required property is to check for the shared node and if the top level parent is A1, then create a property value with A.S1. Similarily, if it is B1 then B.S1 and so on. I am thinking this can be achieved by creating a list, derived property using the top level parent name. ex,
    List     Value
    A1     If shared node then concat A+Name
    How to achieve this?

    The nodes A1 B1 C1 are they part of the same hierarchy and child nodes under the Hierarchy Top Node? or is the scenario something else?
    Thanks
    Denzz

  • Getting top level permissions?

    Hello.
    We have a bunch of folders on a fileserver that has folders shared directly to people instead of AD Groups. I want to get all top level permissions (IE the ones not inherited) and display the top level folder("the root folder") and the usernames
    which have access to it.
    With that information i will create Groups and share to the Group et cetera.
    Is this possible to do powershell? How would i go about doing it?
    Any tips welcome!

    You could try
    this module's Get-AccessControlEntry function. There is a screenshot on its download page that shows sample output. It also has a switch parameter to only show non-inherited ACEs. You could look at permissions at the root folder only, or you could show
    non-inherited ACEs for any folders under the root:
    Get-AccessControlEntry c:\root -NotInherited
    dir c:\root -recurse | Get-AccessControlEntry -NotInherited
    The results can be exported to a CSV, where each line will include, among other things, the path, the type of ACE (allow, deny), the principal, the access mask, and whether or not it is inherited.
    You can also use the Select-Object and/or Group-Object cmdlets on the results to further analyze the permissions.
    Let me know if you're interested in the module and have any questions about it.

  • How do i find and move all files across multiple disks

    I just purchased a 2010 Mac Pro and wanted to set it up with a clean install of Mavericks.  I installed a new SSD as my boot disk and did a clean install of Mavericks on it.   All good so far.
    Now from my previous Macs I have several disks (internal and external) that have pictures, music and movies spread all over the place.
    I want to know how I can search all of the drives for all of a specific file type (i.e, JPEG or MP3) and then move those files to a new folder.  Once I have all of the files of a specific type in a single folder I can create a new library in iPhoto or iTunes using those files.
    I tried AraxisFDF and it worked well for finding the files but when it moves the files it saves then in their original file structure (i.e, volume/folder/folder/folder/file) which places the files in multiple folders again.
    Any ideas?
    Thanks.

    You can clone the respective HDDs using Disk Utility>Restore or Carbon Copy Cloner.  That will guarantee that you have all images and movies backed up.
    Ciao

  • Has anyone tried creating a plugin that you can type in a specific word, and if it comes up in the very top of the page (i think its refered to as the header) it closes the page or tab automatically?

    Has anyone tried creating a plugin that you can type in a specific word, and if it comes up in the very top of the page (i think its refered to as the header) it closes the page or tab automatically? there is a program called POW! by AnalogX that does this, but its only good for IE. And Im a Firefox man. Can anyone look into this or maybe create a plugin that does what POW! does for IE? I will donate to the creater of a plugin that does that. Im so sick of pop ups that most pop up blockers miss.

    The Firefox pop-up blocker is very effective. If you are getting a lot of pop-ups in Firefox, you may have picked up some Malware that is causing those pop-ups.
    Install, update, and run these programs in this order. '''''(Not all programs detect the same Malware.)''''' They are all free for personal use, but some have limited functionality in the "free mode" - but those are features you really don't need to find and remove the problem that you have.<br />
    ''Note: If your Malware infection is bad enough and you are mis-directed to URL's other than what is posted, you may have to use a different PC to download these programs and use a USB stick to transfer them to the afflicted PC.''
    Malwarebytes' Anti-Malware - [http://www.malwarebytes.org/mbam.php] <br />
    SuperAntispyware - [http://www.superantispyware.com/] <br />
    AdAware - [http://www.lavasoftusa.com/software/adaware/] <br />
    Spybot Search & Destroy - [http://www.safer-networking.org/en/index.html] <br />
    Windows Defender: Home Page - [http://www.microsoft.com/windows/products/winfamily/defender/default.mspx]
    If these don't find it or can't clear it, post in one of these forums for specialized malware removal help: <br />
    [http://www.spywarewarrior.com/index.php] <br />
    [http://forum.aumha.org/] <br />
    [http://www.spywareinfoforum.com/] <br />
    [http://bleepingcomputer.com]

  • HT4500 I downloaded my hard drive contents from a hard drive Holder to my lap top. I have all of those files but now I cannot find the original pictures and such from the computer before the trasnfer. Hoe do I get them back without losing what I just tran

    I down loaded my entire contents of my desk top hard drive to my lap top. Now I don't know where my original files and pictures are. How do I find them or down load just what I am missing with out losing what I just installed ?

    Hi Again, Well I found Carbon Copy Clone on my old hard drive so I didn't even need to download it. I just dragged it onto my desktop and I did as you said.  Using CCC and within the folder of users which has my folder of old hard drive there now shows a file called.autodiskmounted (whatever that means) and then it has a version of my hard drive below that called hard drive 1, which has nothing, but above both of these folders, there is a folder with an old user name which shows up empty on the hard drive when I search it, but actually shows lots of folders on the CCC. So without getting too excited, it lists some folders and amongst them are folders I cant see normally in the old hard drive, like my safari settings and favourites, and movies music and pictures. However in the movies pictures and music folders I can only see a  blackish square that looks a bit like a blank screen with the text.localised after it .
    Does this mean anything to you / Is there  apossibility they may be there? When I selected my new laptop as the destination i got this message below so I did not proceed any further as I'm not sure it will back up the files I need..
    To avoid system instability, CCC has applied a filter that will exclude system files from the backup task.
    If you would like to restore your Mac OS X system files, restart your computer from the backup volume and try the backup task again.
    If you are trying to restore a single item or folder, click the "?" button for additional suggestions.
    Is it worth giving it a try? Thanks for this btw, its further than I've got before!!

Maybe you are looking for

  • Multiple devices on WiFi...slow speed

    In our household, we have 2 iPads, 2 iPhones, a Mac Pro laptop, Apple TV and a primary machine that is connected to the Internet via an AT&T modem and distributes the WiFi signal throughout via an older style Airport Express (the flat, round-edged sq

  • Problem with BAPI_PO_CREATE1

    Hi experts, I am getting an error stating no SD data maintained for the material. But I am not getting the error while creating the PO manually using ME21N. CAn anyone of you help me with this? Regards Navin

  • 16 Bit PSD Files Not Compressed

    Something that's not new, but that I've not really noticed before... Image compression in Photsohop CS6 doesn't seem to be effective on a 16 bit PSD when Maximize Compatibility is turned on. For example, with Maximize Compatibility set to Always, if

  • Recently downloaded latest version, will I lose my bookmarks if I replace the old mozilla ?

    I'm currently using the 13.0.1. I just downloaded the latest verison of Firefox. The new version asks me to replace the old one. I'm very happy with firefox, but how do I make sure I do not lose my bookmarks and passwords and details stored on my cur

  • Get Attachment name with rules/filters

    Hello! I want to create a rule through the GroupWise API that trashes incoming mails with certain attachment names. In the CreateRule-Screen there are tons of "filterable" fields avialable, both user defined and system internal, one of them is attach