OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-11-2004, 00:37
tacarey
Guest
 
Posts: n/a
Default Automating CorelTrace

I am looking for a batch method for implementing CorelTrace 12 to make it more efficient to process a lot of files at once.

Corel says there is no command line for Trace. Does anyone know of a vba/script tool that will automte converting a few hundred files?

thanks
Reply With Quote
  #2  
Old 11-11-2004, 09:46
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Currently, there is no VBA for Trace in version 11. I'm not sure about 12, since my boss is too cheap to upgrade. You can always keep requesting it from Corel. I'm sure they'll implement it one day.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #3  
Old 12-11-2004, 16:50
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Trace Automation

I had some time last night to look at this. The answer I came up with was a maybe. (Depends how much hair you have to pull out.) I think you could automate a batch Trace, but it wouldn't be the most stable thing in the world. This is due to the fact it is hard to tell when the trace window is open and if the trace has completed, not to mention the whole thing is being done with SendKeys. But hey, it is fun to play with. Here is a little test code to get you started. It does the following:

1. Takes your ActiveSelection and converts to a B/W bitmap.
2. Sends that Bitmap Corel Trace
3. Traces Bitmap
4. Closes Trace and returns Trace Results to CorelDraw
5. Deletes the Bitmap leaving you with just the Trace results.

Code:
Sub AutoTrace()

Dim PauseTime, Start, Finish
Dim Selection As ShapeRange
Dim Bitmap As Shape

'Convert ActiveSelection to a Bitmap for Tracing
Set Selection = ActiveSelectionRange
Set Bitmap = Selection.ConvertToBitmapEx(cdrBlackAndWhiteImage, False, False, 300, cdrNormalAntiAliasing, False)

Bitmap.CreateSelection

'Open CorelTrace 12
SendKeys "%B", False
SendKeys "{DOWN 2}", False
SendKeys "{ENTER}", True

'Create a Pause to wait for CorelTrace to Open
PauseTime = 10    ' Set duration.
Start = Timer    ' Set start time.
Do While Timer < Start + PauseTime
    DoEvents    ' Yield to other processes.
Loop
Finish = Timer    ' Set end time.

'Set Focus to CorelTrace 12
AppActivate ("CorelTrace 12"), True

'Zoom to All Objects in CorelTrace
SendKeys "%V", True
SendKeys "{ENTER}", True

'Trace Drawing
SendKeys "%T", True
SendKeys "{ENTER}", True

'Create a Pause to wait for CorelTrace to complete the trace
PauseTime = 5    ' Set duration.
Start = Timer    ' Set start time.
Do While Timer < Start + PauseTime
    DoEvents    ' Yield to other processes.
Loop
Finish = Timer    ' Set end time.

'Close CorelTrace 12
SendKeys "%F", True
SendKeys "X", True
SendKeys "{ENTER}", True

'Delete the Original Bitmap
Bitmap.CreateSelection
Bitmap.Delete

End Sub
If the code Errors out, most likley the timer did not allow enough time for CorelTrace to open or complete the trace, so try increasing these numbers.

Hope it helps a little anyway.
Reply With Quote
  #4  
Old 13-11-2004, 11:18
tacarey
Guest
 
Posts: n/a
Default SendKeys

I haven't thought of SendKeys in a goodly while. Yours is a most interesting approach. I shall give it a whack and see what happens.

Thank
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automating designprocedure Said CorelDRAW/Corel DESIGNER VBA 1 27-05-2004 02:56


All times are GMT -5. The time now is 20:30.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com