Illustrator Scripting :: Change Script Folder Location?
Jan 23, 2014Is it possible to change the location of where illustrator looks for scripts, or is it possible to add a location?
View 9 RepliesIs it possible to change the location of where illustrator looks for scripts, or is it possible to add a location?
View 9 RepliesI'm trying to use some images in my ScriptUI dialog, but I want to use a "relative" path name, and I can't seem to get it to work.For example, this myScript.jsx works just fine, but as you can see, I'm using an "absolute" path name to transparencyGrid.jpg:
var w = new Window ("dialog");
var f = new File ('~/Desktop/transparencyGrid.jpg');
w.add ("image", undefined, f);
w.show ();
However, I want to be able to use a relative (to myScript.jsx) path to point at transparencyGrid.jpg, like this:
var w = new Window ("dialog");
var f = new File ('../../../transparencyGrid.jpg');
w.add ("image", undefined, f);
w.show ();
But, I can't seem to get this to work because relative paths seem to be relative to the current folder, Folder.current, not the location of the currently executing script.I say that because when I do this:
alert(Folder.current);
The only thing the alert message shows is a backslash (/), indicating to me that the current folder is the root of my OS, but I thought it would be the folder where myScript.jsx resides.
So, is there a way of setting Folder.current to the location of the actual script?
Any way to allow a user to choose a folder from a default location. I thought I had found the solution but it's not quite working as I wanted:
#target illustrator
//Example 1
var output_folder = Folder.selectDialog ('Choose PDF output folder.');
//Example 2
var myFolder=Folder(app.activeDocument.path).selectDlg("Choose PDF output folder:");
If I use the code in example 1 the choose folder dialog appears and the 'Open' button is available and when I press the button the location is chosen as expected. However if I use the code in example 2, although the choose window opens in the path of the active documents location the 'Open' button is not able to be pressed until I select a folder., which means that the chosen location is not correct. I should indicate that I'm running this code on a Mac.
Any way to have a choose folder dialog window specify a location and be able to select that.
I would like to know if it is possible by command to change file/folder location that are normally set up in the OPtions>Files tab.
I would like to know because everyone in the office uses a specific LISP routine on which i set some standard settings.
I would like to be able to change/add/delete file locations of the 'Tool Palettes File Location' and the 'Default Template File Name for QNEW'.
Trying to make it where I wouldn't have to deal with the idiosyncrasies of the Project file, I created a default project that was rooted to my top level network drive.
All was fine until I did some importing from other formats. All of the sudden there was a new top level network folder called imports.
Ok, bitch session aside on the uselessness of project files, is there an entry in the project file details where I can change the location of this folder?
In SW, I was accustomed to importing a file and then saving it where I was going to use it, not in some convoluted folder structure that had no relation to my active working location.
I mean, why on earth would I want a separate folder for every little part I import?
I am working on a plugin application, in that saving Image files on a specific location by using JSX file.I have done with that but it works only with local drive.I want to save that file on my Network Share by using JSX.
View 10 Replies View RelatedHow do I get the location of horizontal and vertical guides?
I'm halfway through by using some calculations on geometric bounds and subtracting it from the document height but can't I just do something like
nextGuide =mydoc.guides[x].location;
Also, why does it seem that Indesign scripting has more access to properties and methods?
I want to save Current open Document on remote location (on server).
I am able to save it on my local machine(the machine i am presently working on).
Now I want to save it on some remote server.
I am using following code for that:
var doc=app.activeDocument();
var aiSaveOptions1=new IllustratorSaveOptions();
var aiFile1 = File( '/osn-pc-16/adobe/1/Original.ai' );
doc.saveAs(aiFile1,aiSaveOptions1)
Since Lion or Mountain Lion, we have had an annoying problem where the last folder location is not remembered in Illustrator. For example when updating links on multiple files, would like for the folder location to return to the last one used, but this would go to some folder 3 levels higher/
URL....Also the software seems to not have bneen updated in a long time, adn don't wnat a solution that won't last. Am on 10.8.2.
It is supposed to change hyphens to en-dashes in a ai files in a folder. However, when I run it, it only works on one file. After it makes the change and closes the first file, it stops.
var destFolder, sourceFolder, files, fileType, sourceDoc, targetFile, pdfSaveOpts;
sourceFolder = Folder.selectDialog;
if ( sourceFolder != null )
{
files = new Array();
fileType = "*.ai";
files = sourceFolder.getFiles( fileType );
if ( files.length > 0 )
[code]....
I have some +900 legacy pdf's that need to have a title and date change. The pdf's where generated in ArcMAP 10 so the text appears as individual letters. So I wrote a script that creates a knockout and adds the required text. I can get this to work for an individual file but I can't figure out is how to have the script perform it for all the pdf's in a folder.
Set appRef = CreateObject("Illustrator.Application")
Set docRef = appRef.Open("C:WorkCity_Wide_Zoning�_Spring_2013TestA001.pdf")
' *************************
'Knockout
[Code]....
I'm using Illustrator for work and I love it, I never needed scripts yet. Now I have couple houndred svgs coming in per day, I would like to have a script that opens every svg one by one in the selected directory and add them to a pdf as pages of the same size and than save it.
How many files I could put in 1 pdf this way?
I'm using Illustrator CS5 on Win7 x64.
How do I set a folder as a relative path to where the script is running?
is there any easy way like in unix, starting without / ?or for example
"~/Desktop/"
"/users/<login>/desktop/"
seems that path to me is the only way...
is there an easy way to change posix paths to applescript??
I have this code:
tell application "Finder" to set templateFile to (container of (path to me) as string) & "Graficas FINAL ADQAT.ai"
with this error: error "No se ha encontrado el archivo Macintosh HD:Users:Vibra:Desktop:Graficas FINAL ADQAT.ai." number -43 from "Macintosh HD:Users:Vibra:Desktop:Graficas FINAL ADQAT.ai"
the file is there how I change the filepath to be compatible with applescript?
When I open Elements 9 in Folder Location the images displayed are not those in the highlighted folder. Similarly if I select another folder I see another selection of images from elsewhere in the structure.
View 1 Replies View RelatedI'm new to Elements 10 and I'm having a hard time figuring things out but 1 thing in particular. I'm on a PC and use Windows 7.I already import a lot of pic's to Elements or so I thought.
When I'm in "Folder Location" and click on a folder it doesn't display any pictures and says "No files from this folder have been imported into Elements Organizer. To add any files, right click on the folder and select "Import to Organizer"
So I do as I'm told and then i get this error."Nothing was imported. The files or folders selected to import did not contain any supported file types or the files are already in this catalog."
I created an Action to batch export a folder of .ai files to create 300dpi .png's of the .ai file's artboard. I did this by simply recording "Export...as png" with my desired settings then Batch running the Action on desired folder of .ai files. The files were successfully exported, the trouble is that the exported files lack a .png file extension. My intent is to take these PNG files and merge them into a single PDF using Acrobat Pro. Unfortunatly, without the .PNG extension, Acrobat Pro does not recognize the file types and does not let me use the Combine Files feature on them. Going back and manually adding a .png at the end of the exported files defeats the time-saving purpose of Batch Processing all together. Is there something I am missing or doing incorrectly? I have included screenshots of 1) My Batch Action settings 2) folders showing files without .png extension and 3) visual of what I see when I am trying to combine PNGs into a PDF.
View 4 Replies View RelatedHow to make the following script for adding serial numbers apply to multiple files in a selected folder?
var docRef = app.activeDocument;
with (docRef) {
var docName = name.substring(0, name.lastIndexOf('.'));
var artRight = visibleBounds[2];
[Code] .....
I frequently record Illustrator Actions. My actions are quite long, but they all involve three common steps:
-Assigning Notes to shapes
-Assigning Swatches to shapes
-Selecting shapes that have a specific notes
I often need to re-record my actions to repeat all the steps, but to change the notes/swatches that are selected/assigned during the action.
Illustrator has a re-record command. This command is great for changing the value of the note in number 3 of my list. However, it does not work for items 1 & 2 in my list. For these items I have to delete the old step in the action and then record a new step with the new swatch/note.
I know macros in Microsoft Office have an editor which allow you to change values in actions. Is there anything similar for Illustrator actions?You can save an Illustrator action and open it in Text Edit. However, all the attribute/swatch values are saved as weird strings, so I don't know how to change them.
I am trying to change the color of all items on and under a specific layer.I have been successful changing the color of specific types of objects (paths), but I need to accommodate all the types on the layer and sub layers.
I can recurse to as many sub layers as I expect, but how do I accommodate the page Items, path Items, group Items, compound Path Items, etc.I was thinking of pushing everything to an array, but I have no experience with arrays...
I managed to write this javascript. It automatically changes the colors from one swatch (byName) to another (byName) in my opened illustrator file. But if this one color doesn't exist as a fill or outline color in a file, I get an error message, because the script can not detect the color. The script stops. I am working on a batch of Illustrator files with 3 colors to change, but some files contain just 1 or 2 of the colors.Is there a command for javascript which says: "Only change the color, if the color appears"?
Here is the script:
var docRef = app.activeDocument;
with (docRef) {
var findColor = swatches.getByName('TSB Dark Blue').color;
var replaceColor = swatches.getByName('TSBDB').color;
[code]....
I would like to make the active layer name the same as the document name. I know very little about scripting. I found this script:
var idoc = app.activeDocument;var ilayer = idoc.activeLayer;var filename = idoc.name;ilayer.name = filename;
It does almost what I need it to do. except that it also copies the ".ai" in to the layer name. Is there some way to modify this script to have it exclude or delete the file extension?
Is it possible to change the cursor while a script is running? I have several scripts which work on large numbers of objects, and it would be very useful to have the cursor change to the spinning color wheel or hourglass while the script is looping away.
I understand that Adobe's JavaScript Toolkit would let you build a progress-bar dialog, but the delays are rarely long enough to justify such a thing. All the same, a change of cursor would reassure users (and not just me!) that things were indeed happening.
I want to overprint a PMS colors using Applescript. I though if I changed the property of the selected items fill color from (fill overprint:false) to (fill overprint:true) it would work. This doesn't seem to change a thing.
This is the script I am currently using:
script ChangeOverprint
tell application "Adobe Illustrator"
local docRef
[Code]....
This is the picture of a simple document I created. The elipse has fill overprint:true. The polygon has filr overprint:false. The original value for the property fill overprint was false. I changed it in the script to true. Which the log shows it changed.
I created an action to change the width of an image. I execute the action using DoScript javascript method.
The first action Obj1 will select the whole image and second action Obj2 will open the transform panel and change the width of the image.
app.Open("D:LWW_Castoff45991_09_03.eps")
app.DoScript("Obj1", "LWW")
While (app.ActionIsRunning)
Thread.Sleep(500)
[Code]...
In the above code, the second action 'Obj2' is not getting executed. Both the actions are getting executed individually. Let me know the problem and how to execute both the actions.
I'm trying to change the colors of a pathItem corresponding to the string value of several text fields in my document. I've been successful in changing the fill and stroke color of the pathItem, but I can not find any reference in the Illustrator Javascript Guide for accessing additional strokes and/or fills that have been applied to the object in the Appearance panel.
View 1 Replies View RelatedI wonder if the CS5 command "Change to global rulers" is scriptable. When I try to record it as an Action script step, it is not recorded and I do not see anything in the JavaScript-ing guide on setting this programatically either.
View 3 Replies View RelatedI am trying to create a script who could act as an Autocad plot (ie convert each color to black, with a different line weight).
Here is the first script I melted, who create my Black swatch
if ( app.documents.length > 0 ) {
var myDoc = app.activeDocument;
//add Black swatch
var newSwatch = app.activeDocument.swatches.add()
var newColor = new GrayColor();
newColor.gray = 100;
[Code] .........
And here is the second one, who replace one color by Black (it don't change the text, nor the lineweight yet…
if ( app.documents.length > 0 ) {
//test de dialogue
function csDialog() {
var fabGroup = app.activeDocument.swatchGroups.getByName('Fabrics');
var allFabs = fabGroup.getAllSwatches();
var fabNames = Array();
[Code] ........
I have a couple thousand AI authored EPS files with a specific swatch name (SpotBlack) that I would like to rename (black) -- is there any method to do this en masse, preferrably outside of Illy using a text editor?
View 7 Replies View RelatedFor example I would like to make my images layer Green and my copy layer Red in my layers palette.
View 6 Replies View Relatedchanging the file path for links in an Illustrator document?
For example, let's say my Illustrator document is stored at: /Volumes/Storage/Projects/Client/AAA001/designs/concept1.ai
and I have placed 2 linked visuals:
/Volumes/Storage/Projects/Client/AAA001/visuals/big_retouch.psd
/Volumes/Storage/Projects/Client/AAA001/visuals/flattened.jpg
When I open the .AI I noticed that the reference to the visuals is under a %DocumentFiles section:
%%DocumentFiles:/Volumes/Storage/Projects/Client/AAA001/visuals/retouc hed.psd
%%+/Volumes/Storage/Projects/Client/AAA001/visuals/flattened.jpg
I need to replace "/Volumes/Storage/Projects" with "/Volumes/Projects". (There are some more complex replacements I need, but let's start here.)
I need the finished script to create a rectangle with no fill and a 20% gray stroke to outline each artboard. I dug this up off these boards, which works perfectly except the rectangles created have no fill or stroke. certainly save me a lot of time drawing rectangles on a daily basis.
#target illustrator
var docRef = app.activeDocument;
var artboardRef = docRef.artboards;
for(i=0;i<artboardRef.length;i++){
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];
var rect = docRef.pathItems.rectangle (top, left, width, height);
rect.fillColor = rect.strokeColor = new NoColor();
}