Applescript to change color of path items with specific swatch from swatch group, multiple times

I am attempting to take a path item that is on its own layer and change its color multiple times, saving it each time.
I was able to do it with javascript however can't get it to work in applescript.
Javascript:
(Items are already selected that I intend to change.)
var iL = app.activeDocument.pathItems.length;
var colorSwatches = app.activeDocument.swatchGroups.getByName('newColors');
var allColors = colorSwatches.getAllSwatches();
var colorNames = Array();
for (var i = 0; i < allColors.length; i++){
    colorNames.push(allColors[i].name);
for (x = 0; x<colorNames.length; x++)
        var currentColor = allColors[x].name;
        for (i=0; i<iL; i++)
            var myItem = app.activeDocument.pathItems[i];
            if(myItem.selected)
                myItem.fillColor = app.activeDocument.swatches.getByName(currentColor).color;
(I then go on to save each one)
When trying to cross over into applescript I have the following so far:
               set iL to count every path item of document 1
               set colorSwatches to swatchgroup "newColors" of current document
               set allColors to get all swatches colorSwatches
               set swatchCount to count every item in allColors
               repeat with i from 1 to swatchCount
                    set currentSwatch to item i of allColors
                    repeat with x from 1 to iL
                        set myItem to path item i of document 1
               here is where I have no idea what I am doing... I can't figure out how to test if an item is selected
                        if myItem's has selected artwork is equal to true then
                            set fill color of myItem to {swatch:currentSwatch}
                        end if
                    end repeat
               end repeat
Or better yet is there a way I can select every path item of a layer and change its color that way?
Something like the following:
          set fill color of every path item of layer "art" of document 1 to {swatch:currentSwatch}
Thanks for any input!

I'm throwing it into a Applescript OBJc project I am working with. I currently have it in a javascript file within the actual project however this is the slowest part of my project and I'm going to attempt to speed it up some.
Let's say I'm changing the color of a path item 35 times... this starts to eat a ton of time up.
My applescript save illustrator file as jpeg is much faster than the javascript one for some reason...
It's also something I have needed to do numerous times in the past and never got around to asking.

Similar Messages

  • The color of text item with multi-line in web

    I tried to change the background color of text item with multi-
    line, but it does not work when I run in the web, if some body
    knows that, please give a hint.
    Thanks
    Frank
    null

    I tried to change the background color of text item with multi-
    line, but it does not work when I run in the web, if some body
    knows that, please give a hint.
    Thanks
    Frank
    null

  • How to change color of a button for specific time interval in jsp

    How to change color of a button for specific time interval in jsp.
    Please help.
    Thanks in advance.

    This was driving me crazy, too--and the previous answers did not seem to work. I eventually found that if I click one of the data symbols in the graph in exactly the right spot (see below), it selects only the data symbols and not the line. I can tell this because the little selection dots will be around each data symbol, but no selection dots will be on the line between the data symbols - like the graphic in Yvan's answer. Then and only then will the color symbol in the tool bar show the color of the data symbol, instead of the color of the line. I believe that you then have to first click on the color swatch in the toolbar and then select your color (or choose Show Colors and select from the color tool). Just clicking a color in the crayon box, for example, did not seem to work unless I first clicked on the color swatch in the toolbar, then clicked Show Colors on that dropdown, and +only then+ clicked the crayon or whatever.
    _The right spot to click_ seems to be just above the exact center of the data symbol, at least for the diamond shape symbol that I prefer. Sometimes it takes several tries to hit the right spot. If I miss it, the whole line is selected, which is indicated by the little selection dots on the line, between the data symbols. When I click the right spot, those selection dots go away, leaving only the data symbols selected. Then I can change the color, as described above.
    I hope this works for you too.

  • Changing Rejected Sales Order Items with BAPI?

    Hi Forum,
    I have the following challenge, would be great if someone of you could help me out. Will help me solve some of my performance problems.
    I have sales orders which are temporary and have 'rejected order items'. Now the requirement is that I have to change the 'rejected order items' (quantity and Delivery dates) based on some XYZ criteria. Now using the BAPI_SALESORDER_CHANGE bapi I have to
    1. first get rid of the 'REJECTION REASON'
    2. Change the order item and then reset the above.
    I tried doing it by populating the order_items internal table with two entries but to my surprise it works once and fails twice!!! I get some errors that are totally irrelated and wierd.
    As for now, I've just adjusted the program(dirtily??) and will be calling the BAPI twice for a change !!!(Huh!)
    Now if anybody knows how to deal with the above problem just drop a few lines, will be of good help to me.
    Thanks and regards,
    ZAM

    Hi Srinivas,
    Thanks for the reply. The rejection reason is set manually, when creating the sales order. I do set the update flag to 'U' and also activating all the X structures. But still it did not work.
    Let me put it very simple. Is it possible to change the rejected order items, through BAPI's? If yes, how?
    Regarding the error messages I will have to change the code again to recreate the messages will let you know as soon as I am finished with some things. But however here are some errors
    Field 'WMENG' cannot be changed, VBEPKOM 000100 0001 ready for input
    Field 'WMENG' cannot be changed, VBEPKOM 000100 0001 ready for input
    Sales document 0030000031 was not changed                           
    there are few others which appear now and then indicating a system error !!
    thanks,
    ZAM

  • Big trouble with using Find/Move/Rename Actions multiple times

    Hi~
    I have a folder with a lot of JPGs in it.
    For simplification, let's say this folder contains exactly 1000 JPGs. The JPGs have been renamed numerically 1 through 1000 while still preserving the original order the JPGs came in straight out of Camera.
    I want to separate the JPGs by putting them into different folders (i.e. "untitled folder 1", "untitled folder 2", "untitled folder 3", etc.). I want to put 20 JPGs in each folder. The first folder will contain original JPGs 1-20, the second folder will contain original JPGs 21-40, the third will have original JPGs 41-60, ...and the last folder (untitled folder 50) will have original JPGs 981-1000.
    I also want to rename all of the JPGs in each folder numerically, 1 through 20. For example, untitled folder 3 will contain original JPGs 41-60, but I want to rename them to 1 through 20. This is very important - the original order must be preserved. As an example, let's look at untitled folder 3 with JPGs 41-60. "41.JPG" must be renamed as "1.JPG", "42.JPG" must be renamed as "2.JPG" ... "60.JPG" must be renamed as "20.JPG".
    I want this to continue until I have 50 separate folders, with each containing 20 JPGs, all of which are sequentially numbered 1 through 20 while still preserving the original order.
    I gave this a try on Automator with no solid results. The sequence of actions I put together were as follows:
    1. Get Specified Finder Items (JPGs 1-20 from the folder containing the 1000 original JPGs)
    2. Move Finder Items (to the new folder: untitled folder 1)
    3. Get Specified Finder Items (original JPGs 1-20 that are now in untitled folder 1)
    4. Rename Finder Items (The settings for rename are as follows: Make Sequential, Add number to = "new name", "item name" is deleted and then I press return, Place number = "before name", Start numbers at = "1", separated by = "nothing", and the rename Example looks like "1.xxx"
    These setups are repeated again for JPGs 21-40, and again for 41-60. Importantly, I modify each action to make sure it gets the correct JPGs from the correct folder.
    I wrote the action to last for the first 60 JPGs (I wanted to test it before writing the rest of it, which would take a long time!)
    The results I got are as follows:
    -Original JPGs 1 through 60 have been removed from the originals folder containing the 1000 Original JPGs. (so far so good)
    -Original JPGs 1-20 from the originals folder have been moved to "untitled folder 1" and renamed 21-40 (not good... I wanted them to stay the same: 1-20)
    -Original JPGs 21-40 were moved to "untitled folder 2" and were correctly renamed 1-20. Then, these were unexpectedly moved a second time to "untitled folder 3" (not good).
    -Original JPGs 41-60 were moved to "untitled folder 3" and were renamed as 21-40.
    Summary:
    The final result was that Untitled folder 1 contained original JPGS 1-20, incorrectly renamed to 21-40. Untitled folder 2 is empty. Untitled folder 3 contains original JPGs 21-60. Original JPGs 21-40 were correctly renamed 1-20, whereas JPGs 41-60 were incorrectly renamed 21-40.
    I feel like I have reached the limit of my knowledge with Automator, so I need your help!
    Thank you very much for at least reading this!
    ~Michael

    First, be careful of the forum you post in - there are Automator forums for both Tiger and Leopard. Your profile shows you running Leopard, but this reply would apply to Tiger as well.
    Most actions return the results from whatever it is that they do - in the case of Move Finder Items, the action returns the items that it moved. In your example workflow, when you follow the move action with the Get Specified Finder Items, you double up the list of items to rename, so there is some extra renaming going on. Most actions have an option to ignore the input from the previous action, but getting rid of the Get Specified Finder Items action from your workflow should clear things up.
    Automator will work for your workflow if there aren't too many items, but if you really have thousands of files you might have better luck with an AppleScript.

  • One email with iPhone pic attachment is received multiple times

    Searched the discussions and couldn't find this one. Problem is this:
    My wife takes a picture with her iPhone and goes back to her camera roll to view it. While viewing the picture, she clicks to email the photo. She sends it out to her recipients (one time!), who are happy to get the picture the first time, but not the 3, 4 or 5 times following!
    Any thoughts on what the issue here is? Recipient email addresses are in both Yahoo and AOL, so it can't be blamed on the recipient email server.
    Why are these leaving the outbox multiple times?
    Also, no "multiple sent" issues with emails that don't have pix attached.
    Thanks! -Steve

    I have this exact same problem. After trying to send an email with a picture attached, the person receives it multiple times and then i will get an error on my device, stating that the email did not deliver, when in fact it did, and keeps on sending it a few more times. Between 2 and 5 times each time i send an email with a picture. This was not happening if a picture was not attached.

  • Change Color Label of File with Javascript

    I need to be able to run a JS script from within Photoshop and when it's complete, change the color of the file in Finder to indicate it has been processed.  I'm talking about the red, orange, yellow, etc. highlights you can give the files in Finder.
    I know how to change these file colors in Applescript.  But I cannot figure out how to initiate the process from JS when run inside Photoshop.
    So I was curious if there was:
    A.  A way to run an Applescript from Javascript
    or
    B.  A way to define the property of a file from JS such that Finder would interpret it into a color highlight?
    Any ideas?
    Thanks

    Here is some code from X that might be of use...
    //myscript.sh MUST exist with execute permissions! 
      var script = new File("~/Desktop/myscript.sh");
      script.length = 0;
      script.lineFeed = "unix";
      script.length = 0;
      script.open("e");
      script.writeln("#!/bin/bash");
      script.writeln("osascript ... whatever");
      script.close();
      script.execute();
    Of course you would need CS3 orr better.

  • Change color of paths

    Is it possible to change the default color that the paths are shown in? I do not mean the actual stroke color but the color of the path tool path itself. I'm working on an image that has similar color to the path and that makes the path very hard to see.

    Change the color of the layer. Double click the layer in the Layer Panel and change the color to a contrasting one.

  • Need automator or applescript to change a setting in Safari with a keypress

    I'm new to applescripting and automator, so bear with me. I found a .css file that stops annoying ads, flash ads, etc in Safari. It's great and makes the pages load faster and clean. And to implement it, you just have to click on "preferences" (in Safari), then "advanced" and enable or disable custom style sheets. I know from experience with Omniweb and Camino that sometimes when you block all flash and ads that some webpages don't load correctly. Some guys say they just keep two browsers running and when the one that loads clean doesn't bring up things they want, they just open the standard browser and reload the page. That's a lot of work. It would be easier to change the advanced preferences in Safari to either run the .css file or not with the press of a key. Does anyone have a clue how to make, say an Fkey to toggle, or two Fkeys (one turns on style sheet and one turns off) to do this task? Thanks for any help.

    I'm new to applescripting and automator, so bear with me. I found a .css file that stops annoying ads, flash ads, etc in Safari. It's great and makes the pages load faster and clean. And to implement it, you just have to click on "preferences" (in Safari), then "advanced" and enable or disable custom style sheets. I know from experience with Omniweb and Camino that sometimes when you block all flash and ads that some webpages don't load correctly. Some guys say they just keep two browsers running and when the one that loads clean doesn't bring up things they want, they just open the standard browser and reload the page. That's a lot of work. It would be easier to change the advanced preferences in Safari to either run the .css file or not with the press of a key. Does anyone have a clue how to make, say an Fkey to toggle, or two Fkeys (one turns on style sheet and one turns off) to do this task? Thanks for any help.

  • How to change color inside single item? [SOLVED]

    I'd like to change background color inside item (on blue for ex.: see http://www.marussig.si/weblib/screen.jpg ) . The problem is that the block is multiline block but I have to change the color just on one line in one column. Is this possible? If I use set_item_propery syntaks, the whole item changes the color what I don't want to do.
    thanks for help!
    m.

    emails between two posters is no solution. This forum needs solutions, which each user can participate from. So please refer to a web-space, where your solution is downloadable.

  • Need to change color of a symbol with a custom slider

    I'm pretty new to Flash and am not sure if it is the right app to try to do the following:
    I need to create an interactive piece. It's much more involved than this but fundamentally I need to create a slider on the left side of a window that is the color spectrum. I'll put a small triangular pointer beside it that can be moved up and down beside the spectrum. I want whatever color the slider is next to to show up in a symbol on the right. I've attached a simple image that illustrates it.
    So to restate it again, I'd slide the triangular symbol up and down beside the spectrum gradient on the left and whatever color it is pointing to would just show up in the symbol on the right, real time.
    Is this possible in Flash and if so I'd appreciate some guidance about how to start coding it? I'm not a programmer but do know and understand how code works fundamentally. I understand that Flash uses Action Script and I assume that with Action Script it's most likely possible to do this.
    Thanks,
    Rob

    http://www.flashandmath.com/basic/colors/
    http://kirill-poletaev.blogspot.com/2010/08/how-to-create-color-picker-with-sliders.html
    http://tutorials.flashmymind.com/2009/02/actionscript-3-color-picker/
    http://active.tutsplus.com/tutorials/actionscript/create-a-custom-color-picker-in-flash/

  • How to change color in html report with MARKUP HTML ON?

    While generating html reports using MARKUP HTML ON with in sqlplus, I would like to highligh the records with different colors. how can do this?

    Here is an example - it produces nice output and sets the background. It displays in red if database is in NOARCHIVELOG mode. You can go further and use CASE statements for certain conditions to display different colors, font sizes.
    set markup html on spool on entmap off -
         head '-
         <style type="text/css"> -
            table { background: #eee; font-size: 90%; } -
            th { background: #ccc; } -
            td { padding: 0px; } -
         </style>' -
         body 'text=black bgcolor=fffffff align=left' -
         table 'align=center width=99% border=3 bordercolor=black bgcolor=white'
    spool logmode.html
    select  'Archive Log Mode :'|| decode(log_mode,'NOARCHIVELOG','<font color=red>Database in '||log_mode||' mode </font>',log_mode) "Archive Log Mode"
    from v$database
    spool off
    set markup html off

  • Changing color profile in Lightroom 5 Soft Proofing from ProPhotoRGB to sRGB is not showing any changes, changes in Photoshop CC are dramatic

    I am working with  the color profile ProPhoto RGB in both Lightroom 5 and Photoshop CC. In preparing for my first Blurb book I have tried to generate pictures in sRGB in Lightroom, using the Soft Proofing feature, but there are no changes at all. Then I transfer the same pictures into Photoshop, change the color profiles and the results are dramatically different.
    What can I do to achieve the same results in Lightroom

    With an average monitor what you see on-screen is already soft proofed to sRGB (or something very close to it), because that's all the monitor is capable of displaying anyway. So soft proofing to sRGB won't tell you anything. You won't see any difference.
    In Photoshop it sounds as if you assign profiles. That's not the way to do it. If you convert correctly you won't see any difference. Same principle as above: there may be clipping in the process, but what you see on screen is already clipped, so no visual on-screen difference.
    With a wide gamut monitor soft proofing becomes slightly more useful. But still you won't see any changes occurring outside Adobe RGB. You'll get a better idea by keeping an eye on the histogram. Ideally, all three channels should taper gently off towards the endpoints. If any one or two channels are backed solidly up against the endpoint, on either side, that's gamut clipping.
    If Blurb gave you a real profile, one that reflected their actual printing process, you could soft proof to that. But apparently they don't.

  • Referencing a page item with query results from another page

    Hello Gurus,
    Any Idea How to achieve following in APEX.
    Step 1: Page 1, Region A of type SQL report.
    Sql query:
    select employee from emp;Step 2: Page 2, A display item is created on this page, say :P2_X that is intended to source its values from the query/region written in Page1.
    In this example stated above, I need to display :P2_X on PAGE 2 that in receives value from employee column on the query mentioned in step 1.
    Any idea how to achieve this?
    Thank you for reading this post.
    -R

    Hello Rich,
    Edit your SQL Report.
    Under Column Attributes , edit the EMPLOYEE Column.
    Go to LINK Tab.
    In link text : select the first option #EMPLOYEE#
    In Target is - select Page in this application.
    in item type P1_X and in value enter #EMPLOYEE#
    Regards,
    Shijesh

  • My friend changed the password on my ipod touch lock, aI have tried multiple times to input the correct password. But I attempted too many times and I was locked out. The screen is red and says "connect to itunes'. But I cant connect to itunes.

    My friend changed the password on my ipod touch. And now I am locked out because I tried too many times. I can no longer put in a password, and I can't connect to itunes because it says "must input passcode first before connecting", even though the ipod says to connect to itunes

    Place the iPod into recovery mode in order to restore the iPod with iTunes.
    http://support.apple.com/kb/ht1808

Maybe you are looking for

  • LiveCycle Designer ES Rights Management

    Hi I am new to LiveCycle Designer ES (included in my copy of Acrobat 9 Pro) and am still trying to figure out if I can utilize the rights management server features (or if I would need to based on available features). While I suspect that this would

  • Foreign Trade Data Configuration (commodity code, legal categorization)

    All, I have the following scenario/issue: 1. Orders (OR) created for Argentina country (goods coming from US to Argentina, not intercompany) are getting the commodity code printed on the invoice which the business doesn't want to happen. Researching

  • How can i get out of a bootloop and reinstall os x without disk

    now here's the kicker. I cant seem to get. out of boot loop on imac I just recently bought off of craigs list,  When i can by holding d It brings up os x installer.  Then prompts Can not install os x on this mac or something like that. I tried bootab

  • Logical difference   ABAP  InputScript

    Hi, What is the logical difference between a "Call transaction using..." in ABAP and an InputScript? Thanks, Govindappa.

  • Installing CS4 problems

    My CS4 stalls (@ Checking System Profile) when I try to install it on my new IMAC. Not sure what is wrong. Can anyone help?