Illustrator Scripting :: Set Folder As Relative Path To Where Script Is Running?
Apr 10, 2012
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?
I am using a script to move anchor points on a path that I have. When I move the anchors, the handles remain in the same location and I am getting very poor results. I was wondering if there was a way to move handles WITH the anchor points. Basically keep them relative to the anchors.
Below is how I am moving the anchor. I know that you can use leftDirection and rightDirection to move the handles, but I would like them to move the same way they would if you moved the anchors when selecting them in Illustrator.
Set currentPoint = targetPathItem.PathPoints(13) currentPoint.Anchor = Array(-1537.21, 2735.96)
Basically, I have an open AI document and would like to duplicate its artboard and then move it to a new position(X axis, 50pixels away from the original). Doesn't seem too hard, but I can't figure it out. This is for CS5.
var docRef = app.activeDocument; var abSrc = docRef.artboards[0]; var abSrcX = abSrc.artboardRect[0];
[Code]...
Taking that into account if I add (1224 + 144) to abSrcX and abSrxW it creates another artboard 2" away from the previous at 17" x 11". If I want to run it again, I just to add (1224 + 144) to abSrcX and abSrxW again. Now to figure out how to do this dynamically on the fly.
I have linked files in a realtive path /sheets/ in my adboe ai file. We are generating 10,000's of images and placing them in the /sheets/ folder. The naming scheme is the same.
However when I share this project with a friend over dropbox. ai + /sheets/ folder. When he opens it up he's getting a ton of errors about the files not being found.
Does illustrator ignore linked file locations if the path isn't ABOSULUTE? Or if the newly generated images are overwritting the previous ones?
How can I fix this because we are looking at 10,000's of large image reaplcments that will take DAYS of mannual labor?
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 created a action in Illustrator CS6 (on a PC) which opens PNG files, scales them onto a 8.5 x 11 page, saves them as a PDF into a output folder on my desktop and then closes the page. The action works great and does exactly what I had hoped for.
Here is my issue: I now have a need to do this on multiple files at the same time. Using the Illustrator Help menu, I found out about Batch processing. The tutorial says that a batch can be run on a single file or on a folder of files. Bingo! That's what I want. Problem is, I can't get it to work.
After setting up the batch with the following settings: (note: I didn't use a destination folder because I have the action saving the pdf into an output folder on the desktop).
According to the help page, it said to use Override Action "Open" commands which Opens the files from the specified folder and ignores any Open commands recorded as part of the original action. I thought this is what I needed to open all the files in the folder, because when recording my action, I had to use the open command to open a png file. It wouldn't just let me choose a folder. If I don't have the open command in the action, nothing happens.
My main issue is getting multiple files from within my input folder to open when running the action. The only file that opens is the file that I recorded while creating the action. If I remove that file from the folder, nothing happens at all.
I have many drawings that were created with the xref's as full path and I need them to be relative path. I would just go in and reatch them as relative path but the drawings are complete and there are different layers frozen in each one.
I have found a way to convert FULL to RELATIVE using XRP2004.lsp but not the other way round. Main reason I want to do this is to change the Relative to Full, move the drawing and then revert them back to Relative.
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.
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
I have a collection of circles and rectangles in my document. Is there any way to sort out circles from rectagles using JavaScript? Say i want to make my circles red and the rectangles blue.
Is there any way to find a specific point on a path, that is not necessarily an anchor point?
What I'd like to be able to do is tell Illustrator "Give me the coordinates of the point that's exactly at half of this path's length" or "... exactly 25% ...". And if that's possible, can I somehow add an anchor point to that point, or cut the path at that point?
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.
All I am trying to do is move an anchor from one location to another using vbscript. I have searched everywhere and scoured the scripting references but I have not been able to figure this out as of yet.
I am able to select anchor points without an issue....moving those points seems to be a problem.
I need an Illustrator script for distribute a collection of diferent symbols along a path. The symbols should be distributed from the beginning to end of path and separated a proportional space each other. Additionally each symbol should be rotated pointing to a "look at" object.
Please look at the attached image for further info.
So I deal with a lot of files each day that need to be saved according to their lead code, meaning that there is a folder that holds thousands of sub folders that have the same name as this lead code on a server.
So since I have the lead code in the file name I'm trying to use that in conjunction with the file path to tell illustrator where to save it with Javascript. Also the idea of a dynamic save path is useful.
Here's what I've got so far, it's not working yet but I feel like I'm close.
/*///////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// Dynamic Save Path//////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////*/ #target illustrator
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.
I'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?
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.
I have a very simple javascript for Illustrator that is intended to render all filled objects semi-transparent. It works nicely but for large documents with many objects this takes ages, even beyond the time it would take to do it manually.
I'm wondering if there is any way to improve this script so it works in a reasonable time for large files? I'm running Illustrator CS5 on a Windows 7 64-bit Intel Quadcore i5-2400 @ 3.10 GHz System with 12 GB of RAM and an AMD Radeon HD 6350 graphics. Would upgrading to CS6 significantly improve the speed? CPU load is only at 25%, but I guess javascript cannot be run in multiple threads with the Illustrator engine? Is there another scripting language that would allow me faster processing of that task in illustrator or is my code just poorly optimized?
with (app.activeDocument) { if (pathItems.length > 0) { for (var g = 0 ; g < pathItems.length; g++) { if (pathItems[g].filled == true) { pathItems[g].opacity = 50; } } } }
The first loop grabs the geometries drawn in the current document and rotates it around itself creating duplicates. The second loop is supposed to circumvent more geometries around the newly created geometries.
But instead of creating a radiant pattern, this code builds a tower: for the second loop everytime it grabs the last drawn geometry instead of what is in the "Original"
for NumPaths = 1 to frontDocument.PathItems.count set myPath = frontDocument.PathItems.item(NumPaths) For index = 0 To 30 set newPath = myPath.Duplicate call newPath.translate(100*sin(6.14* index/30),100*cos(6.14* index/30))
I'm working on a script for my company that sets up templates for internal use. I've been able to get most of it completed by drawing basic pathItems and textFrames. The problem I face now is adding our company logo. In the scripting reference I've found examples of duplicating art from one document to another, but that isn't what I need here.
I've approached this by trying to select our company logo in an existing document and in some way capturing the pathPoints so I can use them in the the script that is setting up the templates.However I've not had much luck with this. Ideally everything will be self contained in the one script, so that external files aren't required.
how the Photoshop DOM works with this snippet but I can't get it to select a pathItem correctly. When testing in ESTK I sometime have to run a line to that sets the path Item selected property to true several times before the path is selected in the GUI.Here is the script I am working on.
copyPathsToPhotoshop() function copyPathsToPhotoshop(){ var currentLayer = app.activeDocument.activeLayer; var count = currentLayer.pathItems.length; var shapeNumber = 105 for( var p=1;p<count;p++){ [code]....
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.)