Script to search layer names

Hi -
Does anyone know if there is a script that can search through layer names within a file for a specific text string and then select it as the active layer?
For instance, if a file has 4 layers, named My LayerX, LayerY, LayerZ, LayerA, I want to automatically search for a layer that has the text "rA" and make it the active layer.
Thanks.

This requires CS4 or better. It searchs using a RegExp and Action Manager so it should be very fast. It is set up now to deal with more than one matching layer.
var re = /rA/;// a reg exp
var matches = collectNamesAM(re);// get array of matching layer indexes
for( var l = 0; l < matches.length; l++ ){
    makeActiveByIndex( l, false );
    // do something with layer
    alert(app.activeDocument.activeLayer.name);
}// next match if any
function collectNamesAM(re){
     var allLayers = new Array();
   var startLoop = Number( !hasBackground() );
   var endLoop = getNumberOfLayer();
   for( var l = startLoop;l < endLoop; l++){
        while( !isValidActiveLayer( l ) ) {
            l++;
        if( getLayerNameByIndex( l ).match(re) != null){
            allLayers.push( l );
     return allLayers;
// Function: getActiveLayerIndex
// Description: Gets gets the Action Manager API index
//                        of activeLayer corrected for Background Layer
// Usage: var idx = getActiveLayerIndex();
// Input: None
// Return: Number - correct AM itemIndex
// Dependices: hasBackground
function getActiveLayerIndex() {
     var ref = new ActionReference();
     ref.putProperty( 1349677170 , 1232366921 );
     ref.putEnumerated( 1283027488, 1332896878, 1416783732 );
     var res = executeActionGet(ref).getInteger( 1232366921 )
                                                       - Number( hasBackground() );
     res == 4 ? res++:res// why the skip in this doc?
     return res;  
// Function: isValidActiveLayer( )
// Description: Checks LayerSection for 'real' layers
// Usage: if( isValidActiveLayer() )
// Input: None
// Return: Boolean - True if not the end of a Set
// Notes:  Needed only if the layer was made active
//               using Action Manager API
function isValidActiveLayer( idx ) {
     var propName = stringIDToTypeID( 'layerSection' );// can't replace
     var ref = new ActionReference();
     ref.putProperty( 1349677170 , propName);// TypeID for "Prpr"
     // 'Lyr ", idx
     ref.putIndex( 1283027488, idx );
     var desc =  executeActionGet( ref );
     var type = desc.getEnumerationValue( propName );
     var res = typeIDToStringID( type );
     return res == 'layerSectionEnd' ? false:true;
// Function: hasBackground
// Description: Test for background layer using AM API
// Usage: if( hasBackground() );
// Input: None
// Return: Boolean - true if doc has background layer
// Notes:  Requires the document to be active
//  DOM:  App.Document.backgroundLayer
function hasBackground(){
    var res = undefined;
    try{
        var ref = new ActionReference();
        ref.putProperty( 1349677170 , 1315774496);
        ref.putIndex( 1283027488, 0 );
        executeActionGet(ref).getString(1315774496 );;
        res = true;
    }catch(e){ res = false}
    return res;
function makeActiveByIndex( idx, forceVisible ){
     try{
          var desc = new ActionDescriptor();
          var ref = new ActionReference();
          ref.putIndex(charIDToTypeID( "Lyr " ), idx)
          desc.putReference( charIDToTypeID( "null" ), ref );
          desc.putBoolean( charIDToTypeID( "MkVs" ), forceVisible );
          executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
     }catch(e){ return -1;}
function getNumberOfLayer(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
var numberOfLayer = desc.getInteger(charIDToTypeID("NmbL"));
return numberOfLayer;
function getLayerNameByIndex( idx ) {
    var ref = new ActionReference();
    ref.putProperty( charIDToTypeID("Prpr") , charIDToTypeID( "Nm  " ));
    ref.putIndex( charIDToTypeID( "Lyr " ), idx );
    return executeActionGet(ref).getString(charIDToTypeID( "Nm  " ));;

Similar Messages

  • Script for using layer name in Save for Web command

    I am using the Save for Web  command (Illustrator CS2) to export layers to CSS so that each layer is  saved as a different jpg.  The only issue I have is that I want the  layer name to be part of the file name, but layer name is not an option  when I look at the "Edit Output settings" dialog for saving files.  Is  there anyway I can do this? I do not have experience writing or working with scripts.
    For example. My fiel name is flower.ai.  I will have 20  different layers (each containing a different color of the same image)  and want the exported file to be flower-scarlet.jpg,  flower-cranberry,jpg, etc. Right now I am looking at renaming all the  files manually, but as I am creating 40 images per product on my website, this will be very time consuming.
    Thanks in advance
    Christine

    Btw.. to make it work for JPGs, change the PNG options to the following:
    var options = new ExportOptionsJPEG();
            options.antiAliasing = false;
            options.optimization = false;
            options.artBoardClipping = true;
            options.qualitySetting = 100; // value of 0 to 100, 60 is medium, 100 is perfect
            options.blurAmount = 0;
            options.verticalScale = 100;
            options.horizontalScale = 100;

  • Script to change layer name in to Document name.

    Hi I would like to make the active layer name the same as the document name.  I know very little about scripting.  I found this script:
    var idoc = app.activeDocument;
    var ilayer = idoc.activeLayer;
    var filename = idoc.name;
    ilayer.name = filename;
    It does almost what I need it to do. except that it also copies the ".ai" in to the layer name.  Is there some way to modify this script to have it exclude or delete the file extension?
    Thanks for any help.

    Or, if you want to keep the same construction as your example...
    var idoc = app.activeDocument;
    var ilayer = idoc.activeLayer;
    var filename = idoc.name;
    filename = filename.slice (0, filename.lastIndexOf(".")); //just add this line to the construction.
    ilayer.name = filename;
    Gustavo.

  • Script for adding layer name to artboard as text

    I've found scripts that are sort of close but not quite this.
    I have 1 artboard and many layers (see image).
    Does anyone have a script that will take the name of the layer, ie "01_Intro" and create and then place the text "01_Intro" on to the art board in layer 01_Intro? Then it would repeat the process for all the present layers?
    Thanks in advance!

    Waterbear,
    something like this?
    // LayersnamesInUpperLeftCorner.jsx
    // https://forums.adobe.com/thread/1546630
    // write layers names in upper left corner of the active artboard
    // required: opened document, no toplevel layers locked, all layers visible
    // regards pixxxelschubser
    var aDoc = app.activeDocument;
    var theLayers = aDoc.layers;
    for (i=0; i<theLayers.length; i++) {
        var txt = theLayers[i].textFrames.add();
        txt.position = [0,0];
        txt.contents = theLayers[i].name;
    Have fun

  • Is there a script for changing layer names in ID CS4?

    I have multiple documents with an average of 20 layers in each. Each of the layers is named for the expiration date of the coupon in the ads. When a new order comes in I retrieve the previous files and change the dates via scripts and the Find/Change option. I have looked but cannot find a way to rename the dates in the layers as well.
    Does anyone know of a script for this?
    Thanks in advance!

    E-mail, eh? You're missing out a lot of fun stuff, as there is
    - editing your own posts
    - using bold and italics to highlight important stuff
    - finally being able to shout (some posters think it's necessary to use a large bold font to make their post stand out in the crowd. They are correct, it does. In the Bad way.)
    - inserting images
    - uh, Jive (-- sorry, couldn't think of any more fun stuff to add)
    Visit the scripting forum (using a web browser, s'il vous plait) by clicking here.

  • A Script to Find and Replace Layer Names

    Are there any scripts to find and replace layer names?
    There is an excellent script available for Photoshop which allows you to not only replace words in layer names, but also insert words as Prefixes, Suffixes and Sequential Numbers.
    The illustrator version of this script only allows sequential numbering: It doesn't offer find and replacing of words.
    Ideally, it would be great if there was something that could do multiple find and replaces in one go:
    (e.g.
    You have layers like this Car, Dog, Bat
    You enter: car(Option1), dog(Option2), Bat(Option3)
    Your layers then become: Option1, Option2, Option3).

    big_smile, that's a very good start! Step 1 of Learning How To Script is indeed, adjusting an existing simple script to make it do more complicated things. (And usually then "break something", which is also a required part of the process.)
    You are correct in your observation this is repetitive stuff. For one or two different items that wouldn't be a problem, but in longer lists you soon get lost.
    The usual way of working with find-change lists is to build an array:
    var layernames = [
    [ 'FHairBowlBoy *Hair', 'Hairboy1' ],
    [ 'FHairCurlyafroBoy *Hair', 'Hairboy2' ],
    [ 'FHairSpikyBoy *Hair', 'Hairboy3' ],
    The general idea is to loop over all names, check if the current layer name is "layernames[i][0]" (the left column) and if so, rename it to "layernames[i][1]" (the right column). If you know how to write a loop in Javascript, then you can implement this right away.
    However ..
    A more advanced way to do this doesn't even need loop to over all layernames -- instead you can immediately "get" the correct name per layer! It's magic! Almost!
    The trick is to use a Javascript object instead of an array. Javascript objects are nothing special; Illustrator's 'layers' is an array of objects, and each object "layer" has a property "name", whose value you can read and set. What I do here is create a new object, where the "name" part is the original layer name and its value is the new layer name. All you need to check for per each layer is if there is a property 'object.originalLayerName', and if so, assign its value to that layer name.
    This looks a bit like the array above, except that (1) you use {..} instead of [..] to create an object, and (2) you add "name:value" pairs instead of "value" only (actually, the 'name' of a value in an array is simply its number).
    So this is what it looks like:
    // JavaScript Document
    var doc = app.activeDocument;
    // name indexed object
    var layernames = {
    'FHairBowlBoy *Hair':'Hairboy1',
    'FHairCurlyafroBoy *Hair':'Hairboy2',
    'FHairSpikyBoy *Hair':'Hairboy3'
    // loop through all layers
    for (var i = 0; i < doc.layers.length; i++)
    //Set up Variable to access layer name
    var currentLayer = app.activeDocument.layers[i];
    if (layernames[currentLayer.name])
      currentLayer.name = layernames[currentLayer.name];
    Enjoy!

  • Copy Layer Name To Clipboard?

    Hi, I've been searching for a way to copy the active layer name to the Windows Clipboard, I'm hoping this a quick solution. What I've managed to do so far is to open the layer properties dialog box, then hit 'CTRL+C' to copy the layer name (because the layer name is already highlighted at this step), and then this successfully copies the layer name to the Windows Clipboard.
    But I find that when the system is under load, the layer properties dialog box is sometimes slow to open, and even so, it seems like it's an extra step that could be eliminated.
    I searched through the keyboard shortcuts, and also through all the layer menus for a keyboard shortcut to just 'copy layer name to clipboard' but can't find anything.
    Anyone know if there's a quick keyboard shortcut to do this or perhaps a quick script that will just copy the layer name?
    Thanks in advance..

    here's actually a script that will display the active layer name in a message box. The catch is, it takes up to 3 seconds to run it -I wonder if there's a way to compress  the script so it runs faster? Nonetheless here it is, so I'm wondering if there's a way to insert a "CTRL+C" somewhere in the script so it will just copy the layer name and skip the message box part at the end.....
    var sLayers = getSelectedLayersIdx();
    var Names = new Array();
    for (var a in sLayers){
        Names.push(getLayerNameByIndex( Number(sLayers[a]) ) );
    alert(Names.join('\n'));
    function getLayerNameByIndex( idx ) {
        var ref = new ActionReference();
        ref.putIndex( charIDToTypeID( "Lyr " ), idx );
        return executeActionGet(ref).getString(charIDToTypeID( "Nm  " ));
    function getSelectedLayersIdx(){
          var selectedLayers = new Array;
          var ref = new ActionReference();
          ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
          var desc = executeActionGet(ref);
          if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){
             desc = desc.getList( stringIDToTypeID( 'targetLayers' ));
              var c = desc.count
              var selectedLayers = new Array();
              for(var i=0;i<c;i++){
                try{
                   activeDocument.backgroundLayer;
                   selectedLayers.push(  desc.getReference( i ).getIndex() );
                }catch(e){
                   selectedLayers.push(  desc.getReference( i ).getIndex()+1 );
           }else{
             var ref = new ActionReference();
             ref.putProperty( charIDToTypeID("Prpr") , charIDToTypeID( "ItmI" ));
             ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
             try{
                activeDocument.backgroundLayer;
                selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( "ItmI" ))-1);
             }catch(e){
                selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( "ItmI" )));
         var vis = app.activeDocument.activeLayer.visible;
            if(vis == true) app.activeDocument.activeLayer.visible = false;
            var desc9 = new ActionDescriptor();
        var list9 = new ActionList();
        var ref9 = new ActionReference();
        ref9.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
        list9.putReference( ref9 );
        desc9.putList( charIDToTypeID('null'), list9 );
        executeAction( charIDToTypeID('Shw '), desc9, DialogModes.NO );
        if(app.activeDocument.activeLayer.visible == false) selectedLayers.shift();
            app.activeDocument.activeLayer.visible = vis;
          return selectedLayers;

  • Saving documents via Scripts: Get current file name and set save path/file type

    I am writing a script that will:
    -Make all layers invisible
    -Make a layer named "background" visible
    -Delete all the invisible layers
    -Save the docment as an EPS file (leaving the original document untouched)
    I am new to scripts and so have based my script by copying code from other scripts.
    Here is my code:
    var doc = app.activeDocument;
    var name = doc.name;
    var hide = function (){ // hide all layers (based on http://forums.adobe.com/thread/644267)
         var L=doc.layers.length;
         for (j=0;j<L;j++){  doc.layers[j].visible=false; }
    hide();
    // loop through all layers
    for (var i = 0; i < doc.layers.length; i++) {
                  // Create the illusrtratorSaveOptions object to set the AI options
        var saveOpts = new IllustratorSaveOptions();
        // Setting IllustratorSaveOptions properties.
        saveOpts.embedLinkedFiles = true;
        saveOpts.fontSubsetThreshold = 0.0
        saveOpts.pdfCompatible = true
    //Set up Variable to access layer name
              var currentLayer = app.activeDocument.layers[i];
    // Loop through the layers and make the back ground layer visible
              if (currentLayer.name == "Background") {
                        docName = name + currentLayer.name+".eps";
                        currentLayer.visible = true;
    // Delete Invisible Layers (based on http://www.cartotalk.com/index.php?showtopic=7491)
    var myDoc=app.activeDocument;
    var layerCount=myDoc.layers.length;
    for (var ii = layerCount - 1; ii >= 0; ii--) {
        var currentLayer = myDoc.layers[ii];
        currentLayer.locked = false;
        var subCount = currentLayer.layers.length;
        for (var ss =subCount -1; ss >= 0; ss--){
            var subLayer = currentLayer.layers[ss];
            subLayer.locked = false;
            if (subLayer.visible == false){
                subLayer.visible = true;
                subLayer.remove();
        if (currentLayer.visible == false){
            currentLayer.visible = true;
            currentLayer.remove();
    // Save Out Document with New Name
    var saveName = new File ( doc.path + "/" + docName );
    doc.saveAs( saveName, saveOpts );
    Everything works fine except:
    1) It saves the document with the name AdobeIllustratorBackground as opposed to the name of the document
    Also, I am not sure how to tell the script to save as EPS and to specify the save location.
    Could some one give me some pointers?          Thanks!

    Thanks! I changed my code to this:
    var title = doc.name;
    var title = title.substring(0, title.length - 3);
    And it now works! (The substring thing removes the .ai extenion).
    However, how do I get it to save it as an EPS? (I found this script that  saves as PNG, but I am not sure how to adapt it to EPS).
    Also, how do I set the file output path?
    Thanks for any help that can be offered.

  • Load files to stack with out file extention as part of layer name

    Ok so as the title says i'm trying to figure out how to modify the "Load Files to Stack..." script so that it doesn't put the file extention as part of the layer name. it makes it a pain to have to go through and remove it when dealing with a lot of layers. I'm using photoshop CS5 on Win 7.
    Also if possible a script that would make Comp Layers for each layer created when loading files to stack it's a bit much to ask but worth a shot

    If anyone is just looking to import files into stack without extension names here's what I did:
    1- Go to your adobe scripts folder:
    64 bit - C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Scripts\
    32 bit - C:\Program Files (x86)\Adobe\Adobe Photoshop CS6\Presets\Scripts\
    2 - Copy and paste these 2 files somewhere other than in the adobe folder like the desktop (I had to due to permission restrictions when saving):
    Load Files into Stack.jsx
    Stack Scripts Only\CreateImageStack.jsx
    3 - Rename these files to
    Load Files into Stack - no ext.jsx
    CreateImageStack_noext.jsx
    4 - edit Load Files into Stack - no ext.jsx (I use notepad++) and save
    Line 16 - <name> Load Files into Stack (no extension) </name>
    Line 43 - $.evalFile(g_StackScriptFolderPath + "CreateImageStack_noext.jsx");
    5 - edit CreateImageStack_noext.jsx, insert this line into "line 411" (just above "app.activeDocument.activeLayer.name = this.fName;") and save
    Line 411 - this.fName = this.fName.replace(/(?:\.[^.]*$|$)/, '');
    6 - copy and paste these edited files back into your adobe ...\Presets\Scripts\ folder (overwrite folder), reload photoshop and you should now see in File > Scripts > Load Files into Stack (no extension) available!
    And for the lazy, here are the two files
    load_files_into_stack_no_ext.zip
    drop these in your photoshop scripts folder:
    64 bit - C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Scripts\
    32 bit - C:\Program Files (x86)\Adobe\Adobe Photoshop CS6\Presets\Scripts\
    Hopefully this helps someone! Why adobe just doesn't have this as the default is beyond me.

  • I want to find the image tag name from Image layer name InDesign JavaScript?

    I want to find the image tag name from Image layer name InDesign JavaScript?

    Hi,
    You can use following script to fetch image tag name and the layer name on which it lie:
    var imgBox = app.activeDocument.rectangles // fetch all rectangular frames from the active document
    for(var i = 0; i< imgBox.length; i++)
      if(null != imgBox[i].associatedXMLElement )
                var b = imgBox[i]
               alert("Image tag name "+imgBox[i].associatedXMLElement.markupTag.name + "\n exist on layer " + imgBox[i].itemLayer.name)
    Hope this would help you to resolve your problem.

  • Exporting Layers to PNG files using each layer name to create the file name??

    Hi All
    I'm trying to sort the following problem and was hoping somebody here could help with a scripting solution - my knowledge extends as far as actions unfortunately - which I don't think is appropriate for this.
    I've created a User interface in Illustrator with many layers and have exported this as a psd with layers.
    Basically what i'm wanting to do is export every layer as a png file while using the layer name to create the file name - each layer needs to be clipped.
    There is no transparency in the png.
    I've run the export to files script - but the names are too long and there is no anti aliasing.
    I've tried running a script from Illustrator - but it doesn't see sub layers - and doesn't name the layers.
    any help would be appreciated.
    thanking you in advance
    regards
    nate

    Hi,
    We just released this tool: FERRY (http://ferry.thedamarmada.com). It does exactly what you want and a little bit more.
    I think it's worth it a try.
    It comes with a free demo that will export 5 layers.
    Take a look and let us know if it's what you need.
    It could be easily tweaked.
    Jordi

  • Script to insert file name into keywords field of same file

    Hello,
    search a solution, a Script or another, which writes the file name into keywords field of same file (Metadata: Description/Keywords) in "photoshop", "bridge" or better in "Lightroom" .
    I found this topic from Mike Hale http://www.ps-scripts.com/bb/viewtopic.php?t=1330
    It's possible this script to change this in such a way that it does this:
    "script to insert file name into keywords field of same file"
    Thanks and best greetings
    Wolfgang

    This works in CS2:-
    #target bridge
       if( BridgeTalk.appName == "bridge" ) {
    nameDescription = MenuElement.create("command", "AddName to Description", "at the beginning of Thumbnail");
    nameDescription .onSelect = function () {
         nameToDescription();
    function nameToDescription(){
    var items = app.document.selections;
          for (var i = 0; i < items.length; ++i) {
             var item = items[i];   
    var m = item.synchronousMetadata;
    filenameToDesc(m, item.name.slice(0,-4));
    function filenameToDesc(metadata, Description) {
    var strTmpl = "name2Desc";
    var strUser = Folder.userData.absoluteURI;
    var filTmpl = new File(strUser + "/Adobe/XMP/Metadata Templates/" + strTmpl + ".xmp");
    var fResult = false;
    try
    { if (filTmpl.exists)
    filTmpl.remove();
    fResult = filTmpl.open("w");
    if (fResult) {
    filTmpl.writeln("<x:xmpmeta xmlns:x=\"adobe:ns:meta/\" x:xmptk=\"3.1.2-113\">");
    filTmpl.writeln(" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">");
    filTmpl.writeln(" <rdf:Description rdf:about=\"\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">");
    filTmpl.writeln("<dc:description>");
    filTmpl.writeln("<rdf:Alt>");
    filTmpl.writeln("<rdf:li xml:lang=\"x-default\">"+Description+"</rdf:li>");
    filTmpl.writeln("</rdf:Alt>");
    filTmpl.writeln("</dc:description>");
    filTmpl.writeln(" </rdf:Description>");
    filTmpl.writeln(" </rdf:RDF>");
    filTmpl.writeln("</x:xmpmeta>");
    fResult = filTmpl.close();
    metadata.applyMetadataTemplate(strTmpl, "replace");
    filTmpl.remove();
    catch(e)
    { fResult = false; }
    return fResult;

  • Script to set display name in iCS Calendar view to the LDAP CN

    Script to set the display name in the Calendar view for iPlanet Calendar
    Server(iCS) to the LDAP common name(CN)
    By default, iCS uses a user ID(uid) based on an employee number, rather than on
    an employee's first and last name, as the calendar ID(calid).
    The current release of iCS (5.0 P2) does not create a display name for a
    calendar when a user enables a calendar by logging in; by default, it will
    list the calid again in the Display Name field of the Calendar view.
    For example, if an employee has a calid of "12345," when you click the
    Calendar tab to view the calendar, the Display Name will appear as follows:
    <P>
    12345 (12345)
    <P>
    A problem arises when a user tries to subscribe to another user's calendar.
    Although the search criteria are based on the calid and the Display
    Name, the only information currently stored in the calendar database is the
    calid. Therefore, users will be unable to subscribe to another
    user's calendar unless they know the calid of that person. The next
    patch release for iCS will remedy this problem by using common names(CNs) as
    the Display Names. That is, the database will store the CN values
    from LDAP for users, and the Calendar view will appear something as follows:
    <P>
    12345 (John Doe)
    <P>
    Until this next release of iCS, there are two options to work around this
    problem.
    <P>
    <OL>
    <LI>You can "provision" users by running the cscal
    administrative utility with the
    Display Name option.
    <P>
    OR
    <P>
    <LI>If the user community already exists, you can use the sample Perl script
    below to search through the calendars of users.
    <P>
    Note: If a default calid exists that doesn't have a Display Name, the script
    will search the LDAP directory to find a CN to set as the Display Name for
    that calendar.
    </OL>
    <P>
    <HR>
    <P>
    <B>Sample Perl Script:</B>
    #!/bin/perl5.004
    sub TRUE {1}
    sub FALSE {"}
    $SIG{INT} = 'handler';
    $SIG{QUIT} = 'handler';
    $mypath = $ENV{'LD_LIBRARY_PATH'};
    $savepath = $mypath;
    $ENV{'LD_LIBRARY_PATH'} = $mypath.';.';
    #--------------INITIALIZATION----------------
    $host="ldaphost";
    $base_dn="ou=People,o=iplanet.com";
    $port=389;
    $auth_dn="cn=Directory Manager";
    $auth_pwd="password";
    $found_confile = TRUE;
    $default_cal = FALSE;
    open(CSCAL,"./cscal -v list |");
    while($cal_list = <CSCAL>)
    if ($cal_list =~ m/: owner=/)
    @calid = split(' ',$cal_list);
    chop($calid[0]);
    print "\ncalid: $calid[0] ... ";
    $default_cal = TRUE if ($calid[0] !~ m/:/);
    } elsif (($default_cal) && ($cal_list =~ m/^ name=([a-zA-Z ]*)/)) {
    chomp($1);
    print "cal name: $1";
    if (($1 EQ ") || ($1 EQ $calid[0]))
    open(LDAPSEA,"./ldapsearch -h $host -p $port -b \"$base_dn\" -D
    \"$auth_dn\" -w \"$auth_pwd\" uid=$calid[0] |");
    while($ldap_list = <LDAPSEA> )
    if ($ldap_list =~ m/^cn: ([a-zA-Z ]*)/)
    chomp($1);
    `./cscal -n "$1" modify $calid[0]`;
    print "The display name for $calid[0] is being modified to be: $1\n";
    sleep(1);
    close(LDAPSEA);
    $default_cal = FALSE;
    close(CSCAL);
    sub handler
    local($sig) = @_;
    print "... Caught a SIG$sig--closing down shop\n";
    close(CSCAL);
    close(LDAPSEA);
    exit(0);
    }

    anne wrote:
    Hi David,
    About your confuse about"case when 1=2 then "product_d"."name" else "calendar_d"."year" end".
    You can try in your locale.
    You will find they are different.
    BASED ON THAT you have two table product_d and calendar_d AND they are related by one Fact table.
    THEN When you type in
    "case when 1=2 then "product_d"."name" else "calendar_d"."year" end"
    AND
    "calendar_d"."year",
    IT WILL SHOW U TWO different RESULTS.
    I need to show year which its related product is not null. but I cannot use SHOW->SQL RESULTS->TYPE SOME "WHERE..." because I also need to use "constrain"..
    That why I choose to use a case when function..
    So, do you have any idea about this?
    Regards,
    AnneWhy not use two filters in your request? Have something like this:
    product_d.name IS NOT NULL
    AND
    calendar.year IS PROMPTED?
    ...instead of using a CASE statement? This way you can have both filters show the way they should in a meaningful way.

  • Replace layer names in selected layers only

    I am using this script to find and replace words in layers. (The script only targets particualr words, rather than the whole layer name).
    I would like to make it so it targets selected layers only.
    I have found this script which loops through selected layers only, but I am not sure how to add the find and replace layer name functioality.
    Thanks for any help that can be offered.

    big_smile wrote:
    Looking through the guide, it doesn't seem "hasSelectedArtwork", is a built in function either. Are there any tutorials or guides that explain how to target selected layers?
    Wrong reference manual, see this one:
    http://www.adobe.com/content/dam/Adobe/en/devnet/pdf/illustrator/scripting/cs6/Illustrator -Scripting-Reference-JavaScript.pdf
    Page 91 -- CHAPTER 1: JavaScript Object Reference
    Layer
    Property
    hasSelectedArtwork
    Value type
    boolean
    What it is
    If true, an object in this layer has been selected; set to false to deselect all objects in the layer.
    So as I talked about here:
    W_J_T wrote:
    Correct. Yeah there is no direct way unfortunately (like many things via scripting), thats why I suggested using "hasSelectedArtwork", that would work if you select the layer target when selecting your desired layers to rename.
    and...
    W_J_T wrote:
    if(layerReferenceString.hasSelectedArtwork == true){
         // relative code
    That would offer a way to know if a layer is selected or not.
    As far as I know that is the only round about way of knowing if a layer is selected via scripting.

  • Save as png- layer name changes

    I'm using PNG save options to generate a PNG from a psd, but when I run the script the final output changes the layer name that was set in the original file to "layer 0". If I comment out the close command, I can see the layer name stays throughout the entire process, but don't know why the save as would cause the layer name to be lost? Any ideas?
              pngOptions = new  PNGSaveOptions();
              pngOptions.interlaced=false;
    myDoc.convertProfile('sRGB IEC61966-2.1', Intent.RELATIVECOLORIMETRIC, true, true );
    myDoc.saveAs((new File(folderString)),pngOptions,true);

    I have a new need with this same project. I have 12 separate .psd files per product (same product but in different color combinations). Each .psd has 144 layers with unique layer names. Once I open one file, I run an action script (recorded within PS) to update all the layers links, and rename the layers with the product sku # with a 3rd party Script. This sku # is the same # that all 12 files need to be updated with. The problem is that when i run this recorded script, I have to manually punch in the sku # for each file even though it is the same for everything because the script brings up a window each time it is called upon. The info doesnt stay in the script. THEN, the recorded scripts saves, then save as and the name of the file just stays the same and saves over itself... which is bad. I need it to save as a new name (1,2,3 or a,b,c would be fine) so I can rename later. Can you help me streamline the production of this project please so I dont have to sit here forever!?!?!
    Thanks a million.
    Kelly

Maybe you are looking for

  • Fillable PDFs and databases, what's it all about?

    Hi Everyone I'm using Adobe Pro 9 with LC built in and I started using LC forms to collate data from colleagues, basically I created a form then distributed it via email and people would then fill it in and send it back to me. I would collate this in

  • MODEL clause using CONNECY BY PRIOR

    Hello. I have the following table, CONTEXT_MAPPING: Name Null? Type ID NOT NULL NUMBER(38) CONTEXT_ITEM NOT NULL VARCHAR2(30) ID_1 NUMBER(38) ID_2 NUMBER(38) ID_3 NUMBER(38) ID_4 NUMBER(38) ID_5 NUMBER(38) It's a self referencing table, i.e. ID_1 wil

  • "getIndexOfChild" never called !!!   IMHO

    Hi guys, I want to override DefaultTreeModel so it would show root's child in ascending order, like following(In model they are saved in random order) ROOT + | ---+ AAA | ---+ BBBBB | ---+ CCCC I'm trying to reach it by overriding getIndexOfChild met

  • [Oracle VM 3.1.1] vm backup

    Hi all, What is the best method or method that You use to backup full vm`s? Thanks in advance

  • How to re-install CS5 for Windows on a Mac? [was:Question]

    Does it cost anything to re-use CS5 on a new personal computor when switching operating systems, windows to mac?