Change color and line weight

Hi,
I am trying to create a script who could act as an Autocad plot (ie convert each color to black, with a different lineweight). I did some research, and tried to mix some scripts found here to create my own, but there is a lot of things I don't understand yet… If anyone could give an eye at these, it would be great!
Here is the first script I melted, who create my Black swatch
if ( app.documents.length > 0 ) {
var myDoc = app.activeDocument;
//add Black swatch
var newSwatch = app.activeDocument.swatches.add()
var newColor = new GrayColor();
newColor.gray = 100;
newSwatch.name = "Black"
newSwatch.color = newColor
//Sélectionner les lignes par spot color
var findColor = swatch.getByName("AutoCAD Color 2").color;
var replaceColor = swatch.getByName("Black").color;
//pathItem.strokeColor
var idoc = app.activeDocument;
var itext = idoc.textFrames[0];
//alert(itext.textRange.characterAttributes.fillColor);
var fillColor = itext.textRange.characterAttributes.fillColor;
var strokeColor = itext.textRange.characterAttributes.strokeColor;
filled = stroked = "yes";
if (fillColor=="[NoColor]")
        filled = "No";
if (strokeColor=="[NoColor]")
        stroked = "No";
alert("Filled: " + filled + "\n" + "Stroked: " + stroked);
And here is the second one, who replace one color by Black (it don't change the text, nor the lineweight yet…
if ( app.documents.length > 0 ) {
//test de dialogue
function csDialog() {
     var fabGroup = app.activeDocument.swatchGroups.getByName('Fabrics');
     var allFabs = fabGroup.getAllSwatches();
     var fabNames = Array();
     for (var i = 0; i < allFabs.length; i++) {
          fabNames.push(allFabs[i].name);
          if (i < allFabs.length-1) fabNames.push('-');
     var csdlg = new Window('dialog', 'Tim\'s Fabric Picker…',[0,0,300,205]);
     // Standard Buttons    
     csdlg.cancelBtn = csdlg.add('button', [15,164,125,186], 'Cancel', {name:'cancel'});
     csdlg.okBtn = csdlg.add('button', [175,164,285,186], 'OK', {name:'ok'});
     // Button call back
     csdlg.okBtn.onClick = function() {
          csdlg.close(1);
          colourSwapper('Black','Black'); // Here call the process
     csdlg.center();
     csdlg.show();
// Main active document commands go here
function colourSwapper(a,b) {
     var uIL = app.userInteractionLevel;
     app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
     var docRef = app.activeDocument;
     recurseLayers(docRef.layers);
     alert('Now run Action:\r"Delete Unused Panel Items"');
     app.userInteractionLevel = uIL;
// Main active document check function
function activeDoc() {
     if (app.documents.length == 0) {
          alert('NO document open?');
          return;
activeDoc();
function recurseLayers(objArray) {
     for (var i = 0; i < objArray.length; i++) {
          var l = objArray[i].locked;
          if (l) objArray[i].locked = false;
          var v = objArray[i].visible;
          if (!v) objArray[i].visible = true;
          changeText(objArray[i].textFrames);
          changeColours(objArray[i].pathItems);
          if (objArray[i].layers.length > 0) {
               recurseLayers(objArray[i].layers)
          if (objArray[i].groupItems.length > 0) {
               recurseGroups(objArray[i].groupItems)
          if (objArray[i].compoundPathItems.length > 0) {
               loopCompounds(objArray[i].compoundPathItems)
          objArray[i].locked = l;
          objArray[i].visible = v;
function recurseGroups(objArray) {
     for (var i = 0; i < objArray.length; i++) {
          var l = objArray[i].locked;
          if (l) objArray[i].locked = false;
          var h = objArray[i].hidden;
          if (h) objArray[i].hidden = false;
          changeText(objArray[i].textFrames);
          changeColours(objArray[i].pathItems);
          if (objArray[i].groupItems.length > 0) {
               recurseGroups(objArray[i].groupItems)
          if (objArray[i].compoundPathItems.length > 0) {
               loopCompounds(objArray[i].compoundPathItems)
          objArray[i].locked = l;
          objArray[i].hidden = h;
function loopCompounds(objArray) {
     for (var i = 0; i < objArray.length; i++) {
          var l = objArray[i].locked;
          if (l) objArray[i].locked = false;
          var h = objArray[i].hidden;
          if (h) objArray[i].hidden = false;
          changeColours(objArray[i].pathItems);    
          objArray[i].locked = l;
          objArray[i].hidden = h;
function changeColours(objArray) {
     for (var i = objArray.length-1; i >= 0; i--) {
          var l = objArray[i].locked;
          if (l) objArray[i].locked = false;
          var h = objArray[i].hidden;
          if (h) objArray[i].hidden = false;
          if (objArray[i].strokeColor instanceof SpotColor) {
               if (objArray[i].strokeColor.spot.name == 'AutoCAD Color 11') {
                    objArray[i].strokeColor = app.activeDocument.swatches.getByName('Black').color;
               if (objArray[i].strokeColor.spot.name == 'AutoCAD Color 23') {
                    objArray[i].strokeColor = app.activeDocument.swatches.getByName('Black').color;
          objArray[i].locked = l;
          objArray[i].hidden = h;
function changeText(objArray) {
     for (var i = objArray.length-1; i >= 0; i--) {
          var l = objArray[i].locked;
          if (l) objArray[i].locked = false;
          var h = objArray[i].hidden;
          if (h) objArray[i].hidden = false;
          if (/Primary/.test(objArray[i].contents)) {
               objArray[i].contents = objArray[i].contents.replace('AutoCAD Color 11', 'Black')
          if (/Secondary/.test(objArray[i].contents)) {
               objArray[i].contents = objArray[i].contents.replace('AutoCAD Color 23', 'BLack')
          objArray[i].locked = l;
          objArray[i].hidden = h;

Gernouille
Did you ever get this resolved?  I have a similar situation and would like to see final code if you have a working solution.

Similar Messages

  • I have a 5th generation IPod touch, and today when i turned it on everything was fine. Then suddenly the screen froze and changed colors and lines started coming from the sides of the Ipod until the reached the middle. Now it won't turn back on.

    I tried restarting it by using just the power on button at first. Once that failed I held the power and home buttom for ten sconds and that didn't work. I then plugged in the ipod to see if it needed charged, and repeated the same two steps at before but to no avail. Finally, I opened up itunes and plugged my ipod in, but nothing came up. I then tried to turn it on for a third time, but nothing happened. I just confused on what happened. Could it be a bad display, or did the whole thing just die on me? Help please.  

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try on another computer
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • My screen is changing colors and has lines in all the screen what can i do

    I accidentally dropped my cellphone s couple of times. Then it got wet but I did not know it was wet and I connected it to my charger then my screen started to change colors and had lines covering the whole screen what can I do? I need help!

    There is nothing you can do with that unit
    Apple should exchange it for an Out of Warranty exchange  identical 5S  for $269 if you are in the US ,similar pricing elsewhere

  • Need to change colors of lines in an Omniportlet Line Chart

    I am running Oracle Portal on a 10g Web server. I have created an Omniportlet and I am displaying data in a line chart. Is it possible for me to define the colours of the lines in the linechart?

    Hi I didn't changed colors in line chart but I managed to redesign lot of omniportlets.
    What you can do is to re-define CSS.
    Add an HTML portlet in your page with some CSS embedded.
    To catch wich class are to be re defined, I recommand you to use firefox with the extension Webdevelopper.
    Use the "Informations - display element information" functionnality to catch wich class are used for your chart.
    Then redefine those classes in your custom CSS.
    Hope that will help

  • May have down loaded a trojan or virus while down loading torrents.  My menu and windows change color and pattern now.  Anyone have this happen before?  I repaired the permissions and everything was fixed except one.

    My dumb *** may have down loaded a trojan or virus while down loading torrents.  My menu and windows change color and pattern now.  Anyone have this happen before?  I repaired the permissions and everything was fixed except one.
    Warning: SUID file “System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/MacOS/ARDAg ent” has been modified and will not be repaired.

    You didn't do anything wrong.
    Not malware or a virus.
    But how do you explain this?
    My menu and windows change color and pattern now.

  • I have an Apple TV Gen1 and it has a blinking light that changes color and I dont get any video displayed

    we have lost a few AV items due to a recent storm and i am trying to find out if my apple Tv model: A1218 is dead or fixable. It has a blinking light that changes color and I dont get any video displayed. the color looks to go red, green, off and keeps repeating that cycle.

    All I could find is this: http://support.apple.com/kb/TA24576
    It looks to have an issue, i.e. possibly bricked.

  • My ipod 5th generation has lines on the screen that will change color and the ipod sometimes wont respond when i touch it

    My ipod has lines on the screen and will change color. It also is not responding to my touch. What can i do?

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup. See:                                 
    iOS: How to back up           
    - Restore to factory settings/new iOS device.
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar          

  • CS4: Change color of line indicator/outline tool (not line itself)

    I couldn't find an answer in any of the resources - possibly because I don't know the right term.
    I am talking about the line that is displayed during the period that you draw a line - from the time you click the mouse, until you release it. There's a thin greyscale line indicating the outline of the item you are drawing.
    I'm working on ultrasound images, full of greyscale spots. In order to draw lines as precisely as possible, I would prefer that the outline that is displayed while I'm trying to draw my line as correctly as possible, has another color.
    I know how to change the color of lines that I have drawn, that are part of the image. What I need is to change the color of the line indicator/helper tool that ONLY shows WHEN I'm drawing a line, and is not really a part of the image.
    Hope you can help!

    It's a well-known shortcoming that the path that's drawn with the pen is hard to see under some circumstances.
    One thing:  Its appearance is a little different with OpenGL Drawing disabled vs. enabled.  What's your setting (Edit - Preferences - Performance)?
    If you're not in need of the OpenGL features, disabling OpenGL Drawing could be helpful in making your paths somewhat more visible.  Such a change is not without downsides, but perhaps it could serve as a workaround for you.
    -Noel

  • Edit a png file... change colors and text and then export to gif?

    First I want to state that I am VERY new to Fireworks and I am trying to figure out how this works!  I typically use Photoshop.
    I was sent a PNG file (from a friend).  The file has many buttons on it that I believe are somehow saved or exported out as gif images to be buttons on her website.  All of the buttons are basic rectangles that are gray with black text.  She was told she could edit all of the buttons quickly in Fireworks (change their color, font color, etc) and it would change them all together.  Then save them all out so we would have the individual gif files for the buttons to save to the directory.
    So... I am able to open the png file in Fireworks and I can select each button or all of them, but I cannot see how to change their color and font, etc.  I know this must be very simple!  Can someone help me?
    Thank you!
    Sharlyn

    Have a look in the ocument Library panel to see if the buttons are Symbols. If yes, then double click on one of the buttons to open it in the symbol editor where you can easily make changes in all of them at once.

  • Changing color of lines in line chart

    Okay this is a dumb question but how do I change the color of
    lines in a line chart?

    "spacehog" <[email protected]> wrote in
    message
    news:g81g1a$eq4$[email protected]..
    > Okay this is a dumb question but how do I change the
    color of lines in a
    > line
    > chart?
    http://www.rphelan.com/2008/05/23/taking-control-of-flex-charting-styles/

  • Loss of color and lines in notes app

    After latest updates, Notes app yellow background and lines are missing.

    Hello higashiuchi,
    The design of Notes for OS X Mavericks has changed:
    Thank you for contributing to Apple Support Communities.
    Cheers,
    BobbyD

  • Change color and font in two button dialog box

    The two button dialog is boring.
    I need to change the font (larger), the background color, the button color, and hilite the important part of the message.
    Ex: is this color RED ? I'd like to see RED is red.
    Attachments:
    DIALOGBOX.vi ‏16 KB

    Hi trout00;
    I think it will be better if you create your own dialog window. Create a vi with all the features you want the dialog window to perform. Edit the connectors of the vi so they return what you want to retrieve (Right-click the upper right icon in the fron panel of the vi and select "Show Connectors"). Then, edit the configuration of your vi so it behave like a dialog box (Right-click the upper right icon again and select "VI Setup..."). Finally, add your vi to your main application vi.
    Regards;
    Enrique
    www.vartortech.com

  • My ipod touch's screen is changing colors and will not respond to the buttons

    my sisters ipod touch is a 4th gen and the screen recently started changing colors, it does not respond to the buttons and will not turn off. should i wait for the battery to die then charge it. she said it started happening when she was charging it. could it be the charging cable? i do not know what OS it has.

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • Layer select - change color and stroke

    i have r layer , g layer , b layer
    i would like to select r layer object all
    after that i would like to change color to my wanted color and change stroke
    with script ?
    that layers have sub_layer
    pls , can you help me ?

    Good thought. Howeber, I've never created nor applied any Character Styles (or Paragraph Styles)--and I double-checked that in the Character Styles window (nothing is listed).
    As someone used to CS3, is it possible to create a style (and later re-apply it) without knowing it, and without seeing it listed? It's a new CS6 feature and I haven't tried it, so I might well misunderstand it!
    The only styling I did of the text box is selecting text, changing font size/leading/color, and toggling changing the font between normal, bold, and italic.
    Plus, that wouldn't explain why it happens only sometimes and not others, on the very same words in the same text box of the same document; for instance, maybe I'll change one word, and some other word in another paragraph also changes; but later when I change the original word again, the same problem might not happen. It's like it comes and goes, but once a text box "goes bad," issues remain frequent.

  • Changing color and contrast before capturing analog video?

    Is it possible to change color (colorcast / saturation and contrast etcetera) before capturing analog video in Final Cut (software)? I have some old dv tapes I would like to upscale to hd and are considering to upscale via the super vhs outlet / connector on the camera through an I/O box (maybe Matrox).
    Do you loose much quality when compared to capturing from DV (digital capture)? I would like to make "a first generation" good capture.....

    You would need a capture card and a deck with built in controls, or an external TBC that works with compatible decks. Not every deck allows for this external control.
    S-VHS or component out would be lesser quality than straight DV capture via firewire. Via firewire it is lossless...straight digital capture. analog capture is a loss of quality. Capture as DV and then upscale with After Effects or Compressor...or get a DV deck with SDI out and capture with...oh, the Mini doesn't do SDI. You'd need the MXO2 LE for best quality capture. With your options, the best bet would be capture as DV and then use Compressor. Or spring for the Matrox MXO2 LE.
    Sorry, good quality costs...
    Shane

Maybe you are looking for

  • Material to be produce included in production order component review

    Hello gurus, i have a issue about production order. 1. The BOM of XXXX material have the next components:     A     B     C 2. When i create a production order for 100 ST of  XXX material, the component review in production order includes the next:  

  • New to BIAPPS- Getting Error while loading HR PAYROLL

    Hello, I am installing BIApps for the first time on a Linux system, and have ensured all parameters to be set correctly as per the prescribed document. - DAC is up and Running - DB is running - Informatica service is running I have chosen the HR Payr

  • Connect my old hard drive to iMac?

    Hi, my hard drive gave up on me and had to be replaced, and now I want to try connect the old hard drive to my iMac to try access files from it. I have connected it to my iMac via a SATA to USB cable, the light on the SATA cable comes on (which indic

  • Patching mid tier and infrastructure tiers.

    Greetings!!! I am having some questions on patches and hope someone can help me here. We have two Oracle Application Server machines both on Windows 2003 servers 32-bit and both are on 10.1.2.0.2 release. The first machine is hosting HTTP Server, For

  • Error in Jpanel add function in a loop...^Urgent^

    I have higlighted the error part as below code, i would appreciate if you can help ....thank you Jpanel p1 p1.removeAll();                                     p1.add(t_label);                   p1.add(menuBar);                       try{