Looking to rebuild a macro for stretching texts

My old desktop (running 2017 version) had a working VBA macro that I created to isolate all text base items and stretch them 16x wide (height remained the same) and set them to center alignment.  This would not affect curves.  

The hard drive died and I've been trying to recreate this functionality on 2019 using the javascript however it's been difficult.

Here's the Script that I've been working on:

var i;
var data = "Test";
for (i = 1; i < 3; i++) {

host.ActiveDocument.AddToSelection(host.ActiveLayer.Shapes.Item(i));

if (typeof host.ActiveSelection.type == "number") {
data = typeof host.ActiveSelection
let s1 = host.ActiveLayer.CreateArtisticText(10.515937007874, 6.44105118110236, data);

host.ActiveSelection.Stretch(16,1);

}

host.ActiveDocument.ClearSelection();
}

The stretching seems to be working and the for loop is going through objects (wish I could isolate this to just text).  I don't know how to center justify them either.

Any help would be appreciated.

Thank you,

Jayson  

Parents Reply
  • VBA would be fine as well, although I haven't been able to access Visual Studio Editor (lacking software on the new computer).  I've been thinking about requesting the necessary programs to IT, but it will take a few days.

    If you want to use VBA stuff, you should be looking for "Visual Basic for Applications" in the Scripts docker. That's included with CorelDRAW. See my blog post, #1: Getting started with using VBA macros (What do you do with a .GMS file?) for a little bit of information on what you should see in the docker, where .GMS files can be located, etc.

    I don't currently have on my blog the macros that I used in that video. If you contact me through the forum messaging system, and provide me with an e-mail address, we can take it from there to get you something you can try.

Children
No Data