Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Simple no dialog artboard Save For Web script

Participant ,
Jun 28, 2019 Jun 28, 2019

Hi, recently I was graciously helped on the Photoshop forum with this script. It showed me that with what I know about JavaScript, I could modify and possibly build some of my own scripts. I have always found the Save For Web dialog to be great. However the going into the options each time is not my favorite thing, especially when I am doing it a lot throughout the day. I always export the same way. I looked around for a script to use Save For Web in a more automated way and sure enough it was out there. This script allows me to do exactly what I want to do. I even could figure out ways to modify it for other formats (it does png I changed to jpg). So now for my real question and why I am in the Illustrator forum. Does anybody have a simple script like the Photoshop one that does Saves For Web for exporting of a single Illustrator artboard? I have seen some of the robust ones, and they are great. However, I want a simple one like the Photoshop script I show. I need it to not interact with a dialog. That way I can automate it with Directory Opus (Windows Explorer replacement). If anybody has or can whip one up, I would appreciate it. If anybody wants me to share how I automate the Photoshop script with Directory Opus just shout. Thanks

TOPICS
Scripting
2.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Jun 28, 2019 Jun 28, 2019

there are a few ways to export in illustrator, some work better than others depending on the needs

// https://forums.adobe.com/thread/2634256

var idoc = app.activeDocument;

var destPath = "~/Desktop/myExportTest.png"; // save to desktop

var resolution = '72';

var bounds = idoc.artboards[0].artboardRect; // export the whole artboard

exportFileToPNG24 (destPath, resolution, bounds);

function exportFileToPNG24 (destPath, resolution, bounds) {

var fileSpec = new File(destPath);

    var captureOpts = new ImageCaptureOptions; // declare capture options, needed to trun on anti-alias

    captureOpts.matte = false; // to give transparent areas some color. default is white.

    captureOpts.antiAliasing = true; // anti-alias the image

    captureOpts.transparency = true;

    captureOpts.resolution = resolution; // higher resolutions take longer to save!!!!

    app.activeDocument.imageCapture (fileSpec, bounds, captureOpts); // capture the selection

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 30, 2019 Jun 30, 2019

That is exactly what I was looking for.  I have modified it to grab the current Artboard by name. This is super helpful. Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jan 29, 2020 Jan 29, 2020

Well Illustrator really lacks on export methods and options. Illustrator lacks many options Photoshop does have, atleast for scripting it does.

 

Also would be nice if we finally could get the "save screens" options to be available for scripting. Seems Adobe is sleeping or there scripting projects is in the fridge. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2019 Jun 29, 2019

Have you looked at the Asset Export workflow? You can export Art Boards or Assets to multiple resolutions from that one export, even renaming if you like. Think about it, maybe it is enough. Collect assets and export in batches

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 30, 2019 Jun 30, 2019

Yes, I think it is great in many ways. However, my workflows these days has me avoiding navigation to save directories and dialogs (too many throughout the day). I rely on Artboards because the Asset Export Panel has never provided a way to export with a clipping mask. I don't know why Adobe has not given lots of users their request. The way I will use a script like this is very quick and efficient. Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 30, 2019 Jun 30, 2019

The asset export can also export based on artboards.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 01, 2019 Jul 01, 2019

Yes fully aware that it can. Thanks so much

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 05, 2019 Jul 05, 2019

Hi there,

Thanks for reaching out. Moving this discussion to Illustrator Scripting​ community so that you can get some responses from our scripting experts.

Regards,

Srishti

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jan 29, 2020 Jan 29, 2020
LATEST

@srishtib8795206

when is save for screens going to be added to scripting?

illustrator scripting feels like a dinosaur!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines