tag:blogger.com,1999:blog-37549421382753577152024-03-05T05:13:37.858-08:00Corel Draw and VBA programmingCorel Draw tutorials.<br>
How to draw precisely.<br>
How automate your work through VBA (Visual Basic for Applications).<br>
How to extend functionality with VBA.<br>
CAD related topics.Wojciech Czubakhttp://www.blogger.com/profile/00472030331097992112noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-3754942138275357715.post-89513130647850626232011-07-29T07:52:00.000-07:002018-10-23T02:12:51.659-07:00Skeeper - keep you selection (little macro)In this post I would like to demonstrate a little macro which allows you to remember certain group of shapes without grouping them.<br />
<br />
Skeeper<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNjm4FAxSlFppUBIwZTwXj4I3_pKI3FjzEYkd19SOY-XN_ltlce5MkBpCkVair5gMwyCYpsaTvEOmEUQOqGKDd5DArLUbsVq3fexNt5FMpxuZdKG75ZAEoL4E7uF4P-2YNJS7NEnZMJPk/s1600/SKeeper.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNjm4FAxSlFppUBIwZTwXj4I3_pKI3FjzEYkd19SOY-XN_ltlce5MkBpCkVair5gMwyCYpsaTvEOmEUQOqGKDd5DArLUbsVq3fexNt5FMpxuZdKG75ZAEoL4E7uF4P-2YNJS7NEnZMJPk/s320/SKeeper.jpg" width="180" /></a></div>
<br />
<br />
SKeeper creates collections of shapes/objects which can be added to selection.<br />
It put a registry to shape's name attribute (you can see it in Object Manager). When you click on the list with groups names it finds all shapes with the same record and adds them to selection.<br />
<br />
Registry/records looks like this : SK:[groupName]<br />
where [groupName] will appear in the SKeeper list box<br />
<br />
You can put anything in the object's name property, just keep SKeeper record at the end.<br />
<br />
The limit is that the groups cannot overlap, in other words object can only belong to one group. Therefore current group record will be replaced with new one.<br />
<br />
The macro uses CQL (Corel Query Language) to search for shapes.<br />
for example:<br />
<pre class="brush:vb">...
ActiveDocument.SelectableShapes.FindShapes(, , , "@name.Contains('SK:')")
...</pre>
first 3 parameters are omitted (notice empty spaces between commas) and last parameter is a String representing the CQL syntax.<br />
See this article for more details:<br />
<a href="http://coreldraw.com/blogs/insider/pages/using-corel-query-language-cql-to-search-for-objects-in-coreldraw-documents.aspx" target="_blank">Using CQL</a><br />
<br />
Feel free to use this macro (in your company or home), look at the code if you like, leave comment, ask a question.<br />
<br />
Gms file to download:<br />
<a href="http://dl.dropbox.com/u/36760018/SKeeper.gms">SKeeper.gms</a><br />
<br />
You might be interested in more featured similar macro, see:<br />
<a href="http://www.oberonplace.com/products/selmgr/" target="_blank">http://www.oberonplace.com/products/selmgr</a>Wojciech Czubakhttp://www.blogger.com/profile/00472030331097992112noreply@blogger.com2tag:blogger.com,1999:blog-3754942138275357715.post-88013075403367533272011-07-12T05:42:00.000-07:002011-07-12T05:42:49.834-07:00Selection tips<span class="Apple-style-span" style="color: #0c343d;"><b>Object selection</b></span><br />
<br />
To select or deselect objects you use Pick Tool.<br />
To activate Pick Tool:<br />
<br />
Click the icon on a toolbox:<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7og1OmWaqFLhrlCeBhC-KGRlsJmzgXV1-QStSq_-97c90f7PbANzqmq8Wyw4mG18MyIp1BM_zDEcmiErqQvDeXpjQ3dsLWHhyphenhyphenT-pP8mk_o7uTiYQOg2r1r0HihipdtCZF6R05SyGUx7o/s1600/stC.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="152" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7og1OmWaqFLhrlCeBhC-KGRlsJmzgXV1-QStSq_-97c90f7PbANzqmq8Wyw4mG18MyIp1BM_zDEcmiErqQvDeXpjQ3dsLWHhyphenhyphenT-pP8mk_o7uTiYQOg2r1r0HihipdtCZF6R05SyGUx7o/s320/stC.jpg" width="100" /></a></div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Or hit Space-bar (if you are currently editing text hit Ctrl+ Space-bar).<br />
<br />
The basic is that you get object.shape selected by clicking on it or drag mouse until desired object is surrounded by selection rectangle (blue dashed line).<br />
<br />
To add/remove objects to/from the selection hold Shift.<br />
<br />
While holding Alt key and dragging mouse the object(s) get selected/deselected if selection rectangle just cross it,<br />
or when clicking can select objects being behind the clicked one.<br />
<br />
Ctrl key makes selection rectangle a square,<br />
or when clicking you can select objects within the group.<br />
<br />
You can use any combination of modifier keys (<i><b><span class="Apple-style-span" style="color: #274e13;">Shift, Alt, Ctrl</span></b></i>) to get desired effect.<br />
<br />
When draging mouse to create selection press and hold<i> Right Mouse Button</i> before release <i>Left</i> one. You can now move the selection rectangle to different place.<br />
<br />
You can use <b><i>Object manager</i></b> to select shapes as well.<br />
On the main menu click <i><span class="Apple-style-span" style="color: #274e13;"><b>window >> Dockers >> Object Manager</b></span></i> to open it.<br />
<br />
This time it works like in a file manager ,<br />
Hold Ctrl to add objects one by one.<br />
Hold Shift key to add object between two selected.<br />
This will not work within the grouped shape object.<br />
<br />
Another way is to use <b><i>Find Objects</i></b> tool<br />
Go to <b><i><span class="Apple-style-span" style="color: #274e13;">main menu >> Edit >> Find and Replace >> Find Objects...</span></i></b><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ_X0JvcKOUGVjbiPDuCdzMCMUbzW1yVD2Xm-LP1vOzcZ1z4vgEIjYXr3oxEQNmtCTSJPRuoccxRCTGao8YxbajhHD5lTjChOQF2u4SJNzFyphq5AvwmCuMQ6nOnCPmlUp0qxh7wS9-3s/s1600/st002003.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZ_X0JvcKOUGVjbiPDuCdzMCMUbzW1yVD2Xm-LP1vOzcZ1z4vgEIjYXr3oxEQNmtCTSJPRuoccxRCTGao8YxbajhHD5lTjChOQF2u4SJNzFyphq5AvwmCuMQ6nOnCPmlUp0qxh7wS9-3s/s320/st002003.jpg" width="248" /></a></div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
This is a tool to search for objects that have specified properties. Result of searching is selected object(s).<br />
When there is selected object on screen the option "Find objects that match the currently selected object" become available.<br />
<br />
With selected object on screen.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXvbzrqpE4fcE3-aiPLh9sWPdX1knCrrBB2R2wAeoRE0cEJSOcM_anvIIjTka0V4mTktrC9gMMg3fDoY64Yeg_da_4rTlZL2TG2rghiJnOEz-AReKSZOzaiCcETymVWX0LkxPUndZj8GQ/s1600/findAndReplace02.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="251" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXvbzrqpE4fcE3-aiPLh9sWPdX1knCrrBB2R2wAeoRE0cEJSOcM_anvIIjTka0V4mTktrC9gMMg3fDoY64Yeg_da_4rTlZL2TG2rghiJnOEz-AReKSZOzaiCcETymVWX0LkxPUndZj8GQ/s320/findAndReplace02.jpg" width="320" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"></div><br />
Without selected object.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilUxl1t19LTfXAHJLZl2q96ix4NqLtWiqWtGV_vP8tsnjznavHWRzrk-fT2OjpeIzdswogCl9DNVd_66ZunPyVrQwQY3n2eEHTtq27GFcxx1s6Q0cNRASSvIxT8DFXKs5TQRSLrLj0-Qg/s1600/findAndReplace01.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="251" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilUxl1t19LTfXAHJLZl2q96ix4NqLtWiqWtGV_vP8tsnjznavHWRzrk-fT2OjpeIzdswogCl9DNVd_66ZunPyVrQwQY3n2eEHTtq27GFcxx1s6Q0cNRASSvIxT8DFXKs5TQRSLrLj0-Qg/s320/findAndReplace01.jpg" width="320" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilUxl1t19LTfXAHJLZl2q96ix4NqLtWiqWtGV_vP8tsnjznavHWRzrk-fT2OjpeIzdswogCl9DNVd_66ZunPyVrQwQY3n2eEHTtq27GFcxx1s6Q0cNRASSvIxT8DFXKs5TQRSLrLj0-Qg/s1600/findAndReplace01.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br />
</a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilUxl1t19LTfXAHJLZl2q96ix4NqLtWiqWtGV_vP8tsnjznavHWRzrk-fT2OjpeIzdswogCl9DNVd_66ZunPyVrQwQY3n2eEHTtq27GFcxx1s6Q0cNRASSvIxT8DFXKs5TQRSLrLj0-Qg/s1600/findAndReplace01.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br />
</a></div><br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<b><span class="Apple-style-span" style="color: #0c343d;"><br />
</span></b><br />
<b><span class="Apple-style-span" style="color: #0c343d;"><br />
</span></b><br />
<b><span class="Apple-style-span" style="color: #0c343d;"><br />
</span></b><br />
<b><span class="Apple-style-span" style="color: #0c343d;"><br />
</span></b><br />
<b><span class="Apple-style-span" style="color: #0c343d;"><br />
</span></b><br />
<b><span class="Apple-style-span" style="color: #0c343d;"><br />
</span></b><br />
<b><span class="Apple-style-span" style="color: #0c343d;">Node selection</span></b><br />
<b><span class="Apple-style-span" style="color: #0c343d;"><br />
</span></b><br />
Selecting nodes is pretty much the same like selecting objects.<br />
By clicking on it surround it with selection rectangle.<br />
<b><i>Shift</i></b> & <b><i>Ctrl </i></b>modifier keys works the same.<br />
<b><i>Alt </i></b>activate 'Freehand' mode, you compare it to something known from other graphic packages as 'lasso selection'<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfrdoR8waqvlVyGepfxSCJzV7nm-ulxkL54kG8SqjePQusyHu5Y5ASNnsV5JoH7HWlVME2VFJer5KcpeY8uMnctpKdgSLS0xGhSGkOWlaUhwMJM2LCuiFHCWjBc7hwPgBFsmeZbmPsbYk/s1600/selectNodes002.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="193" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfrdoR8waqvlVyGepfxSCJzV7nm-ulxkL54kG8SqjePQusyHu5Y5ASNnsV5JoH7HWlVME2VFJer5KcpeY8uMnctpKdgSLS0xGhSGkOWlaUhwMJM2LCuiFHCWjBc7hwPgBFsmeZbmPsbYk/s320/selectNodes002.jpg" width="320" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ_7omrYrbkhbPbNyZP7Yw7pOPvuGU9oThe7h_S8RrEsQQEeF_6ypGqDk3x8udAWQdU7yvnurQCeL_q3GTniP7OZEFFO19TZAyt-dRCSi7zFeVKE9BsUM_PBOobamjIc3LYZynwmdi1ZI/s1600/selectNodes.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="195" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJ_7omrYrbkhbPbNyZP7Yw7pOPvuGU9oThe7h_S8RrEsQQEeF_6ypGqDk3x8udAWQdU7yvnurQCeL_q3GTniP7OZEFFO19TZAyt-dRCSi7zFeVKE9BsUM_PBOobamjIc3LYZynwmdi1ZI/s320/selectNodes.jpg" width="320" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm9Waruu0FJuEEHHd77PNPifU-wyKpLuzot1TkA83jLxizvPvsnTf10KDp4Y0dfnH9QqQlags-kxRX0_blQGC1jwg9TyAMrDsWdCc28HEzA9eVWI9K25Q1H3MkpvXvPXP1RyG-8y3iHis/s1600/selectNodes001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="195" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjm9Waruu0FJuEEHHd77PNPifU-wyKpLuzot1TkA83jLxizvPvsnTf10KDp4Y0dfnH9QqQlags-kxRX0_blQGC1jwg9TyAMrDsWdCc28HEzA9eVWI9K25Q1H3MkpvXvPXP1RyG-8y3iHis/s320/selectNodes001.jpg" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: justify;">On the images above you can see that actually I haven't pressed <b><i>Alt </i></b>key but change selection mode in left-upper corner to Freehand. Holding <b><i>Alt </i></b>key give the same result.</div>Wojciech Czubakhttp://www.blogger.com/profile/00472030331097992112noreply@blogger.com0tag:blogger.com,1999:blog-3754942138275357715.post-19612792533378813192011-06-06T05:37:00.000-07:002011-06-06T05:45:29.144-07:00How to create macro (first macro)<span style="color: #0c343d;"></span><br />
Today I'd like explain macro's code I have used in the video from previous post (<a href="http://www.youtube.com/watch?v=XwT6GF4Z6yg">see it</a>).<br />
Macros are written in Visual Basic and I'll try to indroduce VBA syntax as well.<br />
<br />
Good starting point is to read 'Macro Programming Guide' shiped with Corel Draw.<br />
Go to: <span style="color: #0c343d;">start >> All Programs >> CorelDRAW Graphics Suite X5 >> Documentation >> Macro programming Guide - PDF</span><br />
<br />
<br />
Full code:<br />
<br />
<pre class="brush:vb">Sub putDetails()
If ActiveSelection.Shapes.Count = 0 Then Exit Sub 'this is in case you try to run the macro without making selection before
'DECLARING VARIABLES START
Dim unit As Long
Dim tUnit As String
Dim font As String
Dim fontSize As Single
Dim tSize As String
Dim precision As Long
Dim x As Double ' x coordinate of lower left corner of selections bounding box
Dim y As Double ' y coordinate of lower left corner of selections bounding box
Dim w As Double ' width of selections bounding box
Dim h As Double ' height of selections bounding box
'DECLARING VARIABLES END
'ASSIGNING VARIABLES START (you can modify this section to your needs)
unit = cdrMillimeter
tUnit = " mm"
font = "Arial"
fontSize = 12
precision = 0
'ASSIGNING VARIABLES END
'PROCEDURES
ActiveDocument.unit = unit 'set up the unit for the current active document
ActiveSelection.GetBoundingBox x, y, w, h 'get the bounding box of the selected objects. See DECLARING VARIABLES section
tSize = Round(w, precision) & " x " & Round(h, precision) & tUnit 'set up details 'width and height' for our message. These are rounded to specified precision
ActiveLayer.CreateArtisticText x, y - (1.6 * (fontSize / 4)), tSize, , , font, fontSize, 'finaly put the details as text below the selected objects
'PROCEDURES
End Sub
</pre><br />
<pre class="brush:vb">If ActiveSelection.Shapes.Count = 0 Then Exit Sub</pre><br />
The first line ensures to terminate the subroutin if there is nothing selected.<br />
The ActiveSelection refers to curent selected object(s) of a document you are working on.<br />
<br />
ActiveSelection can contain many shapes, so<br />
ActiveSelection.Shapes refers to theose shapes.<br />
<br />
To count how many shapes are in the selection put ActiveSelection.Shapes.Count .<br />
<br />
If that statement gives you zero it means there is no selection in the current document.<br />
and the rest code of our program will not be executed - Exit Sub.<br />
<br />
<br />
Declaring variables section<br />
<br />
<pre class="brush:vb">Dim unit As Long
....</pre><br />
'unit is variable name.<br />
'long' is type of variable. Type 'long' represents whole numbers<br />
there are another types in our example:<br />
<br />
String - repesetnts text<br />
Single -whole numbers again<br />
Double - numbers with decimal point<br />
<br />
See VB help to read more about variables.<br />
<br />
Next section is the variables assignment.<br />
Note that to assign some text (or sequnce of characters) to string you use quotes.<br />
To assign numbers just put value without quotes.<br />
<br />
In the <i><b><span class="Apple-style-span" style="color: #274e13;">unit</span></b></i> variable store the inforamtion about units you want use. In this example it is milimmeters<br />
<br />
<pre class="brush:vb" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">ActiveDocument.unit = unit</pre><br />
This action sets desired units for the document.<br />
<br />
Coordinates of lower left corner of selection bounding box, width and height (in set units) are obtain by:<br />
<br />
<br />
<pre class="brush:vb" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">ActiveSelection.GetBoundingBox x, y, w, h</pre><br />
so this information are assigned now to <b><i><span class="Apple-style-span" style="color: #274e13;">x</span></i></b>, <b><i><span class="Apple-style-span" style="color: #274e13;">y</span></i></b>, <b><i><span class="Apple-style-span" style="color: #274e13;">w</span></i></b> and <b><i><span class="Apple-style-span" style="color: #274e13;">h</span></i></b> variables.<br />
We've got everything we need.<br />
Next procedrues are about formating and presenting the results on drawing area.<br />
<br />
<pre class="brush:vb" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">...
tSize = Round(w, precision) & " x " & Round(h, precision) & tUnit
...
</pre><br />
This is to compose values to a line of text (string).<br />
Round() function rounds the width and height of selection (<span class="Apple-style-span" style="color: #274e13;"><i><b>w</b></i></span>, <span class="Apple-style-span" style="color: #274e13;"><i><b>h</b></i></span>) to specified precision (<span class="Apple-style-span" style="color: #274e13;"><i><b>precision</b></i></span>) and return numeric value (double).<br />
<br />
As you can see there are to types of variables<br />
string and double.<br />
<br />
string: <u>" x "</u> and <b><i><span class="Apple-style-span" style="color: #274e13;"><u>tUnit </u></span></i></b>(defined at the beginning of code)<br />
<br />
double: <u>Round(<b><i><span class="Apple-style-span" style="color: #274e13;">w</span></i></b>, <b><i><span class="Apple-style-span" style="color: #274e13;">precision</span></i></b>)</u> and <u> Round(<b><i><span class="Apple-style-span" style="color: #274e13;">h</span></i></b>, <b><i><span class="Apple-style-span" style="color: #274e13;">precision</span></i></b>)</u><br />
<br />
and they are separated (or connected) by '<span class="Apple-style-span" style="color: #660000;"><b>&</b></span>' .<br />
In this situation the numeric values are automatically converted to string so it can be safely assigned to <span class="Apple-style-span" style="color: #274e13;"><i><b>tSize </b></i></span>variable.<br />
<br />
And the last line:<br />
<br />
<pre class="brush:vb" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">...
ActiveLayer.CreateArtisticText x, y - (1.6 * (fontSize / 4)), tSize, , , font, fontSize
...
</pre><br />
creates text object on the drawing area (or canvas) right below the selection.<br />
To set the position of the text object I use <b><i><span class="Apple-style-span" style="color: #274e13;">x</span></i></b> & <b><i><span class="Apple-style-span" style="color: #274e13;">y</span></i></b> variables obtained from<br />
ActiveSelection.GetBoundingBox <b><i><span class="Apple-style-span" style="color: #274e13;"><u>x</u>, <u>y</u>, w, h</span></i></b><br />
<br />
The <i><b><span class="Apple-style-span" style="color: #274e13;">y - (1,6 * (fontSize / 4))</span></b></i> expression positions the text below the selection. If only y is used the text appears on the selection.<br />
<br />
The <i style="color: #274e13; font-weight: bold;">(fontSize / 4) </i>expression gives current height of capital letter in millimeters.<br />
<br />
Empty spaces between commas are for optional parameters, when omited default value is used.<br />
(you can see default values in the hint message while typing code in editor).Wojciech Czubakhttp://www.blogger.com/profile/00472030331097992112noreply@blogger.com1tag:blogger.com,1999:blog-3754942138275357715.post-42628435325157804142011-04-12T05:45:00.000-07:002011-04-14T13:34:44.398-07:00How to create macro (creating project)<div style="font-family: Arial,Helvetica,sans-serif;">As a short introduction, a <a href="http://en.wikipedia.org/wiki/Macro_%28computer_science%29" target="_blank"><span style="color: blue;">macro</span></a> is series of commands that automate some task.</div><div style="font-family: Arial,Helvetica,sans-serif;">In case of <a href="http://coreldraw.com/" target="_blank"><span style="color: blue;">Corel Draw</span></a> it is program written in <a href="http://en.wikipedia.org/wiki/Visual_Basic_for_Applications" target="_blank"><span style="color: blue;">visual basic programming</span></a> language.</div><div style="font-family: Arial,Helvetica,sans-serif;"><br />
</div><span style="font-family: Arial,Helvetica,sans-serif;">How to create a macro?</span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">Macros are stored in files with extension '<a href="http://acroe.imag.fr/gms/" target="_blank"><span style="color: blue;">.gms</span></a> '. There is one file provided by Corel called globalMacroStorage.gms. </span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">This is first (1) place where you can save your macro.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Second (2) option is to create new file which represents new macro project.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Very basic (simplified) structure of macro project is as follows: </span><br />
<ul><li><span style="font-family: Arial,Helvetica,sans-serif;">Project contain:</span><span style="font-family: Arial,Helvetica,sans-serif;"> modules</span></li>
<li><span style="font-family: Arial,Helvetica,sans-serif;">modules contain:</span><span style="font-family: Arial,Helvetica,sans-serif;"> sub<span style="font-size: x-small;">s</span> (<a href="http://en.wikipedia.org/wiki/Subroutine" target="_blank"><span style="color: blue;">subroutines</span></a>) in many cases these are actual macros</span></li>
</ul><div style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: x-small;">(You will see later that the structure of project is much more complex)</span></div><br />
<br />
<div style="color: #4c1130;"><span style="font-size: 14px;"><span style="font-family: Arial,Helvetica,sans-serif;">1) </span><u><span style="font-family: Arial,Helvetica,sans-serif;">GlobalMacroStorage.gms</span></u></span></div><br />
<div style="margin-left: 40px;"><span style="color: black; font-family: Arial,Helvetica,sans-serif;">Go to: <span style="color: #274e13;">main menu</span> <span style="color: blue;">>></span> <span style="color: #274e13;">Tools</span> <span style="color: blue;">>></span> <span style="color: #274e13;">Macros</span> <span style="color: blue;">>></span> and choose <span style="color: #274e13;">Macro Manager</span></span><br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKbtfizUixJgFiAsKHOlQ22mKXYp8wT_UVjC_jzTwkSfEV5UAOPIVcyYsnBhnDbaR1oM52ICA8FOfyeoDzTPhxgixQWCh9bvqCmU5cUTiWGmaWkz4s67lLblDtzktYpuuPAj8oq6rl0os/s1600/howToCreateMacroProject038044.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="400" r6="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKbtfizUixJgFiAsKHOlQ22mKXYp8wT_UVjC_jzTwkSfEV5UAOPIVcyYsnBhnDbaR1oM52ICA8FOfyeoDzTPhxgixQWCh9bvqCmU5cUTiWGmaWkz4s67lLblDtzktYpuuPAj8oq6rl0os/s400/howToCreateMacroProject038044.jpg" width="317" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><br />
<span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;">You should see new pop-up window or docker on the right hand side with the list of all macro projects in it.</span></span></span><br />
<br />
<span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;">Find the 'GlobalMacroStorage' and click the little cross next to see modules.</span></span></span><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg77pz8xgAVoUEG2akEHWjWhLMF7tY1KaAZitnoUE9NV6djW6bDkD-mGGJHh5-xF1JTAM2K8mAGMY4P8vDGPQxjFLEvxq3dm7bUgyj1jhRZ0ZyBkA1whPtKOLoBdwm9FDj3zd6rFL-dfTA/s1600/howToCreateMacroProject067.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="400" r6="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg77pz8xgAVoUEG2akEHWjWhLMF7tY1KaAZitnoUE9NV6djW6bDkD-mGGJHh5-xF1JTAM2K8mAGMY4P8vDGPQxjFLEvxq3dm7bUgyj1jhRZ0ZyBkA1whPtKOLoBdwm9FDj3zd6rFL-dfTA/s400/howToCreateMacroProject067.jpg" width="303" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;">On the top of this window click 'New' button and then module.</span></span></span><br />
<span style="font-family: Arial;">While newly created module is selected repeat operation but this time select macro.</span><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicet8pwb6-31tMKsd-Xudi6uItnw4nuLdQbE_KsBMxgHvfFcOvYFZBudhVoYaFb4YYOQEAMFrdLkOZZuNSe9gpb3lQSu959hoCsRPARtjdQ3_tBGTs9eTwbpmCkc0VxV9xcoMblldm01U/s1600/howToCreateMacroProjectMerged.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="158" r6="true" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicet8pwb6-31tMKsd-Xudi6uItnw4nuLdQbE_KsBMxgHvfFcOvYFZBudhVoYaFb4YYOQEAMFrdLkOZZuNSe9gpb3lQSu959hoCsRPARtjdQ3_tBGTs9eTwbpmCkc0VxV9xcoMblldm01U/s400/howToCreateMacroProjectMerged.jpg" width="400" /></a></div><br />
<br />
<div class="separator" style="clear: both; text-align: center;"></div><div style="border: medium none;"><br />
</div><div style="border: medium none;"><span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;">It opens the macro editor where you can write or edit your macro.</span></span></span><br />
<br />
<span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;"><span style="color: blue;">Sub</span> nameOfMacro() </span></span></span><span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;"><i style="color: #6aa84f;">'Sub states for subroutine. </i></span></span></span><br />
<span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;"></span></span></span><br />
<span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;"><i style="color: #6aa84f;">'Code here</i></span></span></span><br />
<span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;"></span></span></span><br />
<span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;"><span style="color: blue;">End Sub</span></span></span></span></div><div style="border: medium none;"><span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;"></span></span></span></div><span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;"><span style="color: black;"></span></span></span></div><br />
<div style="color: #4c1130;"><div style="border: medium none;"><span style="font-size: 14px;"><span style="font-family: Arial,Helvetica,sans-serif;">2) </span><u><span style="font-family: Arial,Helvetica,sans-serif;">Creating new macro project</span></u></span></div></div><div style="margin-left: 40px;"><span style="font-size: 14px;"><u><span style="color: #073763; font-family: Arial,Helvetica,sans-serif;"><br />
</span></u></span><br />
<span style="font-family: Arial,Helvetica,sans-serif;">The procedure is pretty much the same except your first choice after clicking the 'New' button is 'Macro Project'.</span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">You will be prompt to name and save new .gms file. The dialog box will display right location, which is: </span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Windows XP: <span style="color: #cc0000;">C:\Documents and Settings\<i><span style="color: #38761d;">'user nick name'</span></i>\Application Data\Corel\CorelDRAW Graphics Suite X5\Draw\GMS</span></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Windows Vista: <span style="color: #cc0000;">C:\Users\<i><span style="color: #38761d;">'user nick name'</span></i>\AppData\Roaming\Corel\CorelDRAW Graphics Suite X5\User Draw\GMS</span></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;">Windows 7: <span style="color: #cc0000;">C:\Users\<i><span style="color: #38761d;">'user nick name'</span></i>\AppData\Roaming\Corel\CorelDRAW Graphics Suite X5\Draw\GMS</span></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="color: #cc0000;"><span style="color: black;">Form there Corel Draw loads your project at start up.</span></span></span><br />
<br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="color: #cc0000;"><span style="color: black;">Rest procedure of creating new macro is the same as for <span style="color: #4c1130;">1) GlobalMacroStorage.gms</span></span></span></span></div><br />
<span style="font-family: Arial,Helvetica,sans-serif;"><span style="color: #cc0000;"><span style="color: black;"><span style="color: #4c1130;"><span style="color: black;">For the summary see this short video:</span></span></span></span></span><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/XwT6GF4Z6yg?feature=player_embedded' frameborder='0'></iframe> </div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial,Helvetica,sans-serif;">The first macro code will be explained in the next post. </span></div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial,Helvetica,sans-serif;">Another way to create new macro project is to create simple text file and change it's extension to '.gms', and place it in same location as previous plus alternatively:</span></div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Arial,Helvetica,sans-serif;">Windows XP:</span><span style="font-family: Arial,Helvetica,sans-serif;"> <span style="color: #cc0000;">C:\Program Files\Corel\CorelDRAW Graphics Suite X5\Draw\GMS</span></span></div><div class="separator" style="clear: both; text-align: left;"><br />
</div><span style="font-family: Arial,Helvetica,sans-serif;"><span style="color: #cc0000;"><span style="color: black;">The file is loaded at Corel start up (you can load it manually via macro manager by clicking the 'Load' button next to 'New' and navigate to .gms file), and then you can edit it in macro editor - </span></span></span><span style="color: black; font-family: Arial,Helvetica,sans-serif;"><span style="color: #274e13;">main menu</span> <span style="color: blue;">>></span> <span style="color: #274e13;">Tools</span> <span style="color: blue;">>></span> <span style="color: #274e13;">M</span><span style="color: #274e13;">acros</span> <span style="color: blue;">>></span> <span style="color: #274e13;">Macro </span><span style="color: #274e13;">Editor</span></span><span style="font-family: Arial,Helvetica,sans-serif;"><span style="color: #cc0000;"><span style="color: black;">.</span> </span></span><br />
<div class="separator" style="clear: both; text-align: left;"><br />
</div><br />
<span style="font-family: Arial,Helvetica,sans-serif;">LINKS:</span><br />
<a href="http://www.corel.com/servlet/Satellite/us/en/Content/1175289952188" target="_blank"><span style="color: blue; font-family: Arial,Helvetica,sans-serif;">http://www.corel.com/servlet/Satellite/us/en/Content/1175289952188</span></a><br />
<a href="http://en.wikipedia.org/wiki/Macro_%28computer_science" target="_blank"><span style="color: blue; font-family: Arial,Helvetica,sans-serif;">http://en.wikipedia.org/wiki/Macro_(computer_science</span></a><span style="color: blue; font-family: Arial,Helvetica,sans-serif;">)</span><br />
<a href="http://en.wikipedia.org/wiki/Visual_Basic_for_Applications" target="_blank"><span style="color: blue; font-family: Arial,Helvetica,sans-serif;">http://en.wikipedia.org/wiki/Visual_Basic_for_Applications</span></a><br />
<a href="http://acroe.imag.fr/gms/" target="_blank"><span style="color: blue; font-family: Arial,Helvetica,sans-serif;">http://acroe.imag.fr/gms/</span></a><br />
<a href="http://en.wikipedia.org/wiki/Subroutine" target="_blank"><span style="color: blue; font-family: Arial,Helvetica,sans-serif;">http://en.wikipedia.org/wiki/Subroutine</span></a><br />
<a href="http://www.oberonplace.com/vba/createmacro.htm" target="_blank"><span style="color: blue; font-family: Arial,Helvetica,sans-serif;">http://www.oberonplace.com/vba/createmacro.htm</span></a><br />
<div class="separator" style="clear: both; text-align: left;"></div>Wojciech Czubakhttp://www.blogger.com/profile/00472030331097992112noreply@blogger.com12