Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
Running a script on all .ai files in a directory

I'm a graphic designer and a beginner at coding. So please dumb down for me :)

I have a script that I run through Illustrator. It embeds an image and removes a clipping mask on the file. I need this script to run on multiple .ai files in a folder.

The thing is, I cannot create a batch action (in Illustrator) to run the script. Our IT guy doesn't want to add the script to our Illustrator settings on multiple accounts. Is there a way to add code to my script to do this?

I need it to open all the files, run the script and save. The files can be left open on Illustrator, no need to close.

What code do I need to add to my script?

I am on a Mac not PC.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It can be done this way:

function my_script() {

    // copy a full text of your script here

    // or include the jsx file this way:
    # include '~/Desktop/script/my_script.jsx'

}

function main() {

    var folder = Folder.selectDialog('Please, select the folder');
    if (!(folder instanceof Folder)) return;

    var files = folder.getFiles('*.ai');
    if (files.length == 0) {
        alert('Folder doesn\'t content AI files');
        return;
    }

    var i = files.length;
    while (i--) {
        var doc = app.open(files[i]);
        my_script();             // <------- here your script is running
        doc.save();
        doc.close();
    }

    alert(files.length + ' files were processed');
}

main();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!