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.ActiveSelectionlet 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
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:
VIDEO: AORP_asymmetric_scaling
.
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.
The purpose of the request is I receive diagrams from a 3rd party client and roughly 60% of the time, all text gets squished by a factor of 16. I have to perform engineering changes on these diagrams and put them back in the repository when completed. So when I started I was expanding roughly 200 text items individually for each graphic and a project can easily consist of 30+ diagrams. So this isn't a one-off request, it's a rather necessary function. Alternatively I can scale up all text, but then I have to relocate which is a pain. The Asymmetric scaling is more or less what I truly need.
The attached video looks like the answer I'm shooting for so could I have more information regarding that solution?
Thank you,Jayson
Jayson F said: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.