Illustrator Scripting

So I’m a really big automation nerd. It permeats everything I attempt to do. I get tired of doing the same things over and over, and so I find myself reaching for whatever tools I can find to eliminate toil!

Recently, I’ve been doing some slate coasters. Nothing production-grade, but enough that every little increase in speed helps a lot. So one of my biggest frustrations is once I’ve made a nice jig, and I want to take a single piece of artwork and align it vertically and horizontally within each jig. It was a pain, and not even duplicating and holding Shift to ensure I’m translating in straight lines could fix my pain.

So I crafted a little illustrator script that does it for me!

CleanShot 2023-10-16 at 14.32.40

Then I got even wilder and wrote a script that then removed that artwork and put my jig back in a pristine state. And finally I got frustrated with writing everything in ES3 syntax (Hello Internet Explorer 11)—and made an entire build pipeline so that I can write my scripts in re-usable, modern ES6 syntax and ship those scripts directly into Illustrator.

The resulting workflow is amazing. I can make some tweaks, click my custom Action to trigger my script, and view the results. Literally just tabbing back and forth between my editor and Illustrator.

And finally, the last piece that was really bothering me was the fact that anytime I wanted to upload my beautiful, robot-crafted design to Glowforge, I had to go to File > Export as… > SVG > SVG Options > Save > “Yes, I’m sure I want to override that other SVG with the same name” > Ok

So I crafted a final script to save the proper artboard directly as an SVG with all the proper options already pre-defined. You can bet the next step will be utilizing some sort of automation to automatically upload this SVG into a “New” glowforge app window so I don’t even have to click the “Upload” button in the UI :wink: Coming Soon™

Anyway, the whole point of this post was to share some automation ideas I’ve been playing around with. This is only scratching the surface and I’m excited to really streamline my workflow for maximum velocity!

21 Likes

Nice share. Two years is a long time to stay away. Don’t be such a stranger.

10 Likes

Ahh, if you’re referring to the time since the last time I logged into the community—you’re right. I had my glowforge stuck in a closet due to some living situation stuff. But we’re back now!

10 Likes

First of all, welcome back to the forum! Secondly, not being a technical person at all anymore (I used to be somewhat of a techno nerd many, many years ago), most of what you said went over my head, but it reminded me of when I used to do some pretty complex macros in WordPerfect, and had learned other things like programming is DOS (yes, THAT long ago!).

I worked for a busy mining attorney and had to log every call and fax, in and out, and found that using macros was the best way to pull in the time, caller, their info, etc., whether the calls had been answered, etc. They used to just handwrite all the info in little books before I got there. And I had never even heard of WordPerfect either - something I learned on the job. Anyway,I printed out the log every day and we kept them in notebooks. You could go back 6 years that I worked there and find on any given day what had happened. Which worked out really well when we had a case go to court and the opposing attorney kept stating how often he’d called or faxed and never had a response. My boss pulled out several logbooks and showed them to the judge. The judge flipped through them, looked at the dates when the other attorney said he’d contacted our office, found nothing, and told the guy, “There is absolutely no way you contacted their office. The notes going back for years show such detail, and there is no way they would’ve ‘altered’ them just to take your info out, that I cannot believe you.” We won the case. I got a big bonus too!

And all because I got tired not only of handwriting everything down (if I can’t do it in shorthand or type it, it’s not happening!) and needed to find a better way to make the mundane task quick and efficient. The State Supreme Court even started using my system!

So thanks for sharing your steps on this! Looking forward to hearing soon that you’ve accomplished the automatic upload! And don’t stay away so long - show us some of your projects you’ve been working on!

10 Likes

It sounds like we’re kindred spirits in that regard! That’s amazing that you actually won a court case based on your automations! That is so rad.

Despite most of my techno-babble—you’re absolutely right, it’s basically just low-level macros. I use certain item names to distinguish what the “role” of that item is (such as “jig”) and then I just copy, align, and group some other items based on that. It’s actually simple enough to explain in English, it’s just quite tedious!

Since you insist—here’s some of the stuff I’ve been working on recently. Primarily slate coasters, but also some anodized aluminum as well!

(The astute observer may notice a missing piece on the Asgard coaster below, and while I haven’t created a script to solve overlapping shapes, I did find a nifty trick here!)

And the Star Wars coaster is “original” art created by myself and my AI helper Midjourney :grimacing:

17 Likes

Awesome! Thanks for showing some of your work!

Come to think of it, I still use macros, mostly in Excel. I have several Excel workbooks that I keep a pic of all my Glowforge files in, so I know what I have and where they come from. I use macros to copy and paste the photos and resize them to fit in my little squares in my pages. Ooh - and I just realized a can make another macro to automatically format a new sheet in the workbook so I don’t have to do so much copying and pasting formats! Sweet!

7 Likes

Thanks for sharing! I’m all for things that make life easier in the long run!

4 Likes

I love great automations, nice work!

Regarding this tho

You don’t actually need to do this - you can either copy/paste directly from AI to GFUI or save your file in native AI .pdf instead of .ai and upload that.

7 Likes

Slate is a favorite material. For something exposed to moisture, or outdoors - if you laser it in slate it’s forever.
Nice work, and welcome back!

7 Likes

Nice! I am automating this response now! Great job on that!

6 Likes

Oh wow—my mind is officially blown. And this is amazing—because it turns out there’s a TON of bugs related to saving SVGs in Illustrator, mostly related to trying to script that workflow out. This has streamlined my workflow even more. Thank you!

4 Likes

I’ve really enjoyed working with it! So far I’ve just done vector stuff, but I’ve been watching some videos on getting nice greys using Imag-r to etch raster images.

4 Likes

Very cool! My husband has been working in automation for 15 years and I cannot begin to count the number of things he has improved for me over that time. This all overflows into real life as well. For instance. he constructed a special vacuum system for me to clean my animal cages that meant everything goes straight into the trash bin that wheels out to the street. No dumping and emptying the shop vac. He made scripts for me to make my photos for my website, spreadsheets into folders, spreadsheets into forms for customers to sign… he even made me a cool custom “Concentration” game when I worked at the Apple Store where you had to match an employee’s photo with their name to learn who everyone was (we had 175 employees, I thought it would be a fun way to help new people learn everyone’s names). Automation is the future and this is a neat thing you’ve figured out how to do!!

6 Likes

Your husband and my sister could likely geek out over scripts and macros for days!

3 Likes

This topic was automatically closed 32 days after the last reply. New replies are no longer allowed.