Script for batch delet redundant layer

I have thousands files in the different folders, each file has same layer named “Job Info”. Can someone help me to write a script for del this layer folder by folder?
I expected the script tells me that I have to select a folder, then it can automatically open the files, del “job info” layer then save file, rewrite, close file

Hi Ashram,
Sorry, I misunderstood your question. Please try the below.
var folder = Folder.selectDialog ("Select the root folder");
var myfiles = [];
var _layers = ["test1", "test2", "test3"];
getsubfolderfiles(folder);
for(var i =0;i<myfiles.length;i++)
        var doc = app.open(myfiles[i],false);
        for(var j=0;j<_layers.length;j++)
            try
                app.activeDocument.layers.add({name:_layers[j]})
            catch(e){}
        doc.save();
        doc.close();
function getsubfolderfiles(folder)
    var filelist = folder.getFiles();
    for(var i =0;i<filelist.length;i++)
        if(filelist[i] instanceof Folder)
            getsubfolderfiles (filelist[i]);
        else if(filelist[i] instanceof File)
            if(filelist[i].name.indexOf(".indd") > -1){
                myfiles.push(filelist[i]);
Hi HarveyLiu,
Try this,
var folder = Folder.selectDialog ("Select the root folder");
var myfiles = [];
getsubfolderfiles(folder);
for(var i =0;i<myfiles.length;i++)
        var doc = app.open(myfiles[i],false);
        try{
            var _layer = doc.layers.item("Job Info");
            _layer.remove();
            var link, image, frame,
            links = doc.links, counter = 0;
            for (var i = links.length-1; i >= 0; i--) {
                if (links[i].status == LinkStatus.LINK_MISSING) {
                    try {
                        link = links[i];
                        image = link.parent;
                        frame = image.parent;
                        frame.remove();
                        counter++;
                    catch (err) {
                        $.writeln(i + " - " + err);
        catch(e){}
        doc.save();
        doc.close();
function getsubfolderfiles(folder)
    var filelist = folder.getFiles();
    for(var i =0;i<filelist.length;i++)
        if(filelist[i] instanceof Folder)
            getsubfolderfiles (filelist[i]);
        else if(filelist[i] instanceof File)
            if(filelist[i].name.indexOf(".indd") > -1){
                myfiles.push(filelist[i]);
Regards,
Chinna

Similar Messages

  • Action script for batch-opening psd layer files flat? (alt+shift?)

    hi
    i am daily batch processing with an action script to make flat tiffs from psd layer files, like 10-100 files every couple of days in my workflow.
    until now i could not fine a solution to begin the batch processing-action with opening layer files FLAT.
    the reason is: i am working with huge files, 5-20GB .psb files, (16bit, ECI-RGB, 50x100cm, 300dpi) and it takes a couple of seconds to open with my pcie-SSD.
    that multiplies the time it takes to open 50 of such files. i would gain a lot of time, if photoshop cs6 would not open it with layers, but flat.
    there is a workaround i am using daily: (osx) hold alt+shift, then click on the layer file in the finder and cs6 opens it flat.
    but that did not work in the action script. it doesnt store the keyboard command alt+shift.
    any idea how i could save time and use the alt+shift command in the action script or any other solution please?
    thanks
    peter

    I just tried to record this using ScriptListener, and it didn't record it either.  No indo in the ExtendScript SDK on this either.  I don't think that this is possible at this time.  Maybe someone who know more than I do can find a way.

  • Shell script for batch compilation of forms 10g on AIX 5.3L AS

    Hi All,
    Can anybody provide me the Shell script for batch compilation of forms 10g and reports 10g on AIX 5.3L AS?
    Regards,
    SAM

    Hi Alex,
    I tried with the below script as well as the one you had posted.
    ORACLE_HOME=/opt/oracle/OraHome_3
    export ORACLE_HOME
    TNS_ADMIN=$ORACLE_HOME/network/admin
    export TNS_ADMIN
    LIBPATH=$ORACLE_HOME/lib32:$ORACLE_HOME/jdk/jre/bin:$ORACLE_HOME/jdk/jre/bin/cla
    ssic:$LIBPATH
    export LIBPATH
    cd ../forms
    for i in `ls *.pll`
    do
    echo Compiling Library $i ....
    $ORACLE_HOME/bin/frmcmp module=$i userid=mydbuser/mydbuser@mydb
    batch=yes module_type=library
    compile_all=yes window_state=minimize
    done
    export ORACLE_HOME=/opt/oracle/OraHome_3
    export ORACLE_TERM=vt220
    export LD_LIBRARY_PATH=/opt/oracle/OraHome_3/lib:/opt/oracle/OraHome_3/jdk/jre/l
    ib:/opt/oracle/OraHome_3/jdk/jre/lib/i386:
    cd ../forms
    for i in `ls *.pll`
    do
    echo "Compiling Library $i ...."
    /opt/oracle/OraHome_3/bin/frmcmp module_type=form userid=mydbuser/mydbuser@mydb
    module=$i batch=yes compile_all=no
    window_state=minimize upgrade=no
    done
    echo "PLL Compilation done"
    But there was a same kind of error thst turning up all the time.
    Compiling Library Agf.pll ....
    Forms 10.1 (Form Compiler) Version 10.1.2.0.2 (Production)
    Forms 10.1 (Form Compiler): Release - Production
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    PL/SQL Version 10.1.0.4.2 (Production)
    Oracle Procedure Builder V10.1.2.0.2 - Production
    Oracle Virtual Graphics System Version 10.1.2.0.0 (Production)
    Oracle Multimedia Version 10.1.2.0.2 (Production)
    Oracle Tools Integration Version 10.1.2.0.2 (Production)
    Oracle Tools Common Area Version 10.1.2.0.2
    Oracle CORE 10.1.0.4.0 Production
    FRM-10043: Cannot open file.
    Form not created
    I hence updated the permissions on the pll as below
    -rwxrwxrwx 1 oracle oinstall 335872 May 19 16:31 Agf.pll
    But the problem is still persisting.
    My environment details are as below.
    I am working on Win XP machine. Connected to my AS via telnet and xmanager. I have set my DISPLAY to my local IP.
    Is there any thing more that I need to do? If so then let me know.
    Regards,
    SAM

  • Scripts for adding/deleting/modifying Open Directory accounts?

    I think I have searched high and low for an answer to this question, but if I missed it please point me in the right direction. Where can I find information on scripts for adding/deleting/modifying open directory accounts? At the very least, a command line utility with some syntax guidelines! Any help would be greatly appreciated.

    Hi
    I personally don't know if any scripts although you can use the command line to do pretty much anything you want with the Open Directory. Consult the manual: man dscl. If you launch terminal and issue dscl you should see something like this:
    my-Laptop:~ me$ dscl
    dscl (v20.4)
    usage: dscl [options] [<datasource> [<command>]]
    datasource:
    localhost (default) or
    <hostname> (requires DS proxy support, >= DS-158) or
    <nodename> (Directory Service style node name) or
    <domainname> (NetInfo style domain name)
    options:
    -u <user> authenticate as user (required when using DS Proxy)
    -P <password> authentication password
    -p prompt for password
    -raw don't strip off prefix from DS constants
    -url print record attribute values in URL-style encoding
    -q quiet - no interactive prompt
    commands:
    -read <path> [<key>...]
    -create <record path> [<key> [<val>...]]
    -delete <path> [<key> [<val>...]]
    -list <path> [<key>]
    -append <record path> <key> <val>...
    -merge <record path> <key> <val>...
    -change <record path> <key> <old value> <new value>
    -changei <record path> <key> <value index> <new value>
    -search <path> <key> <val>
    -auth [<user> [<password>]]
    -authonly [<user> [<password>]]
    -passwd <user path> [<new password> | <old password> <new password>]
    Entering interactive mode...
    The above is for 10.4 and should server equally as well for 10.5.
    Hope this helps, Tony

  • Script for batch processing

    Hello
    I need help
    I created a batch sequence which set watermark and security to pdf files from one directory. Now i want to create another sequence: 1. set security to none and 2. delete watermark.
    I have a problem with set security to none because every time i need change preferences for batch process to security method=password security by hand.
    Maybe there is a way to change this settings with java script in batch "execute java script"?
    Or how i can change with batch sequence a security method from passsword security to "none" if i know password
    Thanks in advance

    Create a "blank" batch process (ie, without any action), but under the Output Options tick the box to optimize the files and set the optimization settings you want to use.

  • Archiving object for batch deletion

    Hi   ,
    Please let me know the archiving object for batch date deletion from table MCHA.
    MM_SPSTOCK is for archiving batch date from table MCHB.
    Thanks in advance,
    Vinayak

    MM_SPSTOCK - is for archiving all the Batch related data including speical stocks. This will take care of your Batch Tables MCH1, MCHA, MCHB(own stock) and also all of the special stock tables like MSKA, MKOL, MSKU, MKOP, MSLB .....(if used in your company)etc. You should be fine just using this object

  • Script for Batch Exporting XML from IDCS3 files

    Does anyone have a script they would share for batch exporting XML from IDCS3 files? I do not know anything about scripting so I do not know how to write one myself. I've also searched around and cannot find anything. I would appreciate any help with this anyone can offer.
    Thanks,
    Janine

    Or use below Code:
    try {
         inFolderName= Folder.selectDialog ("Input Folder:");
         outFolderName= Folder.selectDialog ("Output Folder:");
         if ((inFolderName != null) && (outFolderName != null))
              var idFileFolder = new Folder(inFolderName);
              var files = idFileFolder.getFiles("*.indd");
              for(myCounter = 0; myCounter < files.length; myCounter++)
                   var theDocument = app.open(File(files[myCounter]));
                   with ( theDocument ) {
                   myXMLFile = new File(outFolderName + "/" + name.replace(".indd","") + ".xml" );
                   exportFile( ExportFormat.xml, myXMLFile );
                   close(SaveOptions.no);
    catch (err ) {
    alert("All files export");
    Shonky

  • Max record limit for Batch delete

    Hi,
    Is there a limit on the maximum number of records that can be deleted using the batch delete functionality?
    If I select an Account list which has more than 200 records, so it covers more than one page of the list view. When I select batch delete, does that delete all the records or just the 100 records on the first page?
    Regards,

    The batch delete will delete all the records in the list. There is no upper limit on batch delete.
    Edited by: bobb on May 4, 2011 7:30 AM

  • Script for moving & deleting files

    Hi
    I'm quite new to scripts & looking for a script to move selected files with time-stamp & also a script to delete selected file/s in a directory. Below is an example of my requirement
    Move
    Ex:  c:\work\source\test.txt to c:\work\target\test.txt_04202015022100
    Delete
    Ex: c:\work\target\test-1.txt
    Could someone help me please.
    Thank very much
    Neil

    This forum is for scripting questions rather than script requests.
    Please start by reading the following:
    Posting guidelines
    Handy tips for posting to this forum
    How to ask questions in a technical forum
    Rubber duck problem solving
    How to write a bad forum post
    Help Vampires: A Spotter's Guide
    -- Bill Stewart [Bill_Stewart]

  • Script for automatic delete of archive logs/redologs

    Hi Experts,
    Do you have any idea on how to create a shell script. Actually the function of it, is to automatically deletes the archive logs/redologs if reaches the limit. Or is there any parameter to change to set the automatic deletion of archive logs/redologs.
    Regards

    Hi,
    at first, archivelogs should always be saved to tape before you delete them. If you don't want to backup them, may be for a test system, you can suppress them in ORACLE instead to delete them later.
    You can run the database in "NOARCHIVE LOG MODE". If you do so, the online redologs are not archived, they are still reused and overwritten. You can not run an online Backup, when the database is in noarchive log mode. If you want to backup the database, you have to run an offline backup.
    Do not use the NOARCHIVE LOG MODE for production or developemet systems.
    To change the archive log mode:
    shutdown the database
    startup mount;
    alter database noarchivelog;
    alter database open;
    archive log list       will show the actual status
    regards Ulrich

  • Need script for batch Open/Flatten/Outline/Print Preset/Close/Repeat

    I have an Action created that I use in batch mode on deadline day to flatten my artwork, convert text to outlines, print to our press' desired settings (output to postscript file then distilled from there), then close without saving.
    The problem is even tho tho the Action has a step for the desired print preset, I still have to use the dropbox and select it, then click Print to get the action going again- if I take out the icon where it stops the script to wait for my input, then I get a "Can't print the illustration.  The Color Mangement settings are inconsistent"  error.    So I use the dialog icon to use the drop down to select my desired printer.
    From there the action has a 'Close' step where I get a question asking me to Yes or No to save the file.   I want to always answer No to the question as I want to preserve the file from being flattened and outlined- I just want the copy to be.    The action will not save the No answer to that question.
    This forces me be at the computer and select the printer, click the print button, then answer 'No' for ever file in the batch.   I have to do this for a few hundred files-  its a process that takes over an hour. 
    I think I need a script or some help with the Action so I can get up from the chair and walk away while it does it for me.  I've posted here before years ago but got no response.  I've been dealing with what I have.
    PC, Latest version of IllustratorCC2014
    I'm willing to pay for someone to write a script. 

    I'll PM you to try to help you.   Sorry you had to wait so long for a reply.

  • Z program for batch deletion request

    Hello I am a consultant mm inexperienced, need to help guide a abap so you can make a program where you can make the Z deletion request batch, in the transaction principle "MSC2N."
    Please someone can help me? Bapi there is a standard or something?

    Hi Chandrashekhar,
    You can do so using RSBDCSUB.
    Please refer below link :-
    [http://help.sap.com/saphelp_40b/helpdata/pt/fa/09714d543b11d1898e0000e8322d00/content.htm]
    Regards
    Abhii

  • Script for renaming selected shape layer items

    Does anyone know if such a script exists?
    That is to say, a script that renames the selected sub-items of a shape layer (paths, groups, shape generators etc).
    Am aware there's already scripts to rename selected layers and layer masks. Have attempted to rewrite these to deal with shape layer items, but to no avail.
    Many thanks

    I was able to rename them using these:
    "Path 1"
    app.project.item(1).layer("Shape Layer 1").property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Shape - Group").name = "MY NEW PATH NAME";
    "Shape 1"
    app.project.item(1).layer("Shape Layer 1").property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Graphic - Stroke").name = "MY SHAPE NAME";
    "Fill 1"
    app.project.item(1).layer("Shape Layer 1").property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Graphic - Fill").name = "MY FILL NAME";
    "Group 1"
    app.project.item(1).layer("Shape Layer 1").property("ADBE Root Vectors Group").property("ADBE Vector Group").property("ADBE Vectors Group").property("ADBE Vector Group").name = "MY GROUP 1 NAME";

  • Apple Script for deleting podcasts

    I subscribe to a lot of podcasts, but I don't want to keep them in my iTunes library after I'm done listening to them. Is there an Apple Script for automatically deleting podcasts? Thanks.

    Thanks - once I'm in Automator and select Music, I don't see any options for finding Podcasts. Any suggestions which item/step I should select next in Automator? Thanks.

  • Batch Select or Batch Delete?

    When there'a a lot of mail in my iPad Inbox (POP account), there's no way to "select all" for batch deletion.
    Am I missing something?

    If you have gmail you can batch delete using Safari. Log into gmail using Safari. Scroll down to the bottom of the page and click on the link labeled DESKTOP. The page will reopen up with more options. Click on the box above the first email and select ALL and then hit delete. This will delete emails that are selected off of the sever.
    You might be able to use Safari with other mail providers to batch delete emails.

Maybe you are looking for

  • How to fetch Properties of all Survey Lists from site collection using Java Script in SharePoint 2013

    Hi, I am trying to fetch properties of all lists of "Survey Type" from my site collection in SharePoint 2013 using script editor web part. I am able to fetch properties of one list by mentioning its name explicitly in code but not all survey list. My

  • How to undo "key photo" in iPhoto

    How can I undo "key photo" in iPhoto '11?

  • 7.02 installation problem

    Hello there, I've installed the NetWeaver 7.02 trial before on another pc and the installation went smoothly. Now, I am trying to install it on my work pc for an offline demo I need to do of ABAP Web Dynpro. This is causing me problems. The installer

  • Cant restore Iphone 3G after failed install of OS 4

    Hi ppl, I tried to update my iphone 3G with the new OS4. I downloaded and installed the new itunes 9.2 beta along with os4. The initial setup went well but the I had an unknown 2006 error along with this code. 2010-06-15 18:06:51.000 iTunes[246:20b]:

  • Query for ODSI service

    Hi Mike, I was wondering whether we can add order hint i.e. /*+ ordered */ in an ODSI query. Kindly help regarding the issue.