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
No Data
Reply
  • Are you determined to do it using JavaScript? VBA still works in 2019.

    Would you be willing to share what your goals are? Is it primarily about being able to perform this specific task in CorelDRAW, or is there a significant aspect of wanting to learn more about programming to achieve automation in CorelDRAW?

    Some people are very interested in creating "one click" solutions, and that can save a lot of time if it's a task that one has to perform very, very often. If it's not something that I have to do very, very frequently, I may be satisfied to get it down to a "few clicks" solution using more general macros and/or regular CorelDRAW tools.

    Here's a video where I:

    1. Select everything.
    2. Run a macro that "filters" the selection to leave only text objects selected.
    3. Use another macro to scale each text shape horizontally by 400%, leaving each shape at its original center position.
    4. Set the text shapes to be center justified using regular CorelDRAW tools.

    VIDEO: AORP_asymmetric_scaling

    .

Children