Script to remove all non-visible channels

I'm looking to do a script that deletes all the strings that are not visible.  This would include the RGB layers.  That would be my first attempt to script.  So I have no idea where to start.  Any help in the right direction would be great.

Thank you

Chris

Thanks for the, Tom. I missed that. However, the unexpected behavior that I have seen was when I delete the red channel, the Green and blue channels are replaced by channels Magenta and yellow and there is a change of color on the image. Turning off visibility red looks different to remove the red channel. Removal of Cyan in CMYK is visually identical to make this invisible channel.

function main() {
  if (app.documents.length == 0) {
    return;
  }
  var doc = app.activeDocument;
  var chnls = doc.channels;
  for (var i = 0; i < chnls.length; i++) {
    var chnl = chnls[i];
    if (!chnl.visible) {
      chnl.remove();
      i--;
    }
  }
}
main();

Tags: Photoshop

Similar Questions

  • Windows 7, script to remove all the user accounts

    I'm on the technical support team.  On my desktop I have connection to more than 10 accounts per day to test and ensure that users are working.   Y at - it a script or a way to remove all the accounts?  Now, I need to right click on "computer" / Properties / advanced system settings / user profile settings / then remove them all one at a time and each of them take like 30-45 seconds.  I can remove the easy user profiles, but all accounts really slow things down.

    Hello

    Thanks for posting your query on the Microsoft Community.

    I would like to know some information.

    You are connected to a domain network?

    I suggest you re-post your query on the TechNet forums because we have experts working on this type of questions and for you help the better.

    Check out the link:

    https://social.technet.Microsoft.com/forums/Windows/en-us/home?category=w7itpro

    Hope this information helps. Please let us know if you need any other help with Windows in the future. We will be happy to help you.

  • Script to remove all rows from a table except the first

    Please see the screenshots for the question/radio button I'm scripting.  If 'No' is clicked, I want to delete all lines except the first.  Therefore, if the first user clicks Yes, adds a bunch of lines and then click on no, I want all the extra lines should be deleted.  I use the script below, but it removes only half of the lines at a time.  I have to click No. 2 - 3 times to remove all the lines.  Appreciate any help!

    // remove extra rows that may have been added
    var rowCount = Page2.UserList.Table1._RowUserName.count;
    for (var i=0; i<rowCount; i++) {
      Page2.UserList.Table1._RowUserName.removeInstance(i);
    }
    
    

    LCD1.png

    lCD2.png

    Hello

    You can directly use the method setInstances of the instanceManager as follows:

    Page2.userlist.Table1._RowUsername.setInstances (1);

    I hope this will help you!

  • Script to remove all embedded images in the beginning upward

    My file crashes on startup, and I know that its because of an image embedded in the file.

    Do someone have a script to remove images that are all integrated to opening a document?

    If ID crashes when you open this file, then a startup script will not help you. This script has open the file and will crash InDesign as before.

    P.

  • Can I program a script to remove all the ISOs datastore on all virtual machines?

    I found a "bug" that if backupexec creates a backup of a computer virtual with a mounted ISO, you can not restore VM to a different host, even after that another backup ran again with the ISO is more fitted. SO whether a backup runs on Monday night with an ISO mounted from the data store and I'm going to come in and chop the ISO and Tuesday backup runs that always, I can not restore the backup from Tuesday to a different host. Also, I should mention that these hosts do not share no matter what storage between them and I can restore to the host of origin without any problem. I'm working on that symantec, but it seems to me that the best response is no, not an ISO mounted when the backup starts, but I can easily predict that sometimes in the life of our environment that someone leaves an ISO mounted so I'll try to find a medium schedule a script that will remove all ISOs mounted in virtual machines. There is a work around by removing the virtual machine in the inventory and recreate the virtual machine with the existing VMDK file, it means having to stop this server whenever someone does this. Any help would be greatly appreciated.

    the script would look like below.

    Connect-VIServer myvcenter.yourdomain.com get-cddrive -VM * |where {$_.ISOPATH -ne $null}|set-cddrive  -nomedia Disconnect-VIServer -Confirm:$false
    
  • A script to remove all rows in the table that contains a specific text

    Hello

    I tried some old scripts but cannot move to the right solution.

    I need a script that deletes all the rows in a table that contains a specific unique word text, something like "xxx".
    Someone has an idea?

    Thank you

    Hello

    To remove a line using row.remove () method.

    Iterate if table.rows and delete the matching condition.

    If we talk about condition, be more specific - what do you mean "a line contains a text:

    ==> 1st cell contains,

    ==> any cell contains.

    Content of the line whole is an array of his cells.contents, so your text from line 1 is:

    rows [0].contents.join ("") ==> string

    Jarek

  • Script to remove all the images, text blocks, and the page numbers on a layer

    I have a 364 pages with 322 illustrations, photographs mainly, for offset printing.

    The photographs will be be overprinted with the varnish on a plate in the fifth, and I set it up as follows:

    On a new layer, (double layer 1) all photos are removed, but not their mounts.

    The frames are then filled with 100% black.

    All text blocks and page numbers must also be deleted.

    I realize I could have done this job easier if I put all the images on their own layer first, but unfortunately I do not have.

    And I don't do myself, script, so I was wondering if anyone has a script that will do...

    With the help of CC 2015.1 on Windows 7.

    Today, I don't have time to finish, which gave time to until now is the following:

      var myDocuments = app.documents.everyItem();
        var myLayers = myDocuments.layers.everyItem();
        var myStories = app.activeDocument.stories.everyItem().getElements();
        var myDoc = app.activeDocument;
        var myLayer = "palette"; //Add your layer name here
        var NewLayer = myDoc.layers.item(myLayer).duplicate();
        myDocuments.pageItems.everyItem().locked = false;
        myLayers.locked = false;
        myDoc.layers.item(myLayer).visible = false;
        NewLayer.name = "SampleNew";    //Add your new layer name here
    
                    re();
                    function re(){
                        var link, image;
                        var openDocs = app.documents;
                        var openDocsLen = openDocs.length;
                        for (var d = 0; d < openDocsLen; d ++){
                        currDoc = openDocs[d],
                        links = currDoc.links,
                        counter = 0;
                        myLayer.locked = true;
                        myDocuments.layers.item(myLayer).locked = true;
                            for (var i = links.length-1; i >= 0; i--) {
                                if (links[i].hasOwnProperty('relink')) {
                                    try {
                                        link = links[i];
                                        image = link.parent;
                                        image.remove();
                                        counter++;
                                    }
                                    catch (err) {
                                        $.writeln(i + " - " + err);
                                    }
                                }
                            }
                        }
                      }
    
            var myStories = app.activeDocument.stories.everyItem().getElements();
            for (i = myStories.length - 1; i >= 0; i--){
                var myTextFrames = myStories[i].textContainers;
                for (j = myTextFrames.length - 1; j >= 0; j--){
                myTextFrames[j].remove();
                }
            }
    

    If nobody finished the second finalized.

    Hug!

  • script to remove all the virtual machines in a folder or a group resource

    Someone at - it a script that will find all the virtual machines within a file or a group of resources and then delete the virtual machines?

    If you're dealing with a specific resource pool or a folder, you can use these.

    $vmlist = get-folder -name "TEST2"  | get-vm
    $vmlist = get-resourcepool -name TestServers | get-vm
    

    And then send it to something like this

    $vmlist | ForEach {
         If ($_.PowerState  -eq "PoweredOn")
              {
              Stop-VM -VM $_.Name -Confirm:$False
              }
         Remove-VM -VM $_.Name -Confirm:$False      }
    

    Also to find files of type VM

    get-folder -name | where {$_.IsChildTypeVM -eq "True"}
    

    Do you need to search the children files or resource pools as well?

    Dave

    VMware communities user moderator

    Now available - vSphere Quick Start Guide

    You have a system or a PCI with VMDirectPath?  Submit your specifications to Officieux VMDirectPath HCL.

  • Please: sql script to remove all users without objects on all databases

    Hi *.

    I need a big help each of you please.

    I have many users who is not more work in our society. Some who receive objects are locked. There are a lot of users and many database servers. And it's that long to finish this work.

    That the why I need your help to give me Scripts anyone who falls all users who have not all objects in all databases on all the oracle Server.

    Und other to import all users of all users who still get items in a table. And I guess to do before Friday 03 July 09.


    Thank you very much in advance

    Sincerely your

    Ora_Genie

    >
    Vincent wrote:
    to give you all the users with no object.

    To simplify can run the script generated by
    >

    Hi Michaels,

    This may not work

    SQL> Create user michaels identified by michaels
      2  /
    
    User created
    
    SQL> SELECT 'drop user ' || owner || ' cascade;' stmt
      2    FROM all_objects
      3   Group BY owner
      4  Having Count(*) = 0;
    
    STMT
    -------------------------------------------------
    

    Maybe this,.

    SELECT 'drop user ' || a.username || ' cascade;' stmt
      FROM all_users   a
         , all_objects b
     WHERE a.username = b.owner(+)
       AND b.owner Is Null
     Group BY a.username
    

    Kind regards
    Christian Balz

    Published by: Christian Balz 07/02/2009 11:18

  • All non-visible keywords

    Only, I expanded my list of keywords in the right column of the LR 2.5.  I wanted to change a keyword starting with the letter 'y '.  I dragged the small pellet down that he would go and he ended up in the R section keywords. It does not seem possible to get lower than the list.  I have a lot of keywords, but don't know how. It would be interesting to have this information at the top of the list.  This may have been dealt with before.

    I read somewhere that this issue (the list of keywords appears not all keywords) is due to a limitation in Microsoft Windows. I imagine that Adobe allows to code around this limitation, but so far they have not. I too have a lot of keywords and the list shows only the Keywords beginning with the letter F or before.

    The only way to see other keywords is to type a letter ('g' for example) in the field 'words filter. This will find keywords that have "g" anywhere in them, like 'hiking'and 'age ". But it should reduce the number of keywords in the list so that you can then scroll down to the words beginning with 'g '. A pain, but unless it works.

    Alan

    PhotoCitizen.com

    Information for travel photographers

  • Gel non - HD channels. Toshiba 32RL958

    If I turn on the TV in standby when you are set to one of the HD channels I find all non - HD channels are "frozen" which is just large blocks of color when I going turn it back on. Unplug all network solves problems, but clearly it shouldn't happen in the first place.

    Any ideas of cause or possible cure? Please don't suggest to contact technical support that they were all as serve a glass of water to the chocolate in the past.

    > Any ideas of cause or possible cure?

    It is possible that the signal is too low or there is interference of digital transmission

  • Need help with script to remove audit ASM files

    Hello

    It would be great if someone can provide me with a script to delete the files of audit and trace on ASM files

    Thank you

    Aerts.

    Ed,

    I have a shell script which is run via cron once a week.  Of course, you need to change the location of the trace and audit files.  This script will remove all files .trc and .trm more than 10 days

    #! / bin/bash

    find/u01/app/oracle/diag/rdbms /... dbname... / path-name ' * .trc ' - mtime + 10 - type f-exec rm '{} ';

    find/u01/app/oracle/diag/rdbms /... dbname... / path-name ' * .trm ' - mtime + 10 - type f-exec rm '{} ';

  • Remove all the missing links with frames

    How can I make a script to remove all the missing links with frames in indesign?

    var doc = app.activeDocument;
    Links var = doc.links;

    for (var i = links.length - 1; i > = 0; i--) {}
    If (links [i] .status == LinkStatus.LINK_MISSING) {}
    try {}
    Links [i] .parent. Remove();
    var image = link.parent;
    var frame = image.parent;
    Frame.Remove ();
    counter ++;

    }
    {} catch (err)
    $.writeln (i + "-" + err);
    }
    }
    }

    I have try this script, but still remain a framework, what is wrong with that?

    It works for me:

    var link, image, frame,
    doc = app.activeDocument,
    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);
            }
        }
    }
    
  • Remove all line breaks

    Hello

    When you paste Acrobat PDF files into InDesign, I often have a ton of extra newlines, I don't want to. Someone at - it a script to remove all the jumps of line in a block of text?

    Why you want to script?

    Just go find grep select request: multiple return unique back, and then click all change.

    Please make sure that you have selected the Option to search: story if you want to change the selected block of text.

    Shonky

  • y at - it script or action to remove all the channels/alpha?

    Hello

    When I'm working on an image, I create a lot of alpha channels, y at - it script/action to remove all in 1 click?

    I run ps cs6 64 bit, windows7 64 bit

    I found a little script, but surprisingly slow

    Thank you

    You can erase the guides with an action or just go to

    View > clear Guides which can be saved in an action.

    A script that should work, gotton using the listener script plugin

    // =======================================================
    var idDlt = charIDToTypeID ("Dlt");
    var desc14 = new ActionDescriptor();
    var idnull = charIDToTypeID ("null");
    var ref1 = new ActionReference();
    var idGd = charIDToTypeID ("Gd");
    var idOrdn = charIDToTypeID ('Ordn');
    Ideal var = charIDToTypeID ("Al");
    Ref1.putEnumerated (idGd, idOrdn, ideal);
    desc14.putReference (idnull, ref1);
    executeAction (idDlt, desc14, DialogModes.NO);

Maybe you are looking for