Skip to main content
Inspiring
October 2, 2017
Answered

Export File as TIFF... no file saved

  • October 2, 2017
  • 1 reply
  • 2897 views

Could someone take a look at my script and see if you can get a file to be saved as a TIFF?  VBscript is my main language so maybe I missed something in JavaScript.  The script will run... I see an AI progress window open 'writing TIFF file", no error messages but then no file is saved?

function test(){ 

     var doc = app.activeDocument; 

     var opts = new ExportOptionsTIFF();

     var destFile = new File("C:\TIFF Test\SOCAL_CN68_resx.tif");

     var type = ExportType.TIFF;

          opts.resolution=72;

          opts.imageColorSpace.Grayscale;

          opts.AntiAliasing=AntiAliasingMethod.ARTOPTIMIZED;

          opts.IZWCompression=false;

          opts.artboardRange="1";

     doc.exportFile(destFile, type, opts);

test();

This topic has been closed for replies.
Correct answer pixxxelschubser

So with further testing I was able to export a TIFF (thanks pixxxel schubser for the forward slash suggestion), and I don't even need the "DONTDISPLAYALERTS" as well.

But now I see none of the options are being used.  Been trying all together and one at a time.

Here's my latest version using paths I would typically use:

function test(){

    var doc = app.activeDocument;    

    var destFile = new File("/S/SOCAL/Section_32/Light TIFFs/SOCAL_CN68_resx.tif");

    var type = ExportType.TIFF;

    var opts = new ExportOptionsTIFF();

        opts.imageColorSpace.Grayscale;

        opts.resolution=72;

        opts.AntiAliasing=AntiAliasingMethod.ARTOPTIMIZED;

        opts.IZWCompression=false;

        opts.artboardRange="1";

    doc.exportFile(destFile, type, opts);

    } 

test();


There are some typos:

function test(){

var doc = app.activeDocument;

var destFile = new File("/d/Test/SOCAL_CN6811_resx.tif");

var type = ExportType.TIFF;

var opts = new ExportOptionsTIFF();

opts.imageColorSpace = ImageColorSpace.GrayScale;

opts.resolution=144;

opts.antiAliasing=AntiAliasingMethod.ARTOPTIMIZED;

opts.lZWCompression=false;

opts.saveMultipleArtboards = true;

opts.artboardRange="1";

doc.exportFile(destFile, type, opts);

}

test();

Have fun

1 reply

Silly-V
Legend
October 3, 2017

For Windows paths, make sure to escape the backslashes like so: "\\"

Inspiring
October 3, 2017

Ah, that helped but now a new issue, an AI Export window appears.  I need to be able to just save with my options without user interaction. 

Inspiring
October 3, 2017

FYI - Don't know if this makes any difference but I am running the JS thru a VBscript like so:

Set App = CreateObject("Illustrator.Application")

Set FSO = CreateObject("Scripting.FileSystemObject")

App.DoJavaScriptFile "C\SaveAsTIFF.js"