ai2html icon indicating copy to clipboard operation
ai2html copied to clipboard

Feature request: Option to not modify ai file

Open lajoiemedia opened this issue 2 years ago • 2 comments

There should be an option that causes ai2html to use the settings file exclusively and not modify the original ai file.

This would be useful especially when batch running ai2html.

lajoiemedia avatar Apr 04 '22 13:04 lajoiemedia

This seems like a good suggestion, I'll look into how best to implement it.

I'm curious, how are you batch running ai2html? I've only run it interactively, via the File > Scripts menu.

mbloch avatar Apr 04 '22 16:04 mbloch

I have a node script which runs through all the AI files in a directory and calls something like this:

const child = require("child_process");
const AI2HTML_SCRIPT = "path/to/ai2html.js";

function doConversion(file) {
  try {
    child.execSync(`osascript -e 'tell application id "com.adobe.illustrator"
        activate
        open POSIX file "${file}" without dialogs
        do javascript file "${AI2HTML_SCRIPT}"
      end tell'`);
  } catch(e) {
    console.error(`Failed to convert ${file}`);
    process.exit(-1)
  }
}

This works only on Mac and was lifted from ai2react-loader from AP's Andrew Milligan (https://github.com/andrewmilligan/ai2react-loader/blob/main/src/index.js)

There's a single config file that sits in the directory with all my AI files. I want that config to determine how all the AI files are converted. Unfortunately, if I make a change to that config file, any files that have already run through the process are going to ignore the settings change (because they now have a block which overrides those settings).

lajoiemedia avatar Apr 05 '22 00:04 lajoiemedia