I would either focus on vanilla JS or ECMA 3 (I think ExtendScript stops at JS ECMA 3 or is based off of that with their own twist (usually the .jsx (although the front end guys may think it's a React script) extension)If it were me, I would go to https://stackoverflow.com/
That's because of MS and their being behind TS as well as Co-Pilot I would imagine. But that's me speculating.my unix (sco 5 & redhat 7 +8) programmer tried an experiment the other day and asked copilot to
write him a couple scripts. SURPRISINGLY, he found that he only had to "touch up" the finished
product a bit to make it usable
Yes, illustrator.What generally, or specifically, are you trying to do? Is this in Illustrator?
Are you just selecting a text, outlining it and creating a bounding box .1" past to make weeding easier?Yes, illustrator.
Think I got it worked out. Bounding box of text is different than if the text is outlined. So script to outline text first then do the rest.
WeedLines.jsx
// Check if there are any selected objects
if (app.selection.length > 0) {
// Group the selection first
app.executeMenuCommand("group");
app.executeMenuCommand("outline");
var selectedItems = app.selection;
var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
// Calculate the combined bounding box of the grouped shapes as a whole
for (var i = 0; i < selectedItems.length; i++) {
var item = selectedItems;
var bounds = item.visibleBounds;
minX = Math.min(minX, bounds[0]);
minY = Math.min(minY, bounds[1]);
maxX = Math.max(maxX, bounds[2]);
maxY = Math.max(maxY, bounds[3]);
}
// Increase the bounding box width by 0.1 inch and height by 0.1 inch (converted to points, where 1 inch = 72 points)
var widthIncrement = 0.1 * 72;
var heightIncrement = .1 - 72 / 2; // Correct height increment
minX -= widthIncrement / 2;
maxX += widthIncrement / 2;
minY -= heightIncrement /2; // Decrease minY to extend downward
maxY += heightIncrement /2; // Increase maxY to extend upward
// Create a new layer for the rectangle and lines
var layer = app.activeDocument.layers.add();
layer.name = "Rectangle and Lines";
// Create the rectangle with increased dimensions
var rectangle = layer.pathItems.rectangle(maxY, minX, maxX - minX, maxY - minY);
rectangle.filled = false; // No fill
rectangle.stroked = true;
rectangle.strokeColor = app.activeDocument.swatches.getByName("Black").color;
// Create the vertical line segment
var verticalLine = layer.pathItems.add();
verticalLine.setEntirePath([[minX + (maxX - minX) / 2, maxY], [minX + (maxX - minX) / 2, minY]]);
verticalLine.stroked = true;
verticalLine.strokeColor = app.activeDocument.swatches.getByName("Black").color;
// Create the horizontal line segment
var horizontalLine = layer.pathItems.add();
horizontalLine.setEntirePath([[minX, minY + (maxY - minY) / 2], [maxX, minY + (maxY - minY) / 2]]);
horizontalLine.stroked = true;
horizontalLine.strokeColor = app.activeDocument.swatches.getByName("Black").color;
// Ungroup the selection at the end
app.executeMenuCommand("ungroup");
// Deselect everything
app.selection = null;
}
While AI has it's issue that make it not quite the shiny best thing out there, it depends on the language as well. JS/TS are the most written about (and I do believe JS, maybe not TS, is the most popular language out there, it swaps with Python some years(I don't actually like either, but to each their own) languages so there are tons of sites to scrape for the info (might be a little harder since this is scripting within a specific program(s) (may have to mention that this is for the Adobe "runtime" and not necessarily for Node, Deno, Bun, SpiderMonkey or V8 etc (while there is a lot listed there, not much difference between them outside of who controls what))), that contributes to how "great" it is.AI is great for code... IF you can read the code.
Yes, this is to make weeding easier.Are you just selecting a text, outlining it and creating a bounding box .1" past to make weeding easier?
Is it adding additional vertical / horizontal lines based on a specific criteria?
Yeah, I much prefer Corel but when I point out that corel can do something by way of a macro that illy cannot I would like to be able to present the same in script format. Plus I like to dabble with scripting.So, I'm all for free, and diy, and scripting, and ai, but what's with the focus on Illustrator? I thought you were a corel kid?
copilot seems to have been spawned by the same people who gave us BING with a little bit of EDGE thrown in.Use chatgtp. Feed it the code, tell it what it's doing wrong and it'll likely fix it ... I find it works better than co pilot.
AI is great for code... IF you can read the code.
I see. I thought you'd been forced into illy for some reason and had been trying to get the same functionality out of it.Plus I like to dabble with scripting.
copilot seems to have been spawned by the same people who gave us BING with a little bit of EDGE thrown in.
ME(aka Mistake Edition). Although I will maintain Win98(not SE) was the pinnacle that they had ever done for the DE experience. But that is just me.anyone who remembers WINDOWS MILLENIUM will be able to follow my thought process on this
That's the "G" version. I don't like "AI" at all (basically just a web scraper right now) and it's level of abstraction is really going to just make people lazy and not critically think. Even with the 1st generation of users, that have best chance of knowing what is being abstracted away and to be able to handle if something goes wrong or it goes offline (which has happened quite a bit) is having a hard time dealing with those downturns. I don't have much hope. Particularly when those are just going to be taught the abstraction and not what is underneath the abstraction. Don't have to go without or avoid it, but knowing what's going on under the hood will time to time come in handy, but I digress.I'm worried we are only going to be teaching kids like mine how to ask chatgpt the right questions for the right answers...)