Resize Artboard
How to delete specific layers?
Hi,
I have a large batch of files (100+) that all have the same layer structure. The top layer is called 'Guides', the next layer is called 'Object", the next layer is called 'Shadow' and it goes on down through another 5 layers. I'd like to create a script that will select delete certain layers (eg. 'Guides') before I save out a new file as part of an action. I'm coming from a background in Photoshop, where this could all be done in actions, but appears you can't select layers in Illustrator (please correct me if I'm wrong!).
Any help in creating a script would be most appreciated!
Dave
Split a string into multiple lines based on length
I am allowing the user to input a description. What I am needing is to split up the string they input based on 27 characters.
So if their description is less than 27 characters....
It is a single string and needs to alert them of that.
If their description is more than 27 but less than 54 characters....
I need it to find the space closest to the 27th character, then split the string into 2 lines
If their description is more than 54 but less than 81 characters....
I need it to find the space closest to the 54th character, then split the string into 3 lines
If their description is more than 81 but less than 108 characters....
I need it to find the space closest to the 81st character, then split the string into 4 lines
If their description is more than 108 characters....
Alert that it is really long
Here is a section of code I am working with
for (z = 0; z < theDocVariables.length; z++) { // Start finding variables here if (theDocVariables[z].name == "coverPageDecriptionLineOne") { if (getText(titleDescription).length < 27){ alert("single line"); } if (getText(titleDescription).length > 27 && getText(titleDescription).length < 54){ alert("two line"); } if (getText(titleDescription).length > 54 && getText(titleDescription).length < 81){ alert("three line"); } if (getText(titleDescription).length > 81 && getText(titleDescription).length < 108){ alert("four line"); } if (getText(titleDescription).length > 108){ alert("that's a long freakin description"); } alert("Your title is " + getText(titleDescription).length + " characters in it"); }
Javascript for Illustrator : Copy a document on another specific document issue
Hi,
I've managed to select elements on a source file but it fails when copying. The selection should be copied on targetFile.
There is like 5 to 10 files by sourceFolder (there is an error in opening each file but this is not the matter for now - only the first one is openend)
var targetFile = app.documents.add(); //this is my output file - it works
folder = Folder.myDocuments; //this paragraph works for now
sourceFolder = folder.selectDlg("source");
for ( i = 0; i < files.length; i++ ){
var sourceDoc = app.open(files[i]);
var doc = app.activeDocument;
for (i = 0; i < doc.pageItems.length; i++) {
doc.pageItems[i].selected = true;
}
var mySel = app.activeDocument.selection; //this paragraph need rework
newItem = mySel[0].duplicate(); //mysel.duplicate() is not a function
}
Thanks I copy a document, resize it and place it then I print the output
How to get the start and end points of a line using javascript?
Hi,
I had a line selected in the active document. All I need is to get the starting and ending points of the line. I had tried with 'geometricBounds', but, it couldn't satisfy me. It is just giving coordinates of the rectangular selection.
Am new in this. Thanks in advance.
Illustrator Script: How can I duplicate a layer ( with sublayers ) with javascript code ?
Dear All
I want to duplicate a layer structure, as the "Duplicate Layer" submenu do with Javascript code, but I can't.
I can duplicate only PageItems or selected object, but no Layers.
Anybody knows how can I do it ?
Selecting objects by fill color
Retrieve whats in the clipboard possible?
Is it possible to retrieve whats in the clipboard through a script?
If so how?
Export Action As Script
I have recorded an action on one of my documents in illustrator. I would like to export this action as a file that shows the contents of this action in JavaScript, or, if that's not possible, in any script so I can make some variations to it manually. I've been searching for how to export an action as a script and haven't found any information. If a script file is not possible, is it possible to export some sort of log? Maybe I'm just looking in the wrong places, but any help would be appreciated.
Advanced "Save as PDF" script that saves 2 PDF presets with 2 different names.
Hi Everyone,
I am looking to improve a save as pdf workflow and was hoping to get some direction. Here is the background...
I routinely have to save numerous files as 2 separate PDFs with different settings (a high res printable version and a low res email version). Each file has to be renamed as follows...
Original filename = MikesPDF.ai
High Res PDF Filename = MikesPDF_HR.pdf
Low Res PDF Filename = MikesPDF_LR.pdf
I was able to alter the default "SaveAsPDF" script to save the files to my desired settings and to add the suffix to the name. So with these scripts here is how the workflow operates...
1. Open all files I wish to save as pdfs
2. Select script to save files as high res pdfs
3. Illustrator asks me to choose a destination.
4. Illustrator adds the appropriate suffix and saves each file as a pdf to my desired setting. ("Save As" not "Save a Copy").
5. Now all of the open windows are the new pdfs, not the original ai files.
6. Now I have to close each window. For some reason Illustrator asks me if I want to save each document when I tell it to close window, even though the file was just saved. I tell it to not save and everything seems to be fine.
7. Reopen all the files I just saved as high res pdfs.
8. Repeat the entire process except I run the script specifically designed for the low res pdfs.
What I would like to do is to combine these two processes so that there will be one script that saves both pdfs. From what I understand, the script can't support "Save A Copy" so the workflow would go as follows...
1. Open all files I wish to save as pdfs
2. Select single script to save files as both high res and low res pdfs
3. Illustrator asks me to choose a destination.
4. Illustrator saves each file as a High Res PDF and adds the the "_HR" suffix.
5. Illustrator then re-saves the open windows as a Low Res PDF and replaces the "_HR" suffix with "_LR".
Here is the code for the High Res script, The Low Res script is pretty much the same except for a different preset name and different suffix. Any pointer that anyone could give me would be most appreciated. I am pretty much a noob to this stuff so please keep that in mind.
Thanks!
Mike
---------------------------CODE----------------------------
/** Saves every document open in Illustrator
as a PDF file in a user specified folder.
*/
// Main Code [Execution of script begins here]
try {
// uncomment to suppress Illustrator warning dialogs
// app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
if (app.documents.length > 0 ) {
// Get the folder to save the files into
var destFolder = null;
destFolder = Folder.selectDialog( 'Select folder for PDF files.', '~' );
if (destFolder != null) {
var options, i, sourceDoc, targetFile;
// Get the PDF options to be used
options = this.getOptions();
// You can tune these by changing the code in the getOptions() function.
for ( i = 0; i < app.documents.length; i++ ) {
sourceDoc = app.documents[i]; // returns the document object
// Get the file to save the document as pdf into
targetFile = this.getTargetFile(sourceDoc.name, '.pdf', destFolder);
// Save as pdf
sourceDoc.saveAs( targetFile, options );
}
alert( 'Documents saved as PDF' );
}
}
else{
throw new Error('There are no document open!');
}
}
catch(e) {
alert( e.message, "Script Alert", true);
}
/** Returns the options to be used for the generated files. --------------------CHANGE PDF PRESET BELOW, var NamePreset = ----------------
@return PDFSaveOptions object
*/
function getOptions()
{var NamePreset = 'Proof High Res PDF';
// Create the required options object
var options = new PDFSaveOptions();
options.pDFPreset="High Res PDF";
// See PDFSaveOptions in the JavaScript Reference for available options
// Set the options you want below:
// For example, uncomment to set the compatibility of the generated pdf to Acrobat 7 (PDF 1.6)
// options.compatibility = PDFCompatibility.ACROBAT7;
// For example, uncomment to view the pdfs in Acrobat after conversion
// options.viewAfterSaving = true;
return options;
}
/** Returns the file to save or export the document into.----------------CHANGE FILE SUFFIX ON LINE BELOW, var newName = ------------------
@param docName the name of the document
@param ext the extension the file extension to be applied
@param destFolder the output folder
@return File object
*/
function getTargetFile(docName, ext, destFolder) {
var newName = "_HR";
// if name has no dot (and hence no extension),
// just append the extension
if (docName.indexOf('.') < 0) {
newName = docName + ext;
} else {
var dot = docName.lastIndexOf('.');
newName = docName.substring(0, dot)+newName;
newName += ext;
}
// Create the file object to save to
var myFile = new File( destFolder + '/' + newName );
// Preflight access rights
if (myFile.open("w")) {
myFile.close();
}
else {
throw new Error('Access is denied');
}
return myFile;
}
(JS) Checking if a folder exists
Hi everyone!
I would like to check if a folder exist. I was trying with this code but doesn't work.
I will thank you in advanced if you know a better way to do this.
Best regards_
- Code not working
path = Folder.desktop + "/MyFiles"; var folder = new Folder(path); if(!folder.exists){ alert("Folder doesn't exists"); }else{ alert("Folder Exist"); }
Select an object in illustrator using extendscript
I have a drawn rectangle on an illustrator document. In the layers menu I have given it a specific path name (outerBox). I would like to select this item and return its particular properties eg height, width, colour etc. How would I do this.
Thanks
Bob
launch illustrator with script from commandline
Hi,
(Illustrator CC 2014 on Windows 7)
I had hotkeys defined using AutoHotkey to execute a script in illustrator by executing a commandline, and with the script as an argument. This used to work fine, but it has suddenly stopped working for me, maybe with one of the latest Illustrator CC updates...
The command-line looks something like:
"C:\Program\Adobe\Adobe Illustrator CC 2014\Support Files\Contents\Windows\Illustrator.exe" "c:\pathtoscript\myscript.jsx"
Now Illustrator just sits there and nothing happens!
Has anyone else seen this? Can someone confirm if this worked in previous versions and also confirm that it doesn't in the latest, please?
Thanks!
Add Margins in Illustrator
I have made this little script to quickly add margins to an illustrator document and am posting it here to anyone that might find this helpful.
The script will bring up a dialog where you can enter the sizes. Checking the equal box makes all sizes the same as the first.
You have the option of using Millimetres, Inches or Pixels for your units and a last option to apply to all artboards or just the active one.
The script then adds the guides to a locked layer called 'Margins' for convenience.
There are two versions for your taste- The first creates 4 seperate guidelines. The second creates one rectangle guide.
#target illustrator var docRef = app.activeDocument; var artboardRef = docRef.artboards; var workingLayer = docRef.activeLayer; //window var win = new Window('dialog', "Add Margins"); this.windowRef = win; //panels win.fieldpanel = win.add("panel", undefined, ""); win.radiopanel = win.add("panel", undefined, ""); win.radiopanel2 = win.add("panel", undefined, ""); //panel orientation win.fieldpanel.orientation='row'; win.radiopanel.orientation='row'; win.radiopanel2.orientation='row'; //fieldpanel win.fieldpanel.panel1 = win.fieldpanel.add('panel', undefined, "Left"); win.fieldpanel.panel2 = win.fieldpanel.add('panel', undefined, "Right"); win.fieldpanel.panel3 = win.fieldpanel.add('panel', undefined, "Top"); win.fieldpanel.panel4 = win.fieldpanel.add('panel', undefined, "Bottom"); win.fieldpanel.panel1.left_input = win.fieldpanel.panel1.add('edittext', undefined, "0"); win.fieldpanel.panel2.right_input = win.fieldpanel.panel2.add('edittext', undefined, "0"); win.fieldpanel.panel3.top_input = win.fieldpanel.panel3.add('edittext', undefined, "0"); win.fieldpanel.panel4.bottom_input = win.fieldpanel.panel4.add('edittext', undefined, "0"); win.fieldpanel.panel1.left_input.characters = 5; win.fieldpanel.panel2.right_input.characters = 5; win.fieldpanel.panel3.top_input.characters = 5; win.fieldpanel.panel4.bottom_input.characters = 5; win.fieldpanel.check1 = win.fieldpanel.add('checkbox', undefined, "Equal"); //radiopanel win.radiopanel.radio1 = win.radiopanel.add('radiobutton',undefined, "mm"); win.radiopanel.radio2 = win.radiopanel.add('radiobutton',undefined, "in"); win.radiopanel.radio3 = win.radiopanel.add('radiobutton',undefined, "px"); //radiopanel2 win.radiopanel2.radio1 = win.radiopanel2.add('radiobutton',undefined, "All Artboards"); win.radiopanel2.radio2 = win.radiopanel2.add('radiobutton',undefined, "Active Artboard"); //select first radio buttons win.radiopanel.radio1.value = true; win.radiopanel2.radio1.value = true; //ok button win.okbutton = win.add('button', undefined, "Ok"); //disable fields with checkbox and equal values win.fieldpanel.check1.onClick = function() { if(win.fieldpanel.check1.value){ var leftvalue = win.fieldpanel.panel1.left_input.text; win.fieldpanel.panel2.right_input.text = leftvalue; win.fieldpanel.panel3.top_input.text = leftvalue; win.fieldpanel.panel4.bottom_input.text = leftvalue; win.fieldpanel.panel2.right_input.enabled = false; win.fieldpanel.panel3.top_input.enabled = false; win.fieldpanel.panel4.bottom_input.enabled = false; } else { win.fieldpanel.panel2.right_input.enabled = true; win.fieldpanel.panel3.top_input.enabled = true; win.fieldpanel.panel4.bottom_input.enabled = true; } }; //sync values while checked win.fieldpanel.panel1.left_input.onChanging = function (){ if(win.fieldpanel.check1.value){ var leftvalue = win.fieldpanel.panel1.left_input.text; win.fieldpanel.panel2.right_input.text = leftvalue; win.fieldpanel.panel3.top_input.text = leftvalue; win.fieldpanel.panel4.bottom_input.text = leftvalue; } }; //event listener for ok button win.okbutton.onClick = function(){ var leftvalue = win.fieldpanel.panel1.left_input.text; var rightvalue = win.fieldpanel.panel2.right_input.text; var topvalue = win.fieldpanel.panel3.top_input.text; var bottomvalue = win.fieldpanel.panel4.bottom_input.text; if(win.radiopanel.radio1.value) { var multiplier = 2.834645669291339 } if(win.radiopanel.radio2.value) { var multiplier = 72 } if(win.radiopanel.radio3.value) { var multiplier = 1 } //close window win.close(); //make a margins layer var guideLayer = docRef.layers.add(); guideLayer.name = "Margins"; if(win.radiopanel2.radio1.value) { //repeat for each artboard for(i=0;i<artboardRef.length;i++){ //get artboard size var left=artboardRef[i].artboardRect[0]; var top=artboardRef[i].artboardRect[1] ; var right=artboardRef[i].artboardRect[2] ; var bottom=artboardRef[i].artboardRect[3] ; //create lines var lineLeft = docRef.pathItems.add(); var lineRight = docRef.pathItems.add(); var lineTop = docRef.pathItems.add(); var lineBottom = docRef.pathItems.add(); //set line points var leftmargin = (leftvalue * multiplier); var rightmargin = (rightvalue * multiplier); var topmargin = (topvalue * multiplier); var bottommargin = (bottomvalue * multiplier); //set line points lineLeft.setEntirePath([[left + leftmargin, top], [left + leftmargin, bottom]]); lineRight.setEntirePath([[right - rightmargin, top], [right - rightmargin, bottom]]); lineTop.setEntirePath([[left, top - topmargin], [right, top - topmargin]]); lineBottom.setEntirePath([[left, bottom + bottommargin], [right, bottom + bottommargin]]); //make lines guides lineLeft.guides = true; lineRight.guides = true; lineTop.guides = true; lineBottom.guides = true; }; } else { //get artboard size var activeAB = docRef.artboards[docRef.artboards.getActiveArtboardIndex()]; // get active AB var left = activeAB.artboardRect[0]; var top = activeAB.artboardRect[1] ; var right = activeAB.artboardRect[2] ; var bottom = activeAB.artboardRect[3] ; //create lines var lineLeft = docRef.pathItems.add(); var lineRight = docRef.pathItems.add(); var lineTop = docRef.pathItems.add(); var lineBottom = docRef.pathItems.add(); //set line points var leftmargin = (leftvalue * multiplier); var rightmargin = (rightvalue * multiplier); var topmargin = (topvalue * multiplier); var bottommargin = (bottomvalue * multiplier); //set line points lineLeft.setEntirePath([[left + leftmargin, top], [left + leftmargin, bottom]]); lineRight.setEntirePath([[right - rightmargin, top], [right - rightmargin, bottom]]); lineTop.setEntirePath([[left, top - topmargin], [right, top - topmargin]]); lineBottom.setEntirePath([[left, bottom + bottommargin], [right, bottom + bottommargin]]); //make lines guides lineLeft.guides = true; lineRight.guides = true; lineTop.guides = true; lineBottom.guides = true; }; //lock margins layer and activate original layer guideLayer.zOrder (ZOrderMethod.SENDTOBACK); guideLayer.locked = true; docRef.activeLayer = workingLayer; }; win.show();
Box Margin Version:
#target illustrator var docRef = app.activeDocument; var artboardRef = docRef.artboards; var workingLayer = docRef.activeLayer; //window var win = new Window('dialog', "Add Margins"); this.windowRef = win; //panels win.fieldpanel = win.add("panel", undefined, ""); win.radiopanel = win.add("panel", undefined, ""); win.radiopanel2 = win.add("panel", undefined, ""); //panel orientation win.fieldpanel.orientation='row'; win.radiopanel.orientation='row'; win.radiopanel2.orientation='row'; //fieldpanel win.fieldpanel.panel1 = win.fieldpanel.add('panel', undefined, "Left"); win.fieldpanel.panel2 = win.fieldpanel.add('panel', undefined, "Right"); win.fieldpanel.panel3 = win.fieldpanel.add('panel', undefined, "Top"); win.fieldpanel.panel4 = win.fieldpanel.add('panel', undefined, "Bottom"); win.fieldpanel.panel1.left_input = win.fieldpanel.panel1.add('edittext', undefined, "0"); win.fieldpanel.panel2.right_input = win.fieldpanel.panel2.add('edittext', undefined, "0"); win.fieldpanel.panel3.top_input = win.fieldpanel.panel3.add('edittext', undefined, "0"); win.fieldpanel.panel4.bottom_input = win.fieldpanel.panel4.add('edittext', undefined, "0"); win.fieldpanel.panel1.left_input.characters = 5; win.fieldpanel.panel2.right_input.characters = 5; win.fieldpanel.panel3.top_input.characters = 5; win.fieldpanel.panel4.bottom_input.characters = 5; win.fieldpanel.check1 = win.fieldpanel.add('checkbox', undefined, "Equal"); //radiopanel win.radiopanel.radio1 = win.radiopanel.add('radiobutton',undefined, "mm"); win.radiopanel.radio2 = win.radiopanel.add('radiobutton',undefined, "in"); win.radiopanel.radio3 = win.radiopanel.add('radiobutton',undefined, "px"); //radiopanel2 win.radiopanel2.radio1 = win.radiopanel2.add('radiobutton',undefined, "All Artboards"); win.radiopanel2.radio2 = win.radiopanel2.add('radiobutton',undefined, "Active Artboard"); //select first radio buttons win.radiopanel.radio1.value = true; win.radiopanel2.radio1.value = true; //ok button win.okbutton = win.add('button', undefined, "Ok"); //disable fields with checkbox and equal values win.fieldpanel.check1.onClick = function() { if(win.fieldpanel.check1.value){ var leftvalue = win.fieldpanel.panel1.left_input.text; win.fieldpanel.panel2.right_input.text = leftvalue; win.fieldpanel.panel3.top_input.text = leftvalue; win.fieldpanel.panel4.bottom_input.text = leftvalue; win.fieldpanel.panel2.right_input.enabled = false; win.fieldpanel.panel3.top_input.enabled = false; win.fieldpanel.panel4.bottom_input.enabled = false; } else { win.fieldpanel.panel2.right_input.enabled = true; win.fieldpanel.panel3.top_input.enabled = true; win.fieldpanel.panel4.bottom_input.enabled = true; } }; //sync values while checked win.fieldpanel.panel1.left_input.onChanging = function (){ if(win.fieldpanel.check1.value){ var leftvalue = win.fieldpanel.panel1.left_input.text; win.fieldpanel.panel2.right_input.text = leftvalue; win.fieldpanel.panel3.top_input.text = leftvalue; win.fieldpanel.panel4.bottom_input.text = leftvalue; } }; //event listener for ok button win.okbutton.onClick = function(){ var leftvalue = win.fieldpanel.panel1.left_input.text; var rightvalue = win.fieldpanel.panel2.right_input.text; var topvalue = win.fieldpanel.panel3.top_input.text; var bottomvalue = win.fieldpanel.panel4.bottom_input.text; if(win.radiopanel.radio1.value) { var multiplier = 2.834645669291339 } if(win.radiopanel.radio2.value) { var multiplier = 72 } if(win.radiopanel.radio3.value) { var multiplier = 1 } //close window win.close(); //make a margins layer var guideLayer = docRef.layers.add(); guideLayer.name = "Margins"; if(win.radiopanel2.radio1.value) { //repeat for each artboard for(i=0;i<artboardRef.length;i++){ //get artboard size var top=artboardRef[i].artboardRect[1] ; var left=artboardRef[i].artboardRect[0]; var width=artboardRef[i].artboardRect[2]-artboardRef[i].artboardRect[0]; var height=artboardRef[i].artboardRect[1]-artboardRef[i].artboardRect[3]; //set margin sizes var leftmargin = (leftvalue * multiplier); var rightmargin = (rightvalue * multiplier); var topmargin = (topvalue * multiplier); var bottommargin = (bottomvalue * multiplier); //create box var box = docRef.pathItems.rectangle (top - topmargin, left + leftmargin, width - rightmargin - leftmargin, height - topmargin - bottommargin); box.fillColor = box.strokeColor = new NoColor(); //make box guides box.guides = true; }; } else { //get artboard size var activeAB = docRef.artboards[docRef.artboards.getActiveArtboardIndex()]; // get active AB var left = activeAB.artboardRect[0]; var top = activeAB.artboardRect[1] ; var width = activeAB.artboardRect[2]-activeAB.artboardRect[0]; var height = activeAB.artboardRect[1]-activeAB.artboardRect[3]; //set margin sizes var leftmargin = (leftvalue * multiplier); var rightmargin = (rightvalue * multiplier); var topmargin = (topvalue * multiplier); var bottommargin = (bottomvalue * multiplier); //create box var box = docRef.pathItems.rectangle (top - topmargin, left + leftmargin, width - rightmargin - leftmargin, height - topmargin - bottommargin); box.fillColor = box.strokeColor = new NoColor(); //make box guides box.guides = true; }; //lock margins layer and activate original layer guideLayer.zOrder (ZOrderMethod.SENDTOBACK); guideLayer.locked = true; docRef.activeLayer = workingLayer; }; win.show();
find and replace text in illustrator
Hi,
How to perform find and replace text in illustrator using javascript?
any predefined functions in illustrator like in indesign..
app.findTextPreferences.findWhat = "XXX";
app.changeTextPreferences.changeTo = "YYY";
app.activeDocument.changeText();
for now I have achieved find/replace by using iterating all textFrames and replace the contents
but it is not a better solution
pls help..
Thanks
Swapping fill and stroke on multiple objects
Wondering if there's a script out there that will automate the swapping of fill and stroke for multiple objects in a complex image. Doing it object-by-object is a bit tedious (even using 'select similar' commands).
A simplified example: I have four solid filled boxes with no stroke, each box a different color. Can I automate switching stroke and fill on each one so I end up with four non-filled boxes, each stroked with their former fill color? Perhaps there's a way to automate the sequential selection of each object and perform the swaps one at a time.
Thanks for any advice!
All Group to Ungroup Script
Download Link
http://www.cyworld.com/be2u/2801831
Feature
This Script is Can be easily ungrouping to all group items in the Document.
if find Bugs or Error, contact to me plz.
License type
Freeware
Author
Nokcha
Author Contact
Author website
Date published
june 30, 2009
Compatible product
Illustrator
Installing Scripts in latest Illustrator CC release (V 22.0.1)
Hi all,
I have been trying to find the location for installing scripts so that they appear directly under File > Scripts (instead of having to navigate to them via File > Scripts > Other Scripts). However, i can't find a folder for them.
In AI CC 2017 the folder was (on Windows) "C:\Program Files\Adobe\Adobe Illustrator CC 2017\Presets\de_DE\Skripten"
There seems to be no similar folder in the CC 2018 install. I tried "C:\Program Files\Adobe\Adobe Illustrator CC 2018\Support Files\Contents\Windows\Scripts"
and also "C:\Program Files\Adobe\Adobe Illustrator CC 2018\Scripting"
But scripts placed in either of these folders do not show up under File > Scripts, even after restarting Illustrator.
I couldn't find any official documentation regarding installing scripts in AI CC 2018. Does anyone have an idea where scripts go in the new release?
Thanks in advance!
How would I count the number of cells of a certain color using grids?
I am playing around with some pixel art.
I am using the grid system to design my image, like the mushroom above. Once the image is done, or in the process of making it, I would like to have a tally at the end that says 24 white; 45 red; 18 black (or whatever the correct number is).
Any suggestions on how to do that?
JavaScript to prompt user to save as PDF
I am making changes with code to the file. I want the user to be prompted to save as a .ai file first. I have that down. Now I am wanting to have the user immediately be prompted to save as a pdf with only the optimize for fast web view option selected. I believe it is an adobe preset of Smallest File Size.
The reason for wanting the prompt is because I want to save the files in 2 different locations.
Here is my code so far.....
var doc = app.activeDocument; // Save as .ai file var fileName = doc.fullName; var thisFile = new File(fileName); var saveFile = thisFile.saveDlg(); doc.saveAs (saveFile); // Save as .pdf file var pdfSaveOptions = new PDFSaveOptions(); pdfSaveOptions.pDFXStandard=PDFXStandard.PDFXNONE; pdfSaveOptions.compatibility = PDFCompatibility.ACROBAT5; pdfSaveOptions.preserveEditability = false; var pdfFile = new File(fileName); doc.saveAs(pdfFile, pdfSaveOptions);
AI CS4 Windows 7 64bit