Batch replace a colour with another colour

I have over 100 documents. In these documents, some of the objects use a regular black colour (e.g. C0, M0, Y0, K100). I need to replace it as a rich black (e.g. C75, M68, Y67, K90). The regular black colour is NOT saved as a swatch, so I can't just update the swatch. The objects are made of paths and shapes, some of which are in groups.
I found a script here and have updated it to suit my needs (The original script requires you to select an object, my update automatically selects all objects in the file). It works fine on a simple document that has a few layers. However, on more complex documents that have multiple nested layers, I get the following error:
Error 1302: No such element
Line: 9
->       myItem=docRef.pathItems[i];
Here is my code:
var docRef = app.activeDocument;
docRef.hasSelectedArtwork = true;
var iL=docRef.pageItems.length;
for (i=0;i<iL;i++){
     myItem=docRef.pathItems[i];
          if (myItem.fillColor=="[CMYKColor]" && myItem.selected){ //implement only for CMYK and selected
     var c1=0;
     var m1=0;
     var y1=0;
     var k1=100;
     var c2=Math.round(myItem.fillColor.cyan); // round the number ( 0,0012 => 0 )
     var m2=Math.round(myItem.fillColor.magenta); // round the number ( 6,8898 => 7 )
     var y2=Math.round(myItem.fillColor.yellow);
     var k2=Math.round(myItem.fillColor.black);
     if (c1==c2&&m1==m2&&y1==y2&&k1==k2){ // compare
     myItem.fillColor.cyan=75;
     myItem.fillColor.magenta=68;
     myItem.fillColor.yellow=67;
     myItem.fillColor.black=90;
      redraw();
                    } // if compare
          } // if CMYK
     } // end for
How can I overcome the error.

Hi @big_smile,
It's ok.
But you are right, I was a little bit frustrated. Because of: no feedback is the "worst" feedback.
And like I said before, your question isn't easy to answer. To check the difficult you can start with this little snippet:
var aDoc = app.activeDocument;
//var pI = aDoc.pageItems;
//var pILen=pI.length;
// please select some items before running this script snippet
var pI = aDoc.selection;
var pILen=pI.length;
var item;
for (i=0;i<=pILen-1;i++) {
    item = pI[i];
    $.writeln("item "+i+":  "+item.typename);
    $.writeln("clipped =  "+item.clipped);
    if (item.typename == "PathItem") {
        // if GroupItem --> loop through the groupItems.pathItems
        // if CompoundPathItem --> loop through the CompoundPathItems.pathItems
        $.writeln(item.fillColor)
        $.writeln(item.strokeColor)
        $.writeln(item.filled)
        $.writeln(item.fillColor.color)
        if (item.filled == true && item.fillColor.typename == "CMYKColor" ) {
            alert("item "+i+"  fillColor:  "+item.fillColor.typename);
        if (item.stroked == true && item.strokeColor.typename == "CMYKColor" ) {
            alert("item "+i+"  strokeColor:  "+item.strokeColor.typename);
Please select some items before running this script snippet (otherwise it may takes a long time).
And please, check your JavaScript console in ESTK after running this script.
I know, this can't be a correct answer, but perhaps this is a little bit helpful for the beginning.

Similar Messages

  • How to replace one variable with another in large number of queries

    Hello guys!
    I have this situation: our company needs to use one variable instead of another for certain amount of queries.
    Is there some way to automatically replace one variable with another for a certain characteristic in big number of queries ( like 150 - 200 ) ? Doing this manually would take lots of time)
    Apreciate your help!

    you could try (at your own risk) the following:
    1. search the technical id (ELTUID) of your variable in table RSZELTDIR
    2. see where this variable is used in table RSZELTXREF (by filling RSZELTDIR-ELTUIID in RSZELTXREF-TELTUID)
    3. add similar entries for your new variable
    4. delete the entries for the old variable (they're part of the key, so you can't simply "change" them)

  • Replacement Path Variable with Another Variable

    Hi,
    I am currently trying to create a report that would need me to have the same values for different characteristics (e.g. clearing date, posting date, net due date). I have seen that there is a way in the replacement path variable that would replace its value with another variable that is ready for input. I also looked into SAP help but I can't seem to figure out on how to do it specifically. Does anyone know a step-by-step process on how to do this? How does this work?
    Thank you in advance!

    take an e.g.
    u have characteristic say ch1
    u want to restrict it with replacement path variable
    first of all create a variable var1
    click what it is based upon for e.g. 0calday, 0material etc.
    make it user entry variable
    select single or multiple entry
    make it mandatory
    save it and hit okey
    click on ch1
    right click and say restrict
    in new window create a new variable
    give its name and technical name
    processing path is replacement path
    go to next tab of replacement path
    select several ooptions
    replace variable with another variable
    select a variable called var1
    change the offset length and offset start with different parameters.
    hit okey
    this way u have restricted ch1 with replacement path variable var1
    now when u run report u have to enter value of var1
    which will then further feeded to ch1
    this way u can create replacement path variables at lots of instances and then u can always feed the value from var1 at different time
    make sure as this ur requirement is date
    try to use 0calday as reference infoobject all the times....

  • Since i got the new Iphone 4s it constantly drops calls. Apple have replaced the phone with another new iphone 4s but i am still having the same problem. I have checked with vodapohe that there is no issue from there end, given a new sim, still drops out

    Since i got the new Iphone 4s it constantly drops calls. Apple have replaced the phone with another new iphone 4s but i am still having the same problem. I have checked with vodapohe that there is no issue from there end, given a new sim, still drops out

    Have a look at this it might help
    http://support.apple.com/kb/TS4148

  • How to replace a movieclip with another movieclip

    How to replace a movieclip with another movieclip
    Hi,
    I am having a swf called tchild.swf... in this i got a
    movclip 'child1'. i am loading this tchild.swf into another swf
    tparent.swf within 'mcloader' movie clip.. i got another movclip
    called 'picture1'
    i am loading tchild.swf into mcloader movclip.. and i want to
    load 'child1' moviclip into picture1..
    how to replace a picture1 movieclip with child1 mc..
    PS: i dont want to load picture1 from library.. its on the
    stage.

    AWT or Swing?

  • Replacing multiple spaces with another character

    i need to replace multiple spaces with another char in a string
    my code is
    Dim text as String="a bit much             a little much" Dim arr As String() = text.Split({" "c}, StringSplitOptions.RemoveEmptyEntries)Dim newtext As String = String.Join(" ", arr)            MsgBox(newtext)           
     it returns to "a bit much  a little much "
    But i want to replace only long spaces with "="  as  "a bit much =a little much"
    How can i do that?

    This version uses two spaces to split the string and then trims any additional single spaces. It returns "a bit much = a little much".
    Dim text As String = "a bit much a little much "
    Dim parts() As String = text.Split({" "}, StringSplitOptions.RemoveEmptyEntries)
    Dim newText As String
    If parts.Length = 2 Then
    newText = parts(0).Trim & " = " & parts(1).Trim
    End If

  • Qosmio X500-10W - Can I replace the HDD with another one?

    Hello
    I have a Qosmio X500-10W with two HDD Toshiba MK5055GSX 500GB 5400RPM 8MB ??SATA II but is one of hs so I wonder if I can be replaced by a more powerful style HDD 750GB 7200tr / min 16MB Toshiba course?
    merci

    Hey,
    Your question is a little bit hard to understand but I think you want to replace the HDD with another (faster) model, right?
    Well, thats no problem. HDDs with 7200rpm will work, they are a little bit louder but they are faster so if you need more performance no problem.
    Also 750GB or more is no problem because SATA interface is not capacity limited. Theoretically 1TB or more should also work.
    Anyway, you can buy the 750GB you mentioned it will work. :)

  • Replace a string with another string in a file

    I have to replace a string with another string. Say for example in a html file it got a line like,
    <a href="##"></a>
    now i want to replace this ## with the full derived path like
    "c;\\sample folder\\sample subfolder\\samplefile.html"
    can someone help me to do this?
    pls tell me from the file opening till closing the file.

    I have to replace a string with another string. Say
    for example in a html file it got a line like,
    <a href="##"></a>
    now i want to replace this ## with the full derived
    path like
    "c;\\sample folder\\samplesubfolder\\samplefile.html"
    can someone help me to do this?
    pls tell me from the file opening till closing the
    file.
    public class Buckel {
      final static String CONST = "c:\\sample folder\\samplesubfolder\\samplefile.html";
      public Buckel() {
      public static void main ( String[] argv )  throws Exception {
        int    idx = 0;
        String in  = "<a href=\"##\"></a>",   // We'll imagine this just gets here somehow. If it's on the i/p file then take the '\' out B4 and aft the '##'.
               out = "";
        idx = in.indexOf( "##" );
        if ( idx > 0 ) {
          out = in.substring( 0, idx ) + CONST + in.substring( idx+=2, in.length() );
        System.out.println( out );
    }

  • I can't find the tutorial on replacing a person with another image from a different photo.

    I got an email with a link to a video a long time ago that showed how to remove a person from a group photo and replace this person with an image of them from another photo.  It does not seem to be in the videos on my Phtotshop elements 9 list within the program.  Does anyone have a link to this video so I can save it and rewatch it?  Thanks

      Click on the link below and go to: Easily Create the Perfect Photo
    It’s designed for several people but it should work with just one person in the shot. After viewing the tutorial open both images in Full Edit and go to:
    File >> New >> Photomerge Group Shot
    http://www.adobe.com/products/photoshop-premiere-elements/features.edu.html?promoid=GYSZM

  • Stepping through a query result set, replacing one string with another.

    I want to write a function that replaces the occurance of a string with another different string.  I need it to be a CF fuction that is callable from another CF function.  I want to "hand" this function an SQL statement (a string) like this:   (Please note, don't bother commenting that "there are eaiser ways to write this SQL..., I've made this simple example to get to the point where I need help.  I have to use a "sub_optimal" SQL syntax just to demonstrate the situation)
    Here is the string I want to pass to the function:
    SELECT
      [VERYLONGTABLENAME].FIRST_NAME,
      [VERYLONGTABLENAME].LAST_NAME,
      [VERYLONGTABLENAME].ADDRESSS
    FROM
      LONGTABLENAME [VERYLONGTABLENAME]
    Here is the contents of the ABRV table:
    TBL_NM,  ABRV    <!--- Header row--->
    VERYLONGTABLENAME, VLTN
    SOMEWHATLONGTALBENAME, SLTN
    MYTABLENAME, MTN
    ATABLENAME, ATN
    The function will return the original string, but with the abreviations in place of the long table names, example:
    SELECT
      VLTN.FIRST_NAME,
      VLTN.LAST_NAME,
      VLTN.ADDRESSS
    FROM
      LONGTABLENAME VLTN
    Notice that only the table names surrounded by brackets and that match a value in the ABRV table have been replaced.  The LONGTABLENAME immediately following the FROM is left as is.
    Now, here is my dum amatuer attempt at writing said function:  Please look at the comment lines for where I need help.
          <cffunction name="AbrvTblNms" output="false" access="remote" returntype="string" >
            <cfargument name="txt" type="string" required="true" />
            <cfset var qAbrvs="">  <!--- variable to hold the query results --->
            <cfset var output_str="#txt#">  <!--- I'm creating a local variable so I can manipulate the data handed in by the TXT parameter.  Is this necessary or can I just use the txt parameter? --->
            <cfquery name="qAbrvs" datasource="cfBAA_odbc" result="rsltAbrvs">
                SELECT TBL_NM, ABRV FROM BAA_TBL_ABRV ORDER BY 1
            </cfquery>
         <!--- I'm assuming that at this point the query has run and there are records in the result set --->
        <cfloop index="idx_str" list="#qAbrvs#">      <!--- Is this correct?  I think not. --->
        <cfset output_str = Replace(output_str, "#idx_str#", )  <!--- Is this correct?  I think not. --->
        </cfloop>               <!--- What am I looping on?  What is the index? How do I do the string replacement? --->
            <!--- The chunck below is a parital listing from my Delphi Object Pascal function that does the same thing
                   I need to know how to write this part in CF9
          while not Eof do
            begin
              s := StringReplace(s, '[' +FieldByName('TBL_NM').AsString + ']', FieldByName('ABRV').AsString, [rfReplaceAll]);
              Next;
            end;
            --->
        <cfreturn output_txt>
        </cffunction>
    I'm mainly struggling with syntax here.  I know what I want to happen, I know how to make it happen in another programming language, just not CF9.  Thanks for any help you can provide.

    RedOctober57 wrote:...
    Thanks for any help you can provide.
    One:
    <cfset var output_str="#txt#">  <!--- I'm creating a local
    variable so I can manipulate the data handed in by the TXT parameter.
    Is this necessary or can I just use the txt parameter? --->
    No you do not need to create a local variable that is a copy of the arguments variable as the arguments scope is already local to the function, but you do not properly reference the arguments scope, so you leave yourself open to using a 'txt' variable in another scope.  Thus the better practice would be to reference "arguments.txt" where you need to.
    Two:
    I know what I want to happen, I know how to make it happen in another programming language, just not CF9.
    Then a better start would be to descirbe what you want to happen and give a simple example in the other programming language.  Most of us are muti-lingual and can parse out clear and clean code in just about any syntax.
    Three:
    <cfloop index="idx_str" list="#qAbrvs#">      <!--- Is this correct?  I think not. --->
    I think you want to be looping over your "qAbrvs" record set returned by your earlier query, maybe.
    <cfloop query="qAbrvs">
    Four:
    <cfset output_str = Replace(output_str, "#idx_str#", )  <!--- Is this correct?  I think not. --->
    Continuing on that assumption I would guess you want to replace each instance of the long string with the short string form that record set.
    <cfset output_str = Replace(output_str,qAbrs.TBLNM,qAbrs.ABRV,"ALL")>
    Five:
    </cfloop>               <!--- What am I looping on?  What is the index? How do I do the string replacement? --->
    If this is true, then you are looping over the record set of tablenames and abreviations that you want to replace in the string.

  • How do I replace a color with another color?

    I'm not having any luck finding this.  Is there a simple way to replace a color (like a red shirt) with another color (green shirt)?  Somehow I'm not seeing this anywhere.  I know how to do it in Premiere Pro.

    You can use the Color board ("corrector"). Click on the Eye dropper icon and click and drag over the t-shirt (you'll see some feedback of what's being selected.) You can hold down the shift key and click/drag (slightly) on other spots to add more to the selection (or hold down the option key to subtract from the selection.) You can also use the Color Mask slider to add or subtract from the selection.
    Then click on the right arrow for the Correction and in the Color Adjustment, click and drag the Global control to change the color.

  • I had to replace my i4s with another one from the apple store.shouldn't i be able to go to the cloud to get all my contact info and other stuff that was stored in the cloud from the first phone?

    i had to replace my i4s phone with another one from the apple store. i need to download all my contact info and other stuff from the cloud to my new phone.i see a screen that says  RESTORE I PHONE   and are you sure you want to restore the iphone to its facory settings?  all of your media and other data will be erased. they i tunes will verify restore with apple. After this you will have the option to restore your contacts and other settins.  The question is will it restore my first phones info?  I am hesitant to delete anything  lol.

    No. If you made your backup to iCloud, iTunes will not restore from an iCloud backup. See:
    iOS: Backing Up and Restoring Data to a New Device

  • Universally replace one character with another and then change font

    Hello,
    I have a geologic map file where there are hundreds of labels like Cc, Cz, Cwu, etc... all in the Arial font. I need to change all of the capital C's with a character from the StratagemAge font. That is to say, I need to find all instances of one character in my file and then replace them with another character and then change the font of that selected character.
    I've been trying to figure out how to write an action to do this, but I was wondering if there is a way to do this easily already.
    Any suggestions?
    Jeremy

    > how do you turn off the dialog for the Find/Replace in action palette?
    At the left of each Action step is a square field. Mouse over it and the tooltip will read "Toggle Dialog On/Off".
    > I got an action that I wrote to work, but it takes a button click for each instance in my file that I want to change. Would yours have that same drawback as that?
    Yes, you would have to click each time to run the Action (or, you could assign a function key), but there would be no dialog to dismiss.
    But you can pile several iterations of the same steps in the Action; so that one execution of the Action does ten replacements with one click, for example.
    This would not be a particularly difficult thing to Javascript, but you are correct that scripting has a learning curve. This task is not something I would think often needed. Doing a few hundred replacements in a file, using an Action would not seem overly burdensome to me. But if it is a recurring need for you, it might be worth writing a script.
    JET

  • Replacing UJ-846 with another brand

    Does anyone know if is it possible to replace the UJ-846 (Matshita superdrive) of an intel iMac 17" (1.8Mhz) with a different superdrive model or brand?
    People at the Apple Store say you can only install another Matshita superdrive, but as many people in this forum, I'm really dissapointed with this units... Besides, they're charging me almost $300 for a new superdrive which I'm absolutely sure is going to fail again in a couple of months.
    So I'm not willing to throw my money away with another Matshita drive. By the way, as I already posted in other thread: Panasonic considers the UJ-846 as officially discontinued.
    Is the Pioneer superdrive (shipped in all new iMacs) the same size as the Matshita? Would it work in a 17" intel iMac? Any other suggestion?
    I'd appreciate your help.

    In September I installed a UJ-846S in my then 5 year old Powerbook and it worked in Tiger with zero configuration and no drivers needed. It also works fine in Leopard. The UJ-85J in the iMac I bought in November is less reliable. I wonder about the orientation of the drive(?) 
    So although I didn't change brand I certainly didn't have to do anything to get a completely different spec drive to work. Have a read of the experiences on xlr8yourmac.com's drive database:
    http://forums.xlr8yourmac.com/drivedb/search.drivedb.lasso
    EDIT: There only seems to be one so far but it was a Sony update that worked. However, I can't see any reason why a Pioneer version wouldn't just work fine either.
    mrtotes

  • Replace one view with another with animation

    Hello:
    I'm clearly not following some basic principle here so I'd appreciate some guidance.
    My intentions is to create a (quiz type) app with several screens (I'm assuming each of them will be a view that I will create in the Interface builder). The goal is to let user advance from screen 1 to screen 2 then to screen 3, etc. by answering multiple choice questions (presented as buttons). So when one button is clicked the current screen would slide to the left and the next screen would slide in. This animation is very much similar to the default Navigation-type app behavior, but in my case I do not need the navigation bar on top (since user should not be able to go back). By studying the latter example, I was able to find the following code that slides view controlers one over another:
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    SecondPage *secondViewController = [[SecondPage alloc] initWithNibName:@"SecondPage" bundle:nil];
    [self.navigationController pushViewController:secondViewController animated:YES];
    [secondViewController release];
    but in my project, that doesn't seem to work, as, I'm assuming, I do not have the navigationController member.
    What am I doing wrong here?

    Hi Den -
    Den B. wrote:
    The issue I have now is how to change the initial UITableView to my own view (that I can design in the interface builder)?
    Looks like you've made a lot of progress since your original question, so I'll skip the response I might have written earlier, unless you think it would be helpful to go back there. To your current question, I guess I should first ask "What initial UITableView?". My best guess is that you've found the Navigation-based Xcode template, which includes an instance of UITableViewController as the root view controller. Based on that guess, I take it you now want to replace the table view controller with a vanilla UIViewController so the root view needn't be a table view. Are these assumptions correct?
    If so, here's how to make the replacement:
    1) In RootViewController.h, change the super class from UITableViewController to UIViewController;
    2) In RootViewController.m, remove all the lines from (and including) "#pragma mark Table view methods" upto -(void)dealloc;
    3) Open RootViewController.xib, and select Window->Document from the top menu to make sure the "RootViewController.xib" window is open. This is the window that displays icons, not the editor window which displays the view. Delete the Table View icon (select it, then Edit->Delete). Then drag a UIView object into that window from the Library, then Ctrl-drag from File's Owner to the View icon to connect the 'view' outlet of File's Owner to the View object;
    4) Double-click on the newly added View icon to open the IB editor window and populate that window with the subviews you want, returning to RootViewController.h and .m to add IBOutlet properties and IBAction methods as needed. Once RootViewController.h is saved you can make the required connections to File's Owner in IB.
    Here's an example of how to hide the nav bar and transition to the next view from an action method:
    // RootViewController.m
    #import "RootViewController.h"
    #import "SecondViewController.h"
    @implementation RootViewController
    - (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBarHidden = YES;
    - (IBAction)nextView {
    SecondViewController *vc2 = [[SecondViewController alloc]
    initWithNibName:@"SecondViewController" bundle:nil];
    [self.navigationController pushViewController:vc2 animated:YES];
    [vc2 release];
    PS. It "suks" to go from being a pro on one platform to a complete noob on another
    Many of us at this forum jumped from platforms such as Windows to iOS without any prior Cocoa experience, so you're among friends who understand the transition. In my case, after the first few weeks, I never wanted to see another dev environment again. So hang in there! It will be fun soon.
    - Ray

Maybe you are looking for

  • Can't install Photoshop Elements 12 from the folder on my laptop

    Hi. I downloaded Photoshop Elements 12 into a folder on my laptop. Adobe Installer ran ok, but it didn't link to the folder and now I can't find a way to install PSE12 from the available folders. Is there a folder I can open/unzip to make it install?

  • Creating a watermark in aperture 2.1.1

    Does anyone know how to create a watermark using aperture 2.1.1? I know how to select it when exporting the picture, but I don't know how to create an actual watermark. thanks.

  • Deletion of mass roles from GRC CUP 5.3

    Dear All, I have requirement to delete 1000 roles from GRC CUP 5.3. I can see option to delete the roles individually under "search role" option but I am not able to find option to delete mass roles. Please advice. Regards Trinadh Bokka

  • Download multiple rows as pdf

    Can you download multiple rows at one time as pdf's or do you have to do them each individually?  It would save a ton of time.  Thanks, kristin

  • Tx2-1033ee Changing the OS, Losing the Softs?

    Hello friends. I have a tx2-1035ee preloaded with the worst OS ever, Windows Vista. My personal opinion, if you don't mind. I have noticed the driver support page on the HP website includes drivers for several other Windows based OS's. And my questio