Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

replace text with script

100 views
Skip to first unread message

Marius Stuparu

unread,
Nov 5, 2003, 7:32:56 AM11/5/03
to corel.graphic_apps.draw-script

hi!

can anyone help me write a script that replaces all instances of a text with
another text in Corel Draw 11? i am not a VB expert (actually i am not even
a beginner!).
i have tried something like this:
>
> Sub Translate()
> Dim s As Shape
> For Each s In ActivePage.FindShapes(, cdrTextShape)
> s.Text.Replace "oldtext", "newtext", False, ReplaceAll:=True
> ...
> Next s
> End Sub
>
but it hangs Corel or it takes too long to be useful.
the page contains many artistic text items, rectangles and other raster
images.
please help me, i'm desparate! :)
thanks

Georgeann

unread,
Nov 5, 2003, 7:55:32 AM11/5/03
to corel.graphic_apps.draw-script

Use Coreldraw's find and replace text feature already
in Corel. It's under the edit menu - "Replace objects"


"Marius Stuparu" <mari...@sportplus.ro> wrote in message
news:3fa8e942$1_1@cnews...

Marius Stuparu

unread,
Nov 6, 2003, 8:07:01 AM11/6/03
to corel.graphic_apps.draw-script

i noticed that! (duh!)
but i need to automate a job with many words to translate.

"Georgeann" <g...@txpress.com> wrote in message news:3fa8ee7f$1_3@cnews...

Peter Clifton

unread,
Nov 30, 2003, 12:53:55 PM11/30/03
to corel.graphic_apps.draw-script

Marius Stuparu spoke unto the group and said...

> can anyone help me write a script that replaces all instances of a text with
> another text in Corel Draw 11? i am not a VB expert (actually i am not even
> a beginner!).
> i have tried something like this:
> >
> > Sub Translate()
> > Dim s As Shape
> > For Each s In ActivePage.FindShapes(, cdrTextShape)
> > s.Text.Replace "oldtext", "newtext", False, ReplaceAll:=True
> > ...
> > Next s
> > End Sub

Sorry this answer is so late, but I just found out about a couple of
optimization techniques that seem to help with the above function.

First before running the script make sure you reduce the default
application undo buffer of 99 to something much lower, I tested the
following with an undo level of 30 on 1938 text strings in a document.


Sub Translate()

Optimization = True ' turn off screen updates
ActiveDocument.PreserveSelection = False 'ignore last selection

Dim s As Shape
For Each s In ActivePage.FindShapes(, cdrTextShape)
s.Text.Replace "oldtext", "newtext", False, ReplaceAll:=True
...
Next s

Optimization = False ' restore screen updates
ActiveDocument.PreserveSelection = True ' remember last selection
ActiveDocument.ActiveWindow.Refresh ' update drawing window

End Sub


HTH

Peter

0 new messages