Need script that delete objects of certain color...

Hello. For my Hobby I would need an Illustrator script that can delete objects of a certain color on selected layer. The color can be set in a dialog like #000000 or anything alike.
I will need it to delete letters in text that has a certain color (different than letters around it). Letters to delete can be inside sentances or free. It doesn't matter if the text need to be outlined and ungrouped before run script, or not.
I would apprechiate any help. Thank you.

// CharacterColorizedIfNotMatchPrompt.jsx
// Hint: test the script with little text.
// The more extensive the text, the more time it takes the script.
// greetings pixxxel schubser
// http://forums.adobe.com/thread/1190610?tstart=0
var aDoc  = app.activeDocument;
var col = new CMYKColor();
col.cyan = 0;
col.magenta = 20;
col.yellow = 0;
col.black = 0;
var aTFrame = aDoc.textFrames;
if (aTFrame.length > 0) {
    var check = prompt ("Which character?", "a");
    check1 = check;
    check2 = check1.toUpperCase();
    for (i=0; i<aTFrame.length; i++) {
        for (j=0; j<aTFrame[i].characters.length; j++) {
            aChar = aTFrame[i].characters[j];
            if (aChar.contents != check1 && aChar.contents != check2) {
                aChar.fillColor = col;
alert("done")
Try this.
Have fun.

Similar Messages

  • Script for deleting objects on pasteboard

    Anyone have a script that deletes all objects and text outside the page (or margins)?

    Unfortunately in my Indi CS6 any pasteboard and spread item is "instance of spread".
    So i consider geometrical bounds:
    myDocument = app.activeDocument
    cur_Ruler = myDocument.viewPreferences.rulerOrigin;
    with(myDocument.viewPreferences){
        rulerOrigin = RulerOrigin.spreadOrigin;}
    myDocument.zeroPoint = [0,0];
    aWidth = myDocument.documentPreferences.pageWidth*2+10;
    var objs = app.documents[0].pageItems.everyItem().getElements();
    while(obj=objs.pop()){
    a_left = obj.geometricBounds[1];
    a_right = obj.geometricBounds[3];
         if(a_right <0 || a_left > aWidth){obj.remove()}
    with(myDocument.viewPreferences){
        rulerOrigin = cur_Ruler} //back to the RulerOrigin

  • Script that deletes all the data in the DB

    Somebody has or know a script that delete all the data (but not the tables) of the database???? I have dummy data and know I need the tables clean of data.
    How can I delete it???????? Thank you for you help
    Javier

    You could truncate all the tables with the following commandTRUNCATE TABLE <table_name>;This will delete all the data in the table while keeping the table structure, contraints, indexes, triggers, etc. intact so they wont have to be rebuilt. All foreign keys must be disabled to use the TRUNCATE command.

  • Need script to delete two MS pref files

    As one who can't script my way out of a paper bag, I come here suitably humbled to request help with a script. 
    Every so often, some of my incoming emails in MS Entourage become unreadable due to garbled fonts.  The solution is two quit MS Entourage and delete two Microsoft preferences files.  I'm looking for a script that would automatically send these two files to the Trash:
    • MS Office font cache
    /Users/ramoncastaneda/Library/Preferences/Microsoft/Office Font Cache (11)  ===>>> delete the “Office Font Cache (11)” file.
    • and MS browser font cache
    /Users/ramoncastaneda/Library/Caches/com.microsoft.browserfont.cache ===>>> delete the "com.microsoft.browserfont.cache" file.
    Thanks in advance for any and all guidance.

    I would strongly recommend becoming more familiar with and more comfortable within Terminal and the command line environment, and preferably sooner rather than later; before you need it.
    The cmmand line environment is the native environment of Mac OS X and Mac OS X Server, and it is the core of how the server operates, and the command line is particularly central to troubleshoot Mac OS X and Mac OS X Server if (when) something goes wrong, and it is how you will configure Mac OS X and Mac OS X Server for many of its more advanced operations and features.
    Bash is the name of one of the command interpreters on Mac OS X and Mac OS X Server.  It is the default command interpreter for the command line environment; what's known as the shell or command shell or command line.
    The command line is also where you can write bash shell scripts, such as the two delete commands that I posted.  A shell script is a file containing command line shell commands.  That three-line shell script is a bash script flag (the so-called "shebang") and the two rm remove commands that delete the two files.
    The pico tool mentioned is a text editor, and an editor with a screen-driven command interface.  That particular pico command puts you into the pico text editor for the specified filename, and where you will have command hints for the editor visible at the bottom of the display.  There are more advanced editors than pico, but pico is a good editor to start with.
    Again; I'd recommend becoming a little more comfortable with the command line; that'll pay dividends far beyond deleting a couple of cache files.

  • Script that adds objects every 2ft.

    Hi,
    So I need to make a script that adds an object every 2 feet around the perimeter of the page.
    I really just have no idea how to start. If anyone could point me in the right direction, or show me an example of something similar being done, that would be awesome!
    This is what I have so far:
    if (x2 >= 96 || y2 >= 96) { /* If x or y are longer than 8 Feet (96 inches) */   
        var x = x2/24;
        while (x > 36 && x < 24) { /* Objects need to be added every 2 to 3 feet */
            x /= 24;
        var y = y2/24;
        while (y > 36 && y < 24) { /* Objects need to be added every 2 to 3 feet */
            y /= 24;
    What I've been thinking (and what I have) is to get some fixed amount between 2 to 3 feet. Then I divide the total x or total y by that fixed amount, and that tells me how many objects I'll need to add.
    I feel like I'm heading on the right track, but making the elements seems to be the most challenging part. I have a function that makes the element I need, and the function is formatted like this: addCircle(page, top, left, bottom, right);
    Any help would be greatly appreciated! Thanks.
    EDIT:
    I have come up with a solution! (somewhat)
    So far it only does one side, but this works:
    var x = x2/24;
    while (x > 36 && x < 24) {
        x /= 24;
    x = Math.round(x);
    var stride = (x2/x);
    for (var i = 0; i <= x; i++) {
        if (i == 0) {
            addCircle (myPage, 0.25, stride*i + 0.25, 0.5, stride*i + 0.5);
        } else if (i == x) {
            addCircle (myPage, 0.25, stride*i - 0.25, 0.5, stride*i);
        } else {
            addCircle (myPage, 0.25, stride*i, 0.5, stride*i + 0.25);

    It seems you are on the right track, but I'm a really curious sort of person.
    How BIG are these 'pages' when you are going to have more than a single object on each side, spaced apart by 61cm!?

  • Need info on deleted object

    Hi experts,
    Unfortunately i have deleted one of my important object(report) from Development system.
    Is there any process to retrieve that report and go head with the same.
    Please let me know the appropriate solution if any.
    Thanks in advance.
    Sreenivas

    Hi,
    T.code <b>SPAU</b> ..
    in this T.code, If you choose Goto, you see a list of the deleted objects. Alternatively, you can directly execute the report RS_SMODILOG_FIND_DEL_OBJ. It may take several minutes to find the objects.
    The report RS_SMODILOG_FIND_DEL_OBJ displays the deleted subobjects (LIMU) and the higher-level complete objects with a separate object catalog (R3TR), for which only the modification logs exist. These objects were modified by the customer and deleted during an upgrade or the import of a Support Package.
    Double-clicking a subobject in a line of the list takes you to version management. You can retrieve an old version of the subobject from the version database.
    if you do not have autorization, then contact basis person, they will retrive your old version
    Regards
    Sudheer

  • Need script that replace text...

    hello. I would like a script that prompts to input a body of text, and then replace all text on a layer with the entered text, preserving fonts, sizes, positions.. everything. If inputed text is to many letters, it chops off the exchange. If too little letters, it repeats.
    Would be greatful for help.

    Ahh, I should have warned that the script didn't have any kind of error checking...
    As you've found, if there isn't a second text item on any like, the script will choke.
    It's relatively easy to work around - just wrap that part of the script in a 'try' block.
    This revised version shows that, and takes care of creating the new files in a different directory on the desktop:
    <pre class=command>on open theFiles
    repeat with eachFile in theFiles -- loop through the files
    set eachFile to eachFile as alias -- coerce each item to an alias
    tell application "Finder"
    if exists folder "NEW files" of desktop then -- does the folder already exist?
    set theFolder to folder "NEW files" of desktop as alias -- if so, use it
    else
    set theFolder to (make new folder at (path to desktop) with properties {name:"NEW files"}) as alias -- otherwise, make a new folder
    end if
    end tell
    set filename to name of (info for eachFile) -- get the file name
    set fileContents to paragraphs of (read eachFile) -- read the file
    set outputFile to open for access file ((theFolder as text) & "NEW " & filename) with write permission -- create the output
    repeat with eachPara in fileContents -- loop through the paragraphs
    set {oldDelims, AppleScript's text item delimiters} to {AppleScript's text item delimiters, tab} -- manage TIDs
    try
    if second text item of eachPara is "V" or second text item of eachPara is "VA1A2" then -- do we have a "V" or "VA1A2"?
    set eachPara to {text item 1 of eachPara, "VA1A2A3A4"} & text items 3 through -1 of eachPara as text -- work out the new strin
    end if
    end try
    set AppleScript's text item delimiters to oldDelims -- reset the TIDs
    write eachPara & return to outputFile as text -- write out the new data
    end repeat
    close access outputFile -- close the file
    end repeat
    end open
    on run
    set theFile to choose file -- get a file
    open {theFile} -- process it
    end run</pre>

  • Trouble with a script that deletes event in iCal

    Used this script over the summer and it worked fine. Can't figure out the issue now, but it isn't working. Here is a few lines of the output I get and then the error I get is at the bottom. I'll post the full script at the bottom of this posting. Error # -1728??? File doesn;t exist?
    Thanks,
    dan
    get summary of item 2 of every event of calendar "Untitled"
    --> "Enviro C Lab Period 3-4"
    get summary of item 2 of every event of calendar "Untitled"
    --> "Enviro C Lab Period 3-4"
    get description of item 2 of every event of calendar "Untitled"
    --> missing value
    get status of item 2 of every event of calendar "Untitled"
    --> none
    get start date of item 2 of every event of calendar "Untitled"
    --> date "Tuesday, April 26, 2011 10:30:00 AM"
    get summary of item 2 of every event of calendar "Untitled"
    --> "Enviro C Lab Period 3-4"
    get end date of item 2 of every event of calendar "Untitled"
    --> date "Tuesday, April 26, 2011 11:55:00 AM"
    get allday event of item 2 of every event of calendar "Untitled"
    --> false
    make new event at end of every event of calendar "Untitled" with properties {status:none, start date:date "Tuesday, April 26, 2011 10:30:00 AM", summary:"Enviro C Lab Period 3-4", end date:date "Tuesday, April 26, 2011 12:25:00 PM", allday event:false}
    --> event id "AF27EFB6-3949-4977-A153-1EFE31FD8206" of calendar id "0EDA6DFD-52AD-4E7F-BC81-984CFF7D3F39"
    delete item 2 of every event of calendar "Untitled"
    --> error number -1728 from item 2 of every event of calendar "Untitled"
    Result:
    error "iCal got an error: Can’t get item 2 of every event of calendar \"Untitled\"." number -1728 from item 2 of every event of calendar "Untitled"
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into a HTML editor">
    tell application "iCal"
    repeat with theEvent in (events of calendar "Untitled")
    set control to {}
    set control to summary of theEvent
    set AppleScript's text item delimiters to space
    set theSummary to summary of theEvent
    set textSummary to text items of theSummary
    if the third item of textSummary is "Lab" then
    if the fifth item of textSummary is "5-6" then
    get theEvent
    set theDescription to description of theEvent
    set theStatus to status of theEvent
    set theStartDate to (start date of theEvent) - 0.5 * hours
    set theSummary to summary of theEvent
    set theEndDate to end date of theEvent
    set theAllDay to allday event of theEvent
    set newEvent to (make new event at end of events of calendar "Untitled" with properties {status:theStatus, start date:theStartDate, summary:theSummary, end date:theEndDate, allday event:theAllDay})
    set oldEvent to ""
    set theEvent to oldEvent
    get theEvent
    delete theEvent
    end if
    if the fifth item of textSummary is "3-4" then
    get theEvent
    set theDescription to description of theEvent
    set theStatus to status of theEvent
    set theStartDate to start date of theEvent
    set theSummary to summary of theEvent
    set theEndDate to (end date of theEvent) + 0.5 * hours
    set theAllDay to allday event of theEvent
    set newEvent to (make new event at end of events of calendar "Untitled" with properties {status:theStatus, start date:theStartDate, summary:theSummary, end date:theEndDate, allday event:theAllDay})
    delete theEvent
    end if
    end if
    end repeat
    end tell
    </pre>

    Hello
    The posted event log indicates some inconsistent behaviour of iCal in referencing item 2 of every event. I.e., it could access it first and failed to do so after a new event is created. Scent of bug here. Or possibly inserting ugly small delay after event creation might let the script delete the newly created event...
    Anyway, the 'by index' reference form of object must be used very carefully when object can be deleted or added dynamically.
    Also I wish to add that it is not recommended to use an object specifier, that returns list of objects, as the base list for repeat statement, such as :
    --CODE1
    -- # not recommended
    repeat with theEvent of (events of calendar "Untitled")
    -- omitted
    end repeat
    --END OF CODE1
    Instead, you'd better get the list first and use it, such as :
    --CODE2
    -- # recommended
    repeat with theEvent of (get events of calendar "Untitled")
    -- omitted
    end repeat
    --END OF CODE2
    The reason is as follows.
    In CODE1, the iterator is assigned as item k of events of calendar "Untitled", where k iterates from 1 to count of events of calendar "Untitled" at the time of loop entrance. The problem is that this list of events is dynamic list which may change when event is deleted or added, and consequently item k as iterator may no longer refer to the item k of the original collection of events.
    In CODE2, the iterator is assigned as item k of a static list which is obtained by statement 'get events of calendar "Untitled" at the time of loop entrance. If the event object is returned in 'by ID' reference form (or any form other than that depends upon index in the container), item k as iterator is guaranteed to refer to the item k of the original collection of events whether or not collection changes.
    Thus you may try something like this :
    --SCRIPT
    (* not tested *)
    tell application "iCal"
    tell calendar "Untitled"
    repeat with theEvent in (get its events) -- # get the objects list
    set theEvent to theEvent's contents -- # dereference each once
    set AppleScript's text item delimiters to {space}
    set textSummary to text items of summary of theEvent
    set AppleScript's text item delimiters to {""} -- # reset astid
    if item 3 of textSummary is "Lab" then
    if item 5 of textSummary is "5-6" then
    tell theEvent
    set prop to {¬
    start date:(its start date) - 0.5 * hours, ¬
    end date:its end date, ¬
    status:its status, ¬
    summary:its summary, ¬
    allday event:its allday event}
    end tell
    make new event at end of events with properties prop
    delete theEvent
    end if
    if item 5 of textSummary is "3-4" then
    tell theEvent
    set prop to {¬
    start date:its start date, ¬
    end date:(its end date) + 0.5 * hours, ¬
    status:its status, ¬
    summary:its summary, ¬
    allday event:its allday event}
    end tell
    make new event at end of events with properties prop
    delete theEvent
    end if
    end if
    end repeat
    end tell
    end tell
    --END OF SCRIPT
    Hope this may help,
    H

  • Finding objects that use certain colors in the palette

    My document has RGB colors imported from the Word document. I'd like to be able to find the objects that are colored with these imported colors. Is there a way to sort and find objects based on color?

    That's a little tricky. How do you prove a negative, as it were? You can do an object-based find/change, but only for for things you define, so for example you acan find all objects that DO have a certain color fill, but it won't find anything that doesn't match the criteria.
    It might be possible to script a solutuion that would step through all objects and compare them to a list of criteria, then list the ones that don't match.

  • Is it possible to write a script that samples an anchor points underlying color and applies it?

    I was wondering if anyone with scripting knowledge for Illustrator can think of a script that would sample the underlying color of anchor points in a selected gradient mesh and apply it to them? I was just thinking of ways to speed up the process of creating a vector drawing based on a picture so that all you would have to do is model your mesh and then let the script apply the colors.
    Thanks

    no can do, there's no access to mesh point with scripting, sorry about that.
    have you tried Mesh Tormentor? it is free!!!, but I don't know if it will help with your problem
    http://www.meshtormentor.com/

  • How can i search for a color that is not in the color palette? (CS 5.5)

    I have a client, that has used a certain color in a series of textfields throughout the document.
    The color consists of all 4 CMYK colors and needs to be just Keycolor. However the color is not in the swatches menu, so marking it there and changing it won't work. I have downloaded a script that might have worked, but it could only find colors that were in the swatches palette. (Find / Change by Color / Overprint" version 1.2).
    Ofcourse, creating a similar color and adding it to the swatches doesn't work.
    Is there anyway that i can search for the color or does it really have to be done manually.
    Best regards

    You can only search for real, actually existing swatches. No sweat: use "Add Unnamed Colors" in the Swatch panel dropdown menu to get a list of all of the manually applied colors.
    Since you want to change all of them to the same color, you don't even have to use Search/Replace. Simply delete the new colors and select the one you need in the "Replace With" dialog that appears.

  • Script to delete files created on a specific date with sepecific name

    Hi,
    Is it possible to help me with a powershell script that delete files under a folder and subfolders that have the following attributes
    1. have the name (default.*) and (index.*)
    2. created on a specific date say 1-9-2014
    3. created between specific time say between 10:00 - 16:00
    Thanks in advance!

    break out the components of the script.
    IE does this match 
    Get-ChildItem -Recurse c:\temp\*.*or Get-ChildItem -Recurse c:\temp\*.* | Where-Object {$_.CreationTime -gt (get-date "01-09-2014 10:00AM") -and $_.
    CreationTime -lt (get-date "01-09-2014 14:00PM")}Get-ChildItem -Recurse c:\temp\*.* | Where-Object {$_.CreationTime -gt (get-date "01-09-2014 10:00AM") -and $_.
    CreationTime -lt (get-date "01-09-2014 14:00PM")} | Where-Object {$_.name -match "default"}Might not be working as it might not be matching.Once you get it matching the remove-item will work.
    Cheers,
    Martin
    Blog:
    http://sustaslog.wordpress.com 
    LinkedIn:
    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

  • How to write script to delete contact?

    For some reason, my exchange services repeatedly creates a contact in my address book. I don't know how to stop it. Instead I think I'll just schedule a script to run every 5 minutes to delete this contact.
    How do I write a script that deletes a contact that matches a certain email address and that the first name and last name fields are empty?
    Thanks!!

    Given a choice between deleting a contact every five minutes — which gains little for the resources and effort involved — or ignoring the contact that's getting added, or figuring out what's adding the contact, I'd look to figure out what is adding the contact. 
    What software is being used to manage contacts?  Is there Exchange Server and maybe Outlook in use?  Or are some other local tools to manage contacts?  Any particular contact?  Maybe this discussion might help?
    That written, there are various AppleScript scripts around that work with the Address Book; here's one, and here's another.  (How this works depends on what tools you're using here; Outlook, or the Apple Address Book / Contacts app, etc.)

  • Rule or script to delete specific attachments in Mail?

    Some people send signature images with every email, wasting disk space and making it difficult to search for emails with useful attachments.
    I would like to have a rule or script that deletes PointlessLogo.gif from incoming mail, while leaving other attachments intact.
    A search of the archives turns up a thread from years ago asking the same thing, apparently it was not possible with OS 10.4 (https://discussions.apple.com/message/4133181#4133181).
    Does this capability exist in Mountain Lion?

    Some people send signature images with every email, wasting disk space and making it difficult to search for emails with useful attachments.
    I would like to have a rule or script that deletes PointlessLogo.gif from incoming mail, while leaving other attachments intact.
    A search of the archives turns up a thread from years ago asking the same thing, apparently it was not possible with OS 10.4 (https://discussions.apple.com/message/4133181#4133181).
    Does this capability exist in Mountain Lion?

  • Script that can choose to play different tracks????

    I'm clueless on how to do this but here is the question...
    How do I write and place a script that will select a certain track when coming from a transition?
    In other words, from the main menu (still menu) if you choose a button it jumps to a transition track. The transition then jumps to the track selected from the menu.
    If the same transition is to be used for every button, is there a script to do this utillizing only one transition track instead of having to have one for every button on the menu?
    Joel

    Most of this is in the manual.
    You have 8 registers/variables to play with, GPRMs, in dvdsp. Dvdsp uses the other 8 for it's coding. You can re-name these 8 GPRMs to what you like eg. Button Value or whatever.
    The DVD player holds values, SPRMs, in memory that can be read (& some wrtten too). SPRM8 holds the current highlighted button value. B1 = 1024, B2 =2048, B3 = 3072 etc.
    Line 1 moves the current value stored in the players memory for SPRM 8 to the register you choose. I chose GPRM 0 but you could choose whatever you want.
    Line 2 divides the value now stored in the register (GPRM 0) by 1024. This will give you easier values for you to play with. 1, 2, 3 etc as oppse to 1024, 2048, 3072 etc.
    Now the following lines just mean Jump to the track if the value stored in the register equals whatever. If this condition is not met then the next line is read. The last line has no 'if' so the script has an out,
    -Jake

Maybe you are looking for