We are designers of sporting events on the open roads and currently use corel to design these schemes inserting pre-drawn elements on to maps etc.
I am looking for a way to automate the counting of these objects by there name to give me totals rather than using the 'Look for Object Names or Styles' function in Find Objects which I have to repeat 60+ times to find each object name.
i.e. Circle 1 = 20, Circle 2 = 23, Square 3 = 33
Ideally it would be great if these were displayed in a table or just being able to copy and paste in excel would be perfect.
Does anyone now of a solution of possible code that would do this?
To copy in clipboard, you can paste in excel, and a generic code for get all shapes
CGSaddon download
C# Code
public void CountShapeByName() { Dictionary<string, int> s = new Dictionary<string, int>(); ShapeRange shapes = app.ActiveDocument.SelectableShapes.All(); for (int i = 1; i <= shapes.Count; i++) { if (!s.ContainsKey(shapes[i ].Name)) { s.Add(shapes[i ].Name, 1); } else { s[shapes[i ].Name]++; } } string msg = ""; foreach (var item in s) { msg += item.Key + "\t"; } msg += System.Environment.NewLine; foreach (var item in s) { msg += item.Value + "\t"; } System.Windows.Forms.Clipboard.SetText(msg); System.Windows.Forms.MessageBox.Show("Copied"); }