Skip to main content
Inspiring
June 7, 2019
Question

How to close Illustrator when export is finished?

  • June 7, 2019
  • 1 reply
  • 460 views

Hello,

I am exporting a file as an SVG to a network share location.

After calling the exportFile and close function, if I add app.quit(), the file is not completely exported and has a file size of 0;

If I omit this line, everything works fine.

How do I check that the file has comlpetely finished exporting, and then close Adobe Illustrator?

The sizes vary, so a constant timeout value likely would not work.

Below are the relevant lines in the code:

sourceDoc.exportFile(targetFile, ExportType.WOSVG, options);

sourceDoc.close(SaveOptions.DONOTSAVECHANGES);

app.quit(); // causes the file to have 0 file size.

This topic has been closed for replies.

1 reply

renél80416020
Inspiring
June 8, 2019

Salut!

essayer: la propriété saved de l'objet Document

boolean Si la valeur est true, le document n’a pas été modifié depuis le dernier enregistrement.

faire tant que saved

elleere

ou encore

eof

Booléen Si la valeur est true, la position courante suite à une tentative de lecture est située après la fin du fichier, ou le fichier n’est pas ouvert. Lecture seule.

while (!targetFile.eof) {

        //boucle facultative

      }

      if (targetFile.eof) {

        app.documents[0].close(SaveOptions.DONOTSAVECHANGES);

        app.quit();

      }