Pages

Tuesday 12 April 2011

How to create macro (creating project)

As a short introduction, a macro is series of commands that automate some task.
In case of Corel Draw it is program written in visual basic programming language.

How to create a macro?
Macros are stored in files with extension  '.gms '. There is one file provided by Corel called globalMacroStorage.gms.
This is first (1) place where you can save your macro.

Second (2) option is to create new file which represents new macro project.

Very basic (simplified) structure of  macro project is as follows:
  • Project contain: modules
  • modules contain:  subs (subroutines) in many cases these are  actual macros
(You will see later that the structure of project is much more complex)


1) GlobalMacroStorage.gms

Go to:    main menu >> Tools >> Macros >> and choose Macro Manager



You should see new pop-up window or docker on the right hand side with the list of all macro projects in it.

Find the 'GlobalMacroStorage' and click the little cross next to see modules.



On the top of this window click 'New' button and then module.
While newly created module is selected repeat operation but this time select macro.





It opens the macro editor where you can write or edit your macro.

Sub nameOfMacro()  'Sub states for subroutine.

'Code here

End Sub

2) Creating new macro project


The procedure is pretty much the same except your first choice after clicking the 'New' button is 'Macro Project'.

You will be prompt to name and save new .gms file. The dialog box will display right location, which is: 

Windows XP: C:\Documents and Settings\'user nick name'\Application Data\Corel\CorelDRAW Graphics Suite X5\Draw\GMS

Windows Vista: C:\Users\'user nick name'\AppData\Roaming\Corel\CorelDRAW Graphics Suite X5\User Draw\GMS

Windows 7: C:\Users\'user nick name'\AppData\Roaming\Corel\CorelDRAW Graphics Suite X5\Draw\GMS

Form there Corel Draw loads your project at start up.

Rest procedure of creating new macro is the same as for 1) GlobalMacroStorage.gms

For the summary see this short video:


 



The first macro code will be explained in the next post. 

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:

Windows XP: C:\Program Files\Corel\CorelDRAW Graphics Suite X5\Draw\GMS

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 - main menu >> Tools >> Macros >>  Macro Editor.


LINKS:
http://www.corel.com/servlet/Satellite/us/en/Content/1175289952188
http://en.wikipedia.org/wiki/Macro_(computer_science)
http://en.wikipedia.org/wiki/Visual_Basic_for_Applications
http://acroe.imag.fr/gms/
http://en.wikipedia.org/wiki/Subroutine
http://www.oberonplace.com/vba/createmacro.htm

12 comments:

  1. activelayer.CreateArtisticText x,y -(1.6 (fontSize/4)) 'Which code ? ... Please answer my question

    ReplyDelete
    Replies
    1. I don't understand your question please clarify

      Delete
  2. ActiveLayer.CreateArtisticText x, y - (1.6 * (fontSize / 4)) .......... ????

    In the video we can't see the other part of the code, please publish the code of tha last line.

    ReplyDelete
  3. the whole code of the macro is in the next post:
    http://coreldraw-vba.blogspot.co.uk/2011/06/how-to-create-macro-first-macro.html

    and this line of the code is:
    ActiveLayer.CreateArtisticText x, y - (1.6 * (fontSize / 4)), tSize, , , font, fontSize,

    ReplyDelete
    Replies
    1. I copied the source code from your article but something is wrong on the last line.

      In the video I see, that after fontSize there is cdrF (or may be something different) ...

      Delete
    2. Sorry, I correct the mistake. The problem was with me.

      Thanks for article!

      Delete
  4. You are right, after the fontSize there are few optional parameters for the method 'ActiveLayer.CreateArtisticText'. but them not necessary for the method to work and I have removed them to make code less confusing...(apparently it might be even more confusing).
    The 'cdrF..' is some corelDraw constant, in this case it is' cdrFalse' which is just 'false' value for boolean type and it sets the created text to be not in 'bold font'. You can find many more constants starting with 'cdr...'

    ReplyDelete
  5. Ok, as many of you know, I went on in my graphic life and only use Corel products for my personal work. I also take pictures to relax and have fun because I already have too much work to do so it is FUN !!!

    I have a nemesis, it's a nice red cardinal that is either out of range or lifting within range as soon as I reach for the camera. I am not aware of his upcoming fate during the migration and decided to buy a (new to me) 70-300 lens for my old Nikon D50 to expand my camera range, namely a Quantaray Tech-10 NF AF ( Sigma) 70-300 Macro, really cheap for $ 65. This is good because there is nothing better than relaxing when it is cheap!

    I was concerned because the internet (as it always is) was ubiquitous in terms of value on this lens. It takes a bit of getting used to, the lens is heavy and a tri-pod is required for long distances, but even if I keep it still without Aftershot Pro 3, I wouldn't know what to think of this lens. I didn't try to convert the cameras to TIF or JPG.

    The attached test shot shows my neighbor's car about 200 feet away. There is no pod leaning against a signpost. This cardinal better eats his wheaties because next spring his butt is mine! Downloaded from this Link.

    ReplyDelete
  6. As we know there are many companies which are converting into Big data banking analytics with the right direction we can definitely predict the future.

    ReplyDelete
  7. This is really interesting, You are a very skilled blogger. I have joined your rss feed and look forward to seeking more of your excellent post. Also, I’ve shared your site in my social networks!

    Download follow this follow

    ReplyDelete
  8. I guess I am the only one who came here to share my very own experience. Guess what!? I am using my laptop for almost the past 2 years, but I had no idea of solving some basic issues. I do not know how to Download Cracked Application and Download crack pro software or any other basic crack version. I always really on others to solve my basic issues. But thankfully, I recently visited a website named Azharpc.org

    Coreldraw Crack
    PassFab for RAR Crack
    Wondershare Filmora Crack
    ESET Internet Security Crack
    LD Player Crack

    ReplyDelete
  9. I guess I am the only one who came here to share my very own experience. Guess what!? I am using my laptop for almost the past 2 years, but I had no idea of solving some basic issues. I do not know how to Download All Crack Software's For Free Here But thankfully, I recently visited a website named Crackroom

    CorelDRAW Graphics Suite Crack

    ReplyDelete