How rename  and sort spot channel by javascript?

The name of a spot color channel is English letters or numbers.such aschannel is  a1 ,b3, ce, hh, ....or  vc, bg, kk, 1, 2, 3.....etc,.The spot color channel name,renamed in 1, 2, 3...
exmple:
1.
spot channel name  a1 change to 1
spot channel name   b3 change to 2
spot channel name   ce change to 3
spot channel name   hh change to 4
2.
spot channel name   vc   change to  1
spot channel name   bg  change to   2
spot channel name   kk  change to   3
spot channel name   1   change to   4
spot channel name   2   change to   5
spot channel name   3   change to   6

i try to change by Getting Channel Information
thx Michael L Hale
change to:
function getProperty( psClass, psKey, index ){// integer:Class, integer:key
    var ref = new ActionReference();
    if( psKey != undefined ) ref.putProperty( charIDToTypeID( "Prpr" ), psKey );
    if(index != undefined ){
        ref.putIndex( psClass, index );
    }else{
        ref.putEnumerated( psClass , charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
    try{
        var desc = executeActionGet(ref);
    }catch(e){ return; }// return on error
    if(desc.count == 0) return;// return undefined if property doesn't exists
    var dataType = desc.getType(psKey);
    switch(dataType){// not all types supported - returns undefined if not supported
        case DescValueType.INTEGERTYPE:
            return desc.getInteger(psKey);
            break;
        case DescValueType.ALIASTYPE:
            return desc.getPath(psKey);
            break;
        case DescValueType.BOOLEANTYPE:
            return desc.getBoolean(psKey);
            break;
        case DescValueType.BOOLEANTYPE:
            return desc.getBoolean(psKey);
            break;
        case DescValueType.UNITDOUBLE:
            return desc.getUnitDoubleValue(psKey);
            break;
        case DescValueType.STRINGTYPE:
            return desc.getString(psKey);
            break;
        case  DescValueType.OBJECTTYPE:
            return desc.getObjectValue(psKey);
            break;
        case  DescValueType.LISTTYPE:
            return desc.getList(psKey);
            break;
        case  DescValueType.ENUMERATEDTYPE:
            return desc.getEnumerationValue(psKey);
            break;
var channelCount = app.activeDocument.channels.length;
var channelNames = [];
for(var channelIndex=1;channelIndex<=channelCount;channelIndex++){  
    var channelNames =getProperty(charIDToTypeID("Chnl"),charIDToTypeID("ChnN"),channelIndex);
// =======================================================
if(channelIndex==1){
else if(channelIndex==2){
else if(channelIndex==3){
else if(channelIndex==4){
else if(channelIndex>=5){
var idslct = charIDToTypeID( "slct" );
    var desc329 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref246 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        ref246.putName( idChnl, ""+channelNames);
    desc329.putReference( idnull, ref246 );
executeAction( idslct, desc329, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
    var desc330 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref247 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref247.putEnumerated( idChnl, idOrdn, idTrgt );
    desc330.putReference( idnull, ref247 );
    var idT = charIDToTypeID( "T   " );
        var desc331 = new ActionDescriptor();
        var idNm = charIDToTypeID( "Nm  " );
        desc331.putString( idNm, """"""+channelIndex-4 );
    var idSCch = charIDToTypeID( "SCch" );
    desc330.putObject( idT, idSCch, desc331 );
executeAction( idsetd, desc330, DialogModes.NO );
if spot channel name is number such as spot channel sequence: 2,1,3,6,8,9...can't success!...other success!

Similar Messages

  • I spent ages renaming and sorting my holiday photos in correct order but when uploaded to print they reverted to the original name and order? How can I stop this happening?

    I spent ages renaming and sorting my holiday photos in correct order but when uploaded to print they reverted to the original name and order? How can I stop this happening?

    When you "rename" a photo in iPhoto you're adding a Title to the shot, not renaming the file. This si quite standard metadata in photography, but it appars that it's getting lost in the upload/at Snapfish process.
    You can use the Titles as filenames if you export using the File -> Export command. It's one of the options in the export dialogue. You can upload the exported items.
    Regards
    TD

  • Rename and sort pics in photos

    Is there a way to (batch-)rename and sort pics by name within an album in photos (Mac)?

    Not at this time.
    http://www.apple.com/feedback/macosx.html
    Use the feedback link to tell Apple you want the feature.

  • How to get spot channels colors data and get spot channels length

    File is cmyk format..spot channel color is cmyk .such as an spot channel color is c100m50y20k5
    how get spot channels color data use javascript? c=? m=? y=? k=?
    howv to get spot channel length n(don't cmyk channel) use javascript?  such as file cmyk + 7 spot channel    n=7
    pls help me

    You may want to post over at:
    Photoshop Scripting
    And you may want to elaborate on what this is supposed to mean:
    File is cmyk format..spot channel color is cmyk .such as an spot channel color is c100m50y20k5
    Maybe posting screenshots with the relevant Panels visible might help illustrate the issue.

  • Automation plugin: how to select a spot channel when 2 channels have the same name?

    I have a CMYK document opened in photoshop. In "CHANNELS" panel, I just added 2 spot colors with the same name "Sport Color 1".
    As I click any of the spot channel to select it, the "Listener" plugin will output some c++ code like below:
    SPErr PlayeventSelect(/*your parameters go here*/void)
         PIActionDescriptor result = NULL;
         DescriptorTypeID runtimeKeyID;
         DescriptorTypeID runtimeTypeID;
         DescriptorTypeID runtimeObjID;
         DescriptorTypeID runtimeEnumID;
         DescriptorTypeID runtimeClassID;
         DescriptorTypeID runtimePropID;
         DescriptorTypeID runtimeUnitID;
         SPErr error = kSPNoError;
         // Move this to the top of the routine!
         PIActionDescriptor desc0000000000003980 = NULL;
         error = sPSActionDescriptor->Make(&desc0000000000003980);
         if (error) goto returnError;
              // Move this to the top of the routine!
              PIActionReference ref0000000000001A48 = NULL;
              error = sPSActionReference->Make(&ref0000000000001A48);
              if (error) goto returnError;
              error = sPSActionReference->PutName(ref0000000000001A48, classChannel, "Spot Color 1");
              if (error) goto returnError;
         error = sPSActionDescriptor->PutReference(desc0000000000003980, keyNull, ref0000000000001A48);
         if (error) goto returnError;
         error = sPSActionControl->Play(&result, eventSelect, desc0000000000003980, plugInDialogSilent);
         if (error) goto returnError;
    returnError:
         if (result != NULL) sPSActionDescriptor->Free(result);
         if (desc0000000000003980 != NULL) sPSActionDescriptor->Free(desc0000000000003980);
         if (ref0000000000001A48 != NULL) sPSActionReference->Free(ref0000000000001A48);
         return error;
    You can see "PutName" add the channel name "Spot Color 1" to reference, and I think it will not work correctly if I add such code to my project since PS cannot differentiate the 2 channels only by name. Can anyone tell me if there's any other method for selecting spot channel? Thanks in advance.

    Hi
    Here is the something from docs tht you may find usefull.
    Tryusing index instead of name:
    SPAPI OSErr(*
    PutIndex )(PIActionReference ref, DescriptorClassIDdesiredClass, uint32 value)
    Puts an index into a reference (formIndex) along with the desired class for the reference.
    Unfortunately I dont have C++ here to try i just used definition from docs.
    Hope that this help.
    Regards,
    Momir Zecevic
    Ars Media
    www.arsmedia.tv

  • How could I set spot channel on a format multichannel plugin ?

    I try to write a format multichannel plugin. How can I access the channels properties?

    Hi Mr. Hwang,
    These timeouts are more specific to corresponding JDBC Drivers. So for this information, please contact your DB vendor to provide the correct timeouts which will act similar to that of the driver timeouts of Oracle or DB2 database. Or you can do a google search for the same. I have googled it and find this link. Hope this will help you. Please check once.
    http://www.inetsoftware.de/documentation/jdbc-driver/ms-sql/manual.html#Properties
    Regards,
    Achari

  • Automatically Renaming and Sorting Files

    When I first installed iTunes, I remember it asking me something about automatically sorting and finding file information for the existing music on my computer (Windows Based). I didn't want to do that at the time, but I would like to if that is indeed what it does. Do you know what I'm talking about? Help please!
    Thanks,
    Chris

    The feature won't find info about the files, but it will reorganize them on the hard drive.
    It's an irreversible procedure, and can be found in edit\prefs\advanced\keep iTunes music folder organized.

  • How do I import photoshop channels as layers in Illustrator CS4?

    I recently upgraded from CS2 to CS4, and now I cannot view individual channels as layers in my Illustrator layers menu. I want to be able to select one of a number of channels created in photoshop, and change the color without having to do so in Photoshop and re-import into Illustrator. Right now the imported, and embedded, photoshop image displays the original layer and a "Spot Channel" layer, but the spot channel layer cannot be broken down into each seperate spot channel that I had created in Photoshop. Is this a setting I need to change in Photoshop or Illustrator?

    Save each channel out of Photoshop as a greyscale tiff. Embed each into Illy in the usual way, then colour them as you wish. Set their transparency to multiply and you can put one on top of the other to get a composite using true or false colours.
    A word of warning: Some rips may have difficulty if you use this method. At any rate if you DO use it you should definitely flatten transparency before making your pdf.

  • How does DIADEM import TDMS files? How gets every channel his number and groupindex? How can I determine which channel has which groupindex and number?

    I store different channels in a TDMS file.
    I like to have a time channel at the first position with group index 1 and number 1.
    When I read the TDMS file with DIADEM the time channel (Float64) is on a differernt position, and the channels are not sorted alphabetically.
    Here are my questions:
    How does DIADEM import TDMS files?
    How gets every channel his number and groupindex?
    How can I determine which channel has which groupindex and number?
    Best regards
    Joerg

    Hi Jörg,
    i suppose that you´re programme whose create the *.tdms file is writing on false position. Try to create datas with timechannel on first indes in diadem, then save it and then open it again. you see that all is correct. So please tell me what programm in what version do you use and please attache it here.
    Did you use the library for creating *.tdms files like in the link ?
    http://zone.ni.com/devzone/cda/tut/p/id/6471
    Here you find the gtdms_8.x.zip - when you extract it and opened the *.llb you find vi´s for all functions e.g. writing 2d array of strings to *.tdms file
    when you open the subvi´s then you see how created and writing datas/structure to *.tdms files. Because *.tdms is binary you can´t see structure with open it in editor.
    When you don´t have Labview you can use the 30 days test of current version 8.5 under following link
    german version download link
    https://lumen.ni.com/nicif/d/lveval/content.xhtml
    english version download link
    https://lumen.ni.com/nicif/us/lveval/content.xhtml
    Hope it helps
    Best Regards

  • How can I sort channels by a custom property?

    Hello.
    I have written a script that creates a series of formatted charts in View.  The data comes from TDMS files with several groups of channels with some custom properties assigned to the channels.  I would like to sort the channels within each group by one of these custom properties so that the curves display in the desired order.
    It appears that ChnMove and ChnRenumber can be used to reorder the channels, but how can I programatically sort the channels by a channel property?
    Thanks,
    Craig

    Hello Craig!
    Unfortunately DIAdem doesn't have a adequate command. You have to use some lines of script code. Try this bubblesort adaption:
    Option Explicit
    Call GroupChnSort(1,"name")
    Sub GroupChnSort(ByRef nGroupIndex, ByRef sgPropName)
    Dim i
    Dim j
    Dim n
    Dim anCNo()
    If GroupChnCount(nGroupIndex) > 1 Then
    ReDim anCNo( GroupChnCount(nGroupIndex)-1 )
    For i=1 To GroupChnCount(nGroupIndex)
    anCNo(i-1) = i
    Next
    For i = 0 to UBound(anCNo)
    For j = i+1 to UBound(anCNo)
    If ChnPropValGet("[" & nGroupIndex & "]/[" & anCNo(i) & "]", sgPropName) > _
    ChnPropValGet("[" & nGroupIndex & "]/[" & anCNo(j) & "]", sgPropName) Then
    n = anCNo(i)
    anCNo(i) = anCNo(j)
    anCNo(j) = n
    End If
    Next
    Next
    For i=1 To GroupChnCount(nGroupIndex)
    Call ChnMove( anCNo(i-1), nGroupIndex, i)
    Next
    End If
    End Sub
    The string compare is casessensitive. You can wrap the ChnPropValGet with a UCase to change this.
    Matthias
    Matthias Alleweldt
    Project Engineer / Projektingenieur
    Twigeater?  

  • How to get the value from a JavaScript and send the same to Java file?

    Hi.
    How to get the value from a JavaScript (this JS is called when an action invoked) and send the value from the JS to a Java file?
    Thanks and regards,
    Leslie V

    Yes, I am trying with web application.
    In the below code, a variable 'message' carries the needed info. I would like to send this 'message' variable with the 'request'.
    How to send this 'message' with and to the 'request'?
    Thanks for the help :-)
    The actual JS code is:
    function productdeselection()
    var i=0;
    var j=0;
    var deselectedproduct = new Array(5);
    var message = "Are you sure to delete Product ";
    mvi=document.forms[0].MVI;
    mei=document.forms[0].MEI;
    lpi=document.forms[0].LPI;
    if(null != mvi)
    ++i;
    if(null != mei )
    ++i;
    if(null != lpi)
    ++i;
    if(null != mvi && mvi.checked)
    deselectedproduct[++j]="MVI?";
    if(null != mei && mei.checked)
    deselectedproduct[++j]="GAP?";
    if(null != lpi && lpi.checked)
    deselectedproduct[++j]="LPI?";
    if( 0!=j)
    if(i!=j)
    for (x=0; x<deselectedproduct.length; x++)
    if(null != deselectedproduct[x])
    message =message+ "-" +deselectedproduct[x];
    alert(message);
    else
    //alert(" You cannot remove all products!");
    return false;
    return true;
    }

  • How do i get my podcasts to go from the one i just finished to the next one and how do i sort them from oldest to newest?

    how do i get my podcasts to go from the one i just finished to the next one withouth me having to click on it, and how do i sort them from oldest to newest?

    Not sure if you tried this, but did you hold down both the sleep and home button for 10 seconds? 

  • How can I stop iPhoto from reidentifying faces I have already 'crossed', while still being able to identify and sort new faces.

    iPhoto has detected faces of people I dont know, in my 'iPhoto faces' whenever I click the cross in the corner of the face (when sorting faces) the face temporarily disappears, but once I have uploaded a fresh batch of photos (and want to identify new faces) it automatically re-identifies the old photos that I don't want to have to sort again. How can I stop iPhoto from reidentifying faces I have already 'crossed', while still being able to identify and sort new faces.

    Thank you, that makes sense (I think!) However, I need to be able to tell iPhoto who the people identified in my photos are, does that make sense? How do I identify the people in my new photos without clicking 'find faces'. I know that button searches through my photos to find faces, but it also gets me to the place where I identify the faces as my friends and family, is there a shortcut to get to that place without clicking 'find faces'? That is what I really need, please help!!

  • What's wrong with the IOS5 download, it downloads and then after its finished it says server timed out, how do i sort this out

    What's wrong with the IOS5 download, it downloads and then after its finished it says server timed out, how do i sort this out?

    The Firefox versions which come with many Linux distros have the default Mozilla Firefox updater disabled and use the distros built-in updater.
    See this - http://linuxforums.org.uk/netbooks/install-firefox-6-on-an-acer-aspire-one-running-linpus-lite-linux/

  • Pages:  How can I sort one column of words and not have it affect the other columns?

    How can I sort one column of words and not have it affect the other columns?  I have opened the inspector to the edit columns and rows under Table.  It will sort the column, but then it changes the other colums as well.  I know that if I use Numbers, it will work, but I want to know how to do the same thing in Pages.

    Hi Peter,
    Numbers sorts full rows on values in selected column(s). The technique for sorting a single column is essentially the same as Jerry is describing for Pages tables—separate the (data in the) column to be sorted, sort it, return it to the table.
    In Numbers the actual column may be separated from the original table, sorted, then returned. In Pages, the data must be extracted, sorted, then pasted back in, overwriting the unsorted data (if it was left in the original table).
    iWork tables follow a database model in which each row is a Record, and each column holds a Field within the records.
    As evidenced by the current question (and several similar questions arising in the Numbers community) that model doesn't apply to the way some users, especially some who come in from the MS Excel world, use tables.
    With Excels model—islands of data on a single large table, the ability to sort one or a selected few columns of data makes sense. One 'island' may comprise only cells AA21:AH50. Sorting that small 'table' should be possible without disturbing the rest of rows 21-30, which are probably part of one or more other 'data islands' in the sea that is a MS Excel spreadsheet.
    In Numbers, each of those 'islands' would be a separate Table, and that Table would be sortable without disturbing other Tables in the document.
    Regards,
    Barry

Maybe you are looking for

  • Opening a new window on lead select in a table

    Hi,   I want to open a window on Lead Select ...i have written the below code in the ActionLeadSelect ************************Begin Code****************************************************** message.reportSuccess("came inside LeadSelect"); IWDWindow

  • Video Import Problem

    I have a home movie that i am tring to upload to my iPod and For some reason when I play the movie It has all these green and white boxed that move. I am working on my inlaws PC right now I do Know that the movie works on my mac if i sync it How do i

  • Editing with Dreamweaver

    Is it possible to edit a file created in Dreamweaver so that changes can be tracked? It looks to me that you might have to use Incopy, so I've downloaded a trial version of that. But, if so, I can't figure out how to make DW and Incopy work together.

  • Picture resizing

    I am new to Aperture and have a question about photo resizing. Many of you have heard of content aware resizing, does Aperture have something like that? I have to crop some pics and the object needs to be the same size as the original and not distort

  • I want to add pictures to my itunes library so I can show them on itv?

    I want to add pictures to my itunes library so I can show them on itv?