OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 14-12-2006, 03:01
keytecstaff
Guest
 
Posts: n/a
Question Color styles docker

Hi,

I would like a VBA macro for CorelDraw X3, which when I have imported a .PDF file, for it to go through and select every shape in the document so the Color Styles docker window gets populated as I would like to know what colors are being used for each shape.

Many thanks,

Kevin.
Reply With Quote
  #2  
Old 14-12-2006, 06:20
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

btw, for somewhat similar purpose I dragged a button for built-in CorelDRAW command:
Window- ColorPalettes - Create palette from document
this will show a standalone palette with all document's colors.

For silent action without confirmations I made this macro:
Code:
Sub MakePaletteFromSel()
   If ActiveSelectionRange.Count = 0 _
      Then Application.Palettes.CreateFromDocument "1", , True _
      Else Application.Palettes.CreateFromSelection "1", , True
   End Sub
if something is selected then only selection's colors are feeded into new palette
the code uses 1.cpl inside AppData of Corel's user folder, so there'll be just one palette for each time you call a macro
Reply With Quote
  #3  
Old 14-12-2006, 08:43
keytecstaff
Guest
 
Posts: n/a
Smile

Thanks wOxxOm. Works great.

Just need another macro now which will select objects of a certain colour. For example find all shapes with the color of "C:0 M:0 Y:0 K:20".

Many thanks,

Kevin.
Reply With Quote
  #4  
Old 14-12-2006, 10:45
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

I use every minute sameColorSelect.gms from http://recentfiles.sbn.bz/macros.html#colorselect
Reply With Quote
  #5  
Old 20-12-2006, 02:50
keytecstaff
Guest
 
Posts: n/a
Default

Hi,
SameColorSelect does not seem todo what I want. This utility will change any color you have selected into another color. I want to be able to look at the Color Style docker so I can see if any color is there that I want to change so then I can change all the colors of say C:0 M:0 Y:0 K:10 in the document to another color.

Many thanks,

Kevin.
Reply With Quote
  #6  
Old 03-01-2007, 03:58
keytecstaff
Guest
 
Posts: n/a
Default

Happy New Year all

Anyone help me on this one?

Thanks,

Kevin.
Reply With Quote
  #7  
Old 03-01-2007, 09:08
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default SelectSameColor

I am still not 100% sure as to what you are trying to do, but the following will select all objects of the same color. Just select one object, run the script and it finds all other objects in the document of that same color. If this doesn't do what you want, could you explain a little further.

Hope it helps,

Shelby
Code:
Sub SelectSameColor()

Dim os As Shape, s As Shape
Dim sr As New ShapeRange

If ActiveSelection.Shapes.Count = 0 Then
    MsgBox "Please select an object.", vbOKOnly
    Exit Sub
ElseIf ActiveSelection.Shapes.Count > 1 Then
    MsgBox "Please select only one object.", vbOKOnly
    Exit Sub
ElseIf ActiveSelection.Shapes.Count = 1 Then
    Set os = ActiveShape
End If

For Each s In ActivePage.Shapes
    If s.StaticID <> os.StaticID Then
        If s.Fill.UniformColor.IsSame(os.Fill.UniformColor) Then sr.add s
    End If
Next s

sr.add os
sr.CreateSelection
    
End Sub
Reply With Quote
  #8  
Old 03-01-2007, 09:20
keytecstaff
Guest
 
Posts: n/a
Default

OK here is an explanation of the process I go through.

1. Open new document.
2. Import .PDF file with one page which has an illustration in it made up of vector objects.
3. Once the .PDF file has been imported we have a load of automated macros which run to tidy up the figure for example, change all fonts to Arial 7pt change all colors to Greyscale and make sure all line widths are not too thin.
4. Then a macro runs which makes a new palette showing colors used in the document.
5. If there are any colors which we do not allow for example a Grey of G:210 I want to be able to have a macro which lets me choose the G:210 in the palette and change it to solid White. The reason I can't use the select same color macro you have given me is that I don't know where the color is in the document that I want to change and it will take a long time to find and select it as there can be hundreds of objects in a document.

I hope this makes things clearer for you shelbym.

Look forward to your reply.

Kevin.
Reply With Quote
  #9  
Old 03-01-2007, 13:17
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,770
Blog Entries: 10
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Makes Sense

I am not sure how to pull a color from the ColorStyles. But I can pull up the color Dialog, and you could select the color from there. Let me know if this works for you.
Code:
Sub SelectSameColorDialog()
    Dim cColor As New Color
    Dim sr As New ShapeRange
    Dim s As Shape

    If cColor.UserAssignEx = True Then
        For Each s In ActivePage.Shapes
            If s.Fill.UniformColor.IsSame(cColor) Then sr.add s
        Next s
        
        sr.CreateSelection
    End If
End Sub
If your object are in groups you would need to use something like this:
Code:
Public cColor As New Color
Public sr As New ShapeRange

Sub SelectSameColorDialog()
    If cColor.UserAssignEx = True Then
        SelectSameColorDialogSub ActivePage.Shapes
        sr.CreateSelection
    End If
End Sub

Sub SelectSameColorDialogSub(ss As Shapes)
    Dim s As Shape
    
    For Each s In ss
        If s.Type = cdrGroupShape Then
            SelectSameColorDialogSub s.Shapes
        Else
            If s.Fill.UniformColor.IsSame(cColor) Then sr.add s
        End If
    Next s
End Sub

Last edited by shelbym; 03-01-2007 at 13:39.
Reply With Quote
  #10  
Old 03-01-2007, 14:25
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

you may try remake of ColorReplacer http://forum.oberonplace.com/showthread.php?p=7427

it allows to choose colors quickly from palette of current document, see screenshot on that link
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
It is almost a docker, we need this for 14 shelbym Feature requests/wishlist 2 22-06-2009 02:29
Question about the Library Symbol Docker Hernán General 2 27-05-2005 15:30
CDR12: refresh Object Manager docker after CreateSelection zlatev CorelDRAW/Corel DESIGNER VBA 2 05-03-2005 09:00
Installing a macro as a docker? dan CorelDRAW/Corel DESIGNER VBA 3 16-02-2005 14:50
create docker window vharun CorelDRAW/Corel DESIGNER VBA 2 26-05-2004 07:56


All times are GMT -5. The time now is 03:18.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com