Copy link to clipboard
Copied
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();
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
Copy link to clipboard
Copied
For Windows paths, make sure to escape the backslashes like so: "\\"
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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"
Copy link to clipboard
Copied
I can't see why the dialog would appear as a result of this command, but you can try to turn off dialogs via app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
Copy link to clipboard
Copied
Strange.. it has no effect!? Reading up on it sounds like exactly what I need.
Mmmm... would you mind running the script and see if the dialog window opens on your pc? I am gonna try on my main oc when I get home.
Copy link to clipboard
Copied
Maybe make sure your destination path really exists, because it seems to be working for me with no problem. However, I set my destination path to some folder on my desktop and not at the root.
Copy link to clipboard
Copied
Please try:
var destFile = new File("/d/Test/SOCAL_CN68_resx.tif");
Have fun
Copy link to clipboard
Copied
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();
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
That did it my friend! A big thanks to all!