I'm downloading a 15-day trial right now to see what it has to offer if
I can get something going quickly.It certainly sounds possible. What is likely happening is Corel's DLLs
implement a COM interface, which PowerShell can usually interact with.There can be some problems though.On the other hand, the fact that System.Reflection.Assembly can be used
would seem to indicate that it is a .NET library. In the latter case,
PowerShell support would be more better.Marco--
Microsoft MVP - Windows PowerShell
MVP
:
I downloaded a 15-day trial.You're right there: *lots* of DLLs!!I went searching on DNR TV and didn't notice anything related to Corel.I can't promise anything as it looks like I'd need to do a lot more
searching.
Hi Barry,It might help somewhat to explain what it is you really want to do,
but anyway I'd take an educated guess that you want to create vector
drawings via powershell, and that you don't really want to extract the
"functions" alone; if this is the case, Corel Draw supports OLE
automation and built-in VBA scripting, much like the applications in
the ms office suite. The one thing that Corel Draw doesn't appear to
have though is a "primary interop assembly" which is a kind of middle-
man layer that smooths the rough edges of COM and .NET interoperation.
MSOffice provides PIAs which is why it's relatively easy to script
Word and Excel etc with Powershell. Any application that supports this
kind of scripting will usually end up exposing a rich COM api, which
you may be able to get at. So.. what's next?I know that the file extension for corel draw files is .CDR - so the
next thing I did was look up some information on this at
-extension/CDR ; this tells me that the ProgIDs
are:CDraw4
CorelDRAW.Graphic.8
CorelDRAW.Graphic.9
CorelDRAW.Graphic.10
CorelDRAW.Graphic.11ProgIDs are kinda like aliases for COM objects. Next, typically you
want to drop the number suffix and just use CorelDRAW.Graphic. This is
usually aliased to the latest version. So, next step:ps> $cdr = new-object -COM CorelDRAW.Graphichopefully this doesn't give an error, and if so, next thing is to try:ps> $cdr get-member moreThis will show all of the methods and properties on the Corel Draw
object that you can manipulate to create your vector drawing. At this
point, you can refer to your Corel VBA help to work out how to use
these methods (cos I haven't got Corel installed).Hope this helps,- Oisin
>Barry S. wrote:
>> CorelDRAW has a fairly extensive collection of VBA functions. Is
>> there a way to import the methods exposed for VBA in Powershell? I
>> recall in a DNR TV episode they used System.Reflection.Assembly to
>> load a DLL and then use its methods. Can I do something similar with
>> CorelDRAW's DLLs?
>>
>> CorelDRAW has lots of DLLs, is there a base library to start from?
>
>I downloaded a 15-day trial.
>
>You're right there: *lots* of DLLs!!
>
>I went searching on DNR TV and didn't notice anything related to Corel.
>
>I can't promise anything as it looks like I'd need to do a lot more
>searching.
Marco Shaw: The DNR TV webisode was related to accessing functions in
a DLL for use in powershell. (Nothing Corel specific.)Oisin Grehan: You nailed it. Treat as COM and refer to VBA
reference. My goal is to see if I can automate a few common tasks..
(e.g. open file, insert text filename at x,y, insert vector graphic at
x,y, export as jpg at a given resolution w/ custom compression
settings. x 2000 files)Photopaint, the CorelDRAW eqivalent has a relatively simple scripting
language (CorelScript) that works pretty well, but CorelDRAW has
COM/VBA and I just get lost in the VBA details. Thanks guys.