How to Write "Save As" Script

New Here ,
Jan 28, 2020 Jan 28, 2020

Copy link to clipboard

Copied

I am fairly new to Illustrator (less than 6 months) but I have managed to teach my self the basics to do what I need to do. I complete checking and minor editing of about 100 illustrator files a week for a client of mine, each of which needs to be saved in 5 differnt formats. Currently I am using the commands SAVE, SAVE AS, and SAVE FOR WEB (x3) to save the files in the original folder and to overwrite the existing file in there (all formats already exist in the original folder). I have done some research and belive that this process could be done automatically using a script. I have also tried to understand the coding language but it honestly goes right over my head. Can any one provide any assistance as to how I could write a script to do all the saving or possible point me in the direction of a simialr script that could be modified to suit my needs? Thanks in advance for any help.

TOPICS
How to, Import and export, Scripting

Views

902

Likes

Translate

Translate

Report

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 Professional ,
Jan 28, 2020 Jan 28, 2020

Copy link to clipboard

Copied

There are some snippets you can use...

 

//save as
var f = New File("-/Desktop/saveAsFileName.ai");
app.activeDocument.saveAs(f);

//save for web
var doc = app.documents[0];
var assets = doc.assets; 
var expOptions = new ExportForScreensItemToExport();
expOptions.artboards = 'all';
expOptions.document = true;
var jpegParam = new ExportForScreensOptionsJPEG();
jpegParam.compressionMethod = JPEGCompressionMethodType.PROGRESSIVE;
jpegParam.antiAliasing = AntiAliasingMethod.None;
jpegParam.embedICCProfile = true;
jpegParam.scaleType = ExportForScreensScaleType.SCALEBYFACTOR;
jpegParam.scaleTypeValue = 3;
var fdr=new Folder("~/Desktop/exportFolder/");
doc.exportForScreens(fdr, ExportForScreensType.SE_JPEG80,  jpegParam, expOptions, "JPEG80_");

 

 

Likes

Translate

Translate

Report

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
Enthusiast ,
Jan 29, 2020 Jan 29, 2020

Copy link to clipboard

Copied

@Ten A

 

can i ask where you got these references from. Ive been searching for this for hours. This is not in their own official documentation. The latest scripting guides are from cc 2017 and basically have dinosaur code in them 😞

Likes

Translate

Translate

Report

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 Professional ,
Jan 29, 2020 Jan 29, 2020

Copy link to clipboard

Copied

You can find the latest references in adobe.io. However, exportForScreens not documented.

If you can use ESTK, You can refer Object Model Viewer. However, the first arg is a Folder object.

スクリーンショット 2020-01-30 9.36.09.png

Likes

Translate

Translate

Report

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
Enthusiast ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

Where can i find this ESTK, this is old right?

Likes

Translate

Translate

Report

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
Enthusiast ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

I foudn it here, i already had i seemed. i was using estk for search, that didnt work

 

https://github.com/Adobe-CEP/CEP-Resources

 

I do wonder now i can get more info to show as your screenshot does. I see you have illustrator 24, mine shows 25

 

EDIT

i found it, its a bit in riddle form as usual. Still dont see the how we can set real width and height as the export for screen dialog shows.

Likes

Translate

Translate

Report

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 Professional ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

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
Enthusiast ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

Thanks! i wasnt sure who would respond, so i search further.

 

One thing i noticed with that OLD ESTK tool, on OSX i dont see that search function the window variant has. Also after a restart i wont load anymore. I remember this issue from quite a while back. But installed it again today, it started and after that it simply quits. Perhaps it due to me having VIsual Studio code open, i havent tried that yet. 

Likes

Translate

Translate

Report

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 Professional ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

that's correct, VS needs to be closed for the ESTK to work

Likes

Translate

Translate

Report

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
Enthusiast ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

LATEST

ahhh i was thinking that this afternoon, thanks for the confirmation. Will try that tomorrow

Likes

Translate

Translate

Report

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