Select a channel by using scripts?

Hello

I want to choose the red channel in a photoshop script?

app.activeDocument.activeChannels = app.activeDocument.componentChannels.getByName ('Red');

Could you please rectify above the line?

Thanks in advance,

Rajiv.s

Thank you both...

Thanks for your scripts...

Tags: Photoshop

Similar Questions

  • How to get the RGB value of a pixel in a psd document using scripting Photoshop

    Hi, guys!    Does anyone know how to get the RGB value of a pixel in a psd document using scripts in Photoshop?  I myself have missed for a long time and could not resolve. I am very happy to hear your voice as soon as possible!

    Here is an example...

    var originalUnits = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    var doc = activeDocument;
    var Colour1 = GetHexColour(eyeDropperRGB(1,doc.height-1));
    var Colour2 = GetHexColour(eyeDropperRGB(20,doc.height-5));
    var Colour3 = GetHexColour(eyeDropperRGB(40,doc.height-14));
    alert("Colour 1 = " +Colour1 + "\rColour 2 = " +Colour2 + "\rColour 3 = " +Colour3);
    var decColour = eyeDropperRGB(40,doc.height-14);
    alert("Red = " +decColour[0] + "\rGreen = " +decColour[1] + "\rBlue = " +decColour[2]);
    app.preferences.rulerUnits = originalUnits;
    function GetHexColour(reqHex){
    var out='';
    for(No in colours = reqHex){
     out = out.concat(zeroPad(d2h(reqHex[No]),2));
     }
    return out;
    };
    function eyeDropperRGB(x,y) {
     var x2 = x + 1;
     var y2 = y + 1;
     var out = new Array(3);
     activeDocument.selection.select([[x,y], [x2,y], [x2,y2], [x, y2]], SelectionType.REPLACE, 0, false);
     for(ch in list = ["Red", "Green", "Blue"]) {
     histogram = activeDocument.channels[list[ch]].histogram;
      for (i = 0; i <= 255; i++) {
       if (histogram[i]) {
        out[ch] = i;
        break;
       }
      }
     }
      return out;
    };
    function d2h(d) {return d.toString(16);}
    function zeroPad(n, s) {
       n = n.toString();
       while (n.length < s)  n = '0' + n;
       return n;
    };
    
  • Disable a node using scripts

    Leave well as I a VI.  Using scripts I can find all the objects of a particular type on the block diagram.  Is there an easy way to tell is now drawing a design schema for the disabled around all nodes, I found?

    Like lets say I want to find all nodes property on a block and disable them.  The only solution I found was to find all nodes in property, by using the crossbar for GObjects, then I can make a new Structure to be disabled with the new object VI, put in the same place and the limits that the property node, with the same owner.  But then, I still need to move the property node in the case of persons disabled structure.  But then, I have all kinds of broken wires that were once on the property node that I now moved ousur.  I need to understand how it was designed before the move, it wire to the tunnel Structure with disabilities then wire the tunnel on the pod on the property node.  I need to do for each wired terminal and each property node.  And then I need wiring through the case turned on the structure.

    What I was hoping to find a way to pull the disabled schema structure using scripts, but perform the same operation as if I drew the structure is, and this are also all nodes I captured with my draw, in the case of people with disabilities.  Is there a way to do this with scripts?  Can anyone think of a simpler way to disable nodes using the design schema disabled?  Thank you.

    Try to use the method of Sélection Enclose . There is here an example of shipping for it:

    examples\Application Control\VI Scripting\Moving Objects\Enclose selection and Move.vi

    .. .aaaand I just now discover after the opening of this example that someone recommended this method recently for a new method of selection to reach 2 . I'll take the updated example.

    Anyway, the strange thing about this method is that it must give the method a reference to an actual structure to define what kind of structure you want to encapsulate the code with. This requires usually drop a dummy structure, by calling Enclose Selection 2, then removing the dummy structure after that wraps the code.

  • Select multiple channels for a single task - control and shift keys do not work

    Hello

    Following the advice of several other positions, I try to choose several physical channels in the drop-down list so that I can then use the function "unflatten channel channel" later. It seems that if I hold this key is pressed or cntrl, I should be able to select multiple channels in the list, however, this does not work for me. I tried to go in the "navigation key" property for the control channel to task, but there not all listed associations. Someone else has encountered this and found a solution?  I previously around that by declaring several channels by a colon (for example, ai1:3), but it does not work for the unflatten function.

    Thank you

    Claire.

    If I understand correctly, I think that you need to do is use a task property DAQmx. Try to use the channels property to get an array of strings.

  • How to "save under" a document by using scripts

    I want to use scripts to automate the creation of badges of identity. I have a model PSD of the badge that includes a slot for the photo and a text field for the name. The approach that I took in my script is simple:
    1. Invites the user to select the source for the pictures folder.

    2. for each folder in the folder, follow these steps:
    -resize the photo

    -Copy the background of the photo layer

    -close the document and the focus back on the PSD template

    -Place the copied picture as a new layer

    -It translates into a certain position if it fits in the slot of the picture of the model

    -change the text in the text layer for the name of the photo, we have placed (which is the real name of the person)

    3. save the photo in jpg with some given save options in a certain folder of output.

    Step 1 and 2 only when needed. However, when I save the badge, I get a really strange error saying:2QrAQ3T.png

    Here is all of the code (JS):

    var sourceFolder = Folder.selectDialog ("Selecteaza folderul cu pozele: ");  //prompt the user to select the source folder
    var files = new Array();
    files = sourceFolder.getFiles ();  //put the files from the folder inside an array
        var startRulerUnits = app.preferences.rulerUnits;  //save the initial units used
        var startTypeUnits = app.preferences.typeUnits;
      
        app.preferences.rulerUnits = Units.PIXELS;  //change the units to pixels so the translate command will work as expected
        app.preferences.typeUnits = TypeUnits.PIXELS;
    var mainDoc = app.documents.getByName ("Ecuson.psd"); //this is the name badge template
    var so = new JPEGSaveOptions(); //the save options i'll use with the save command
    so.embedColorProfile = true;
    so.formatOptions = FormatOptions.STANDARDBASELINE;
    so.matte = MatteType.WHITE;
    so.quality = 10;
    for(var i = 0; i<files.length; ++i){ //loop thru each photo in the folder
        var img = app.open(files[i]); //open the image
        var saveFile = new File("C:/Users/Eugen/Desktop/salvate/" + String.valueOf(i+1)); //this is the file where I'll save the jpg file
        var nume = img.name.replace(".jpg", ''); //this is the name of the image I just opened. I remove the jpg extension so only the name is left
        app.preferences.rulerUnits = startRulerUnits; //I change the units back t their original value as for this phase I need to use CM
        app.preferences.typeUnits = startTypeUnits;
        img.resizeImage (3, 4, 300); //resize the image to 3x4 cm at 300 dpi
        app.preferences.rulerUnits = Units.PIXELS; //change the units to pixels again
        app.preferences.typeUnits = TypeUnits.PIXELS;
        img.backgroundLayer.copy(); //copy the background (and only) layer of the image
        img.close(SaveOptions.DONOTSAVECHANGES); //close the document without saving changes
        app.activeDocument = mainDoc; //focus back on the badge template
        var pLayer = mainDoc.paste(); //paste the layer I just copied into the template
        pLayer.translate (-314, 33); //place the new layer where I need it to be
        mainDoc.layers.getByName("Name").textItem.contents = nume; //change the name on the badge to the name of the original file
        mainDoc.saveAs (saveFile, so, true, Extension.LOWERCASE); //this is ehere I have issues...
        }
        app.preferences.rulerUnits = startRulerUnits; //change back to centimeters
        app.preferences.typeUnits = startTypeUnits;
    

    I guess that it may be a problem with the agument saveFile, I can save the jpg manually from photoshop.

    PS: using CS6

    Thank you!

    I think you're line 17 it is. I'm not sure what you're doing with: String.valueOf (i + 1). You're simply trying to name as these files through a number? If this is the case, simply put: i + 1. You also use the incorrect syntax for your way. You do not have the jpg extension. The line should read:

    var saveFile = new File("/c/Users/Eugen/Desktop/salvate/" + (i+1) + ".jpg");
    
  • How to get some of the styles applied using script?

    Hi all

    I need to know how to get some styles applied using scripts ID. I don't have a lot of experience in InDesign so need help.

    Here is a screenshot with sample text with styles of such applied and highlighted.

    screenshot.png

    I need to know what the texts in my document have these styles applied as all caps, Baker pointed out, Subscript and Superscript, etc..

    Help, please.

    Thank you!

    Get in shape and make the selection, then run the script

    Examine the file for the properties you want.

    Pretty easy

  • Solo Composition layer using scripts

    Hi all

    I'm looking for a way to scroll the layers by using scripts.

    The ultimate goal is to create a customizable slideshow very quickly.
    In this project, I have several boxes, in which I show a Composition. Each publication contains only a stack of layers (easily editable with drag and drop) with a different photo on each layer.
    Using a Slider control, I want to scroll through the photos of a composition. For example: when I select a value of 4 with the cursor, the fourth layer is made visible. In this way, I could keyframe the cursor to select a photo.

    Any thoughts on how to accomplice this? I can't find a good site on the scripts of events of the time. Most of them contain only motion scripting.

    Thanks in advance!

    I think you'd want an expression here, not a script. I would use an expression to opacity (on each of the photo layers) with an expression as follows:

    s = / / link this variable to your cursor.

    (Math.round (s) is index)? 100: 0;

    Dan

  • ConvertToButton using script

    Hi Expert

    I want to convert TextFrame or a button Image using script, but in the object model, I have not found any method to convet he gets.

    Object-> Interactive-> convertToButton

    http://forums.Adobe.com/message/3788171

    Also, I have found no convertToObject() in the method of the object.

    b = app.selection[0];

    b.convertToObject ();

    How to convert TextFrame Button using script?

    Thank you.


    Hi Bill

    Have you tried that?

    #target indesign
     var myDocument = app.documents.add();
     var myDocument = app.documents.item(0);
     var myPage = myDocument.pages.item(0);
     var myTextFrame = myPage.textFrames.add();
     myTextFrame.geometricBounds = [72, 72, 288, 288];
     myTextFrame.contents = "This is some example text."
     //var myTextFrame = app.activeDocument.textFrames[0];
    var myButton = convertToButton(myTextFrame);
    
    function convertToButton(obj)
    {
         app.selection = [obj];
         var maCreateButton = app.menuActions.item('$ID/$$$/Dialog/CmdName/CreateButton'),
              ret;
         if( !maCreateButton.isValid ) return false;
         maCreateButton.invoke();
         ret = app.selection[0];
         return ret;
    }
    

    Suresh

  • How to capture audio only then separate each channel to use.

    Hi all, I spent time trying to find the answer before posting - but without success. Here's my work:

    My project is 1.5 hours long.  Inside the project, I have a clip of audio / 2 minute video that has music, I need. I want to export only the audio. After I do that, I want to take the second channel and use it for another project.

    I found the 'export' function and created an Aif file, but - instead of just the clip that I selected, it gave me audio of the entire timeline (huge).

    I tried also to the clip, simply select copy, then tried to 'stick' on my backup window, but it wouldn't let me.  I have to go to the source media to extract this clip again? is not supposed.

    advice on how to proceed? Thank you all!

    NAVE

    Alrighty nefl777, here's another way to do almost the same thing. This method is more faster/easier, if you do not need to use the clip exported in another project.

    http://screenr.com/qfI

  • Use scripts to create digital orders without button increase/decrease

    I'll have fun using scripts to do things that were once "impossible", like the creation of a cluster programmatically in a list of variable names and their types associated with (use in a later program).

    When I create a digital control on a front, she has the visible increment/decrement key, by default.  I wanted to create controls without this feature, but I could not understand how (or even if it is possible, but I don't see why not).

    Any ideas?

    BS

    Just above the digital named menu item is the one you are looking for: digital

    Use the digital constant digital control for Style and class.

  • Use scripts to change the name of the tab

    Hi all

    I'm trying to use scripts to add tabs to a tab control in an existing VI.  I am able to add new tabs easily enough, but I can't understand how to change the name of each tab when they are added.  Each name is extracted a TDMS file using a loop for.

    I looked through the existing discussion forums, and there are a few old messages that indicate I should look for the 'independent Label property', and that I should put it to allow me to change the caption of the tab.  There is always an explanation of this property in the help files, but I am unable to find my path to it in the current schema.

    Assuming that this property still exists in my version (2012), could someone tell me the correct sequence of references and property nodes to access this property?  Right now I use the class "TabControl".  If this property is obsolete, can someone let me know if there is a new method to achieve this?  Thank you.

    GSinMN

    After you have added the page, download the Pages property of the index of the newly added page, tab control, use the PageLabel of this page for the label.  It would be cool if the Add Page method returns the reference to the new page.

  • Add the occurrence to a structure of the event by using scripts

    Hello

    IAM trying to (using scripts) updating a structure of the event (the case of the event add) on a vi is not on memory.

    I get error 1054 the specified object was not found.

    Here's a picture of him.

    any help in this will greatly be apreaciated.

    The error comes from the open air, because looking for structure in the wrong place. While it is perfectly logical that the owner would be the loop in practice yet script is not that friendly - you need to get the reference of the schema of the loop and use it as an owner.

  • whenever I'm on facebook, play games, I get a message that if I continue to use scripts, can lock up my computer

    whenever I'm on facebook, play games, I get a message that if I continue to use scripts, can lock up my computer.

    I don't understand what that means.

    What can I do to fix this?

    I have windows xp

    I guess that your topic is not correct, since it is the problem with the site NOT updated.

    The problem of script depend on the site Web that when you play a game, there are several scripts written in the game that cause your browser becomes slow. Try to delete your browser history and also update your Windows.

    It is advisable to report this problem to the game devloper, since this question primarily related to the design of the game, they could solve it.

  • Dump to IMPORT ORACLE 9i to ORACLE 11 G database by using script

    Hi all

    I'm trying to import a dump of an Oracle 9i database from exp in the Oracle 11 g database using script.


    (1) the export using 9i client script:

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    #! / bin/sh

    testsync_home= / home/oraexp / / DMPtestsync

    log_home =/ home/oraexp/testsync/log

    file userid=test/test@testsource exp = $testsync_home/usr 'date' + %m %d %Y ".dmp tables =userdata2015 ACCORDING = y compress = buffer n = 655350 log = $log_home/exp_test_usr.log

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


    2) the import using 9i client script. Import the dump into Oracle database 11g. The imp can't exit normally, although the data has already been imported into the testdb.

    If the next part of the script can't be executed.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    #! / bin/sh

    "sync_date ='date + %m %d %Y"

    testsync_home = / home/oraexp/testsync/dmp

    log_home = / home/oraexp/testsync/log

    sqlplus test/test@testdb < < EOF

    truncate table userdata2015;

    commit;

    quit smoking

    EXPRESSIONS OF FOLKLORE

    file userid=test/test@testdb IMP = $testsync_home/usr 'date' + %m %d %Y ".dmp fromuser = touser = test test tables = userdata2015

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Can you please give me some advice on this situation?


    Thank you very much in advance.

    DO NOT USE THE DATAPUMP.

    You do not use expdp and impdp.

    You will use the 9i client exp and imp 11g client.

  • How to disable/enable inputtextfileld on select of another radiobutton using adf12.1.3

    Hello

    How to disable/enable inputtextfileld on select of another radiobutton using adf12.1.3

    Can anyone provide a few points on that.

    I did it like below on my listner valuechange radiobutoon method but does not work

    {} public void onRadiobuttonVCE (ValueChangeEvent valueChangeEvent)

    Add the code in the event here...

    log.info ("GCONF1001Bean onRadiobuttonVCE() started:::"+valueChangeEvent.getNewValue()); ")

    concentratorMode = valueChangeEvent.getNewValue (m:System.NET.SocketAddress.ToString ());

    concentratorMode is the value of the selected radiobutton

    RichInputText r = findComponentInRoot ("it2") (RichInputText);

    log.info ("value of r GCONF1001Bean onRadiobuttonVCE:" + r);

    {if (concentratorMode.Equals("1"))}

    log.info ("GCONF1001Bean onRadiobuttonVCE() inside the 1st if :::"); ")

    r.setDisabled (false);

    log.info ("GCONF1001Bean onRadiobuttonVCE() after 1st if :::"); ")

    }

    {if (concentratorMode.Equals("2"))}

    log.info ("GCONF1001Bean onRadiobuttonVCE() inside the 2nd if :::"); ")

    r.setDisabled (true);

    log.info ("' GCONF1001Bean onRadiobuttonVCE (after if 2nd): '");

    }

    {if (concentratorMode.Equals("3"))}

    log.info ("GCONF1001Bean onRadiobuttonVCE() inside the 3rd if :::"); ")

    r.setDisabled (true);

    log.info ("GCONF1001Bean onRadiobuttonVCE() after the 3rd if :::"); ")

    }

    }

    --

    JS

    You can set a variable bean said "textBeanDisabled" and set the value of this 'Y' or 'n', based on your health status.

    Then set the disabled property

    Just copy - paste your logic to the above post:

    String textBeanDisabled = "N";

    {} public void onRadiobuttonVCE (ValueChangeEvent valueChangeEvent)

    Add the code in the event here...

    log.info ("GCONF1001Bean onRadiobuttonVCE() started:::"+valueChangeEvent.getNewValue()); ")

    concentratorMode = valueChangeEvent.getNewValue (m:System.NET.SocketAddress.ToString ());

    concentratorMode is the value of the selected radiobutton

    RichInputText r = findComponentInRoot ("it2") (RichInputText);

    log.info ("value of r GCONF1001Bean onRadiobuttonVCE:" + r);

    {if (concentratorMode.Equals("1"))}

    log.info ("GCONF1001Bean onRadiobuttonVCE() inside the 1st if :::"); ")

    r.setDisabled (false);

    textBeanDisabled = "N";

    log.info ("GCONF1001Bean onRadiobuttonVCE() after 1st if :::"); ")

    }

    {if (concentratorMode.Equals("2"))}

    log.info ("GCONF1001Bean onRadiobuttonVCE() inside the 2nd if :::"); ")

    r.setDisabled (true);

    textBeanDisabled = 'Y ';

    log.info ("' GCONF1001Bean onRadiobuttonVCE (after if 2nd): '");

    }

    {if (concentratorMode.Equals("3"))}

    log.info ("GCONF1001Bean onRadiobuttonVCE() inside the 3rd if :::"); ")

    r.setDisabled (true);

    textBeanDisabled = 'Y ';

    log.info ("GCONF1001Bean onRadiobuttonVCE() after the 3rd if :::"); ")

    }

    }

    See you soon

    AJ

Maybe you are looking for

  • How to set up iphone on wyfi 4S no sim

    How to set up 4 s iphone with wyfi without a sim card. It has been implemented until I connected to Itunes now I can't pass it want a sim!

  • Why my Vista laptop keep locking itself?

    Seriously! I'll take a wild guess and say that it crashes itself at least 4 times during the time it takes to write this message. Once already! That's just it. For most people, screesnsaver lock is equal to one (twice, BTW) timed action. Well, I do n

  • Win 7 BSOD, high with ndis.sys latency

    My laptop has experienced slow load time, audio popping/cracking. I also got BSOD when trying to restart/shutdown. It of like it since Oct/Nov ' 14 and did not get better. I uninstalled it, rebooted and will fix temporarily the problem, he'll be back

  • Access to blackBerry Smartphones cards saying no BIS or BES...

    So no maps on the device. Can not see something logical that helps. connect to internet and pushing emails like a train. But like cards! The ideas people?

  • ISE 1.4 and access for guests with distinct SMS providers

    Could someone please help with the installation of the guest access. I am trying to perform an establishing a unique SSID prompted with two central WISN and a pair of ISE 1.4 to manage a building containing different companies.  Installation work goo