Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Powershell & Corel Draw?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 11-20-2007   #1 (permalink)
Barry S.
Guest


 

Powershell & Corel Draw?

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?

Thanks.


__________________
Note: To reply, replace the word 'spam' embedded in return address with 'mail'.

My System SpecsSystem Spec
Old 11-20-2007   #2 (permalink)
Marco Shaw [MVP]
Guest


 

Re: Powershell & Corel Draw?

Barry S. wrote:
Quote:

> 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'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
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 11-21-2007   #3 (permalink)
Marco Shaw [MVP]
Guest


 

Re: Powershell & Corel Draw?

Barry S. wrote:
Quote:

> 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


--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 11-21-2007   #4 (permalink)
Oisin Grehan
Guest


 

Re: Powershell & Corel Draw?

On Nov 20, 1:41 am, Barry S. <n...@xxxxxx> wrote:
Quote:

> 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?
>
> Thanks.
>
> __________________
> Note: To reply, replace the word 'spam' embedded in return address with 'mail'.
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
http://filext.com/file-extension/CDR ; this tells me that the ProgIDs
are:

CDraw4
CorelDRAW.Graphic.8
CorelDRAW.Graphic.9
CorelDRAW.Graphic.10
CorelDRAW.Graphic.11

ProgIDs 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.Graphic

hopefully this doesn't give an error, and if so, next thing is to try:

ps> $cdr | get-member | more

This 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



My System SpecsSystem Spec
Old 11-21-2007   #5 (permalink)
Barry S.
Guest


 

Re: Powershell & Corel Draw?

On Wed, 21 Nov 2007 09:52:16 -0400, "Marco Shaw [MVP]"
<marco.shaw@_NO_SPAM_gmail.com> wrote:
Quote:

>Barry S. wrote:
Quote:

>> 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.

__________________
Note: To reply, replace the word 'spam' embedded in return address with 'mail'.
My System SpecsSystem Spec
Old 11-22-2007   #6 (permalink)
Shay Levi
Guest


 

Re: Powershell & Corel Draw?

I used to automate such tasks with Adobe's Photoshop though never started
to do it in PowerShell.
If you're familiar with Photoshop then you can find its scripting guide inside
its installed folder under
C:\Program Files\Adobe\Adobe Photoshop [version]\Scripting Guide.

Photoshop's Scripting Guide supports COM scripting VBScript,JScript,AppleScript
and has a help file for each scripting langauge as well
as script examples.


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com


Quote:

> On Wed, 21 Nov 2007 09:52:16 -0400, "Marco Shaw [MVP]"
> <marco.shaw@_NO_SPAM_gmail.com> wrote:
>
Quote:

>> Barry S. wrote:
>>
Quote:

>>> 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.
>
> __________________
> Note: To reply, replace the word 'spam' embedded in return address
> with 'mail'.

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
RE: Corel GuideMenu won't run buddy Vista installation & setup 0 06-14-2008 07:35 AM
Corel 11 old updates Peter R Vista mail 2 05-09-2008 12:17 AM
RE: Corel GuideMenu won't run Aad den hartog Vista installation & setup 1 04-04-2008 04:57 PM
Corel Draw 12 setup problem Jan Krohn Vista General 3 02-07-2007 05:22 AM
Corel Draw X3 won´t start Santos Vista General 6 10-21-2006 01:38 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51