Illustrator Scripting :: Using IndexOf To See Whether Element Exist Within Array

Jul 11, 2012

I'm trying to use indexOf to see whether an element exists within an array. However, when I try to execute my script, it comes back saying "myLayers.indexOf() is not a function"
 
Here is some of my code:
for (var i = 0; i < myDoc.layers.length; i++) {
if (myLayers.indexOf(myDoc.layers[i]) != -1) {
myDoc.layers[i].remove();
}
}

View 4 Replies


ADVERTISEMENT

Illustrator Scripting :: Getting Error 1302 - No Such Element Line

Oct 5, 2012

I am getting an error with a script i have used before without any problems.The script updates the only image at the bottom of a single page PDF and saves the changed PDF in another folder.
 
It asks me to locate the folder of PDFs to be modified.It asks me to locate the folder where the modified PDFs will be saved.It asks me to select the new image that will be used.It will then update the image and resizes it and save the PDF in the specified folder.
 
I don't get this error on all PDFs but i get it at least once every 10 PDFs  (and there are over a 1,000 PDFs).The error i get is this:
 
Error 1302:No such elementLine:27->      rip=doc.rasterItems[0].position;
 
I get this error regardless of whether the script is run in CS3 or CS5.

Additional info.I ran this script in CS3 and it worked. At a later date i ran another script on the folder of modified PDFs in CS5 that deleted any unnessesary elements outside the artboard, it selected All on the Artboard - then inversed the selection - and deleted any selected items followed by save and close.I have tried making sure the "new" image has the same name as the image being replaced but this made no difference.I am using Illustrator on Vista.
 
The script is below:
 
#target illustrator
function replaceImage() {

[code]....

View 4 Replies View Related

Illustrator Scripting :: How To Return Array Of Paths In The Order They Were Selected

Feb 1, 2013

Is there a method to return an array of paths in the order they were selected, instead of their descending z-index (default behaviour)?
 
I'm writing a script that "connects" the centers of currently selected objects through a stroked path, and I want it to follow the order in which I select the objects, regardless of the stacking order.

View 13 Replies View Related

Illustrator Scripting :: Sorting The Order Of Points In PathPoints Array

May 1, 2013

I've got areaText rectangles that were created by various means, and the 0 index is sometimes the top left, other times the bottom right. I need to do a lot of resizing/aligning/spacing/sizing. To script the movement of the top left point of each (or any point for that matter), I'm trying to clean up the sequence of points in each objects array of pathPoints so I can move pathPoint[0].anchor for each rectangle and be sure that the top left is moving, not some other random corner.
 
So, testing in script alone, and I came up with the following (don't laugh at how I called out the array), which works great in extendScript:
 
var testArray = new Array;
testArray.push({xVal: 5, yVal:0});
testArray.push({xVal: 0, yVal:-2});
testArray.push({xVal: 5, yVal:-2});
testArray.push({xVal: 0, yVal:0});

[code]....
 
Which throws an error "objPoints.sort is not a function"Unlike the JS only version, my AI script is trying to sort all of the points of all of of the textAreas, which I'll fix shortly so it sorts the 4 points of each object. The problem is that the script isn't sorting the points, but providing a useful error message instead.

View 9 Replies View Related

Illustrator Scripting :: How To Automate Importing Variable And Datasets Into Graphs Via Scripting

Dec 18, 2012

I'm try to automate the importing of the Varaible and datasets into my graphs via Scripting, but the ImportVaraibles() function doesn't seem to work.  Here is my Script, mostly copied from the example script provided with Illustrator (CS5).  And, this works manually, using the file names in the script, via Load Variable Library
 
    Set appRef = CreateObject(strIllistratorVersion)
   
       'Open the file and import the datasets
        Set docRef = appRef.Open(strTemplate & "200-500.ai")
        'docRef.Datasets.RemoveAll
        docRef.Variables("Yearbook").Delete
 
Here is the problem, after I delete the previous library, then this next line, right from the example, does nothing
The script then exits with 'No Datasets in this document'
       
docRef.ImportVariables (strXMLFolder & "Lumber_200-500.xml")
'appRef.DoJavaScript "alert('Template:" & strTemplate & strRange & ".ai  |  XML file:" & strXMLFolder & ""  & objFile.Name & "^')"
        If (appRef.Documents.Count > 0) Then
            Set docRef = appRef.Documents(1)

 [Code]....
 
If I remove that delete line, the script runs, but just uses whatever Variables I had last loaded, not the XML file.
 
It's simply not loading.  What do I need to do to get it to load?

View 8 Replies View Related

Illustrator Scripting :: Access Graph Data Through Scripting DOM?

May 6, 2012

Can you access graph data through the scripting DOM?

View 3 Replies View Related

AutoCAD LT :: Getting Array Window In 2012 To Open With Array Command?

Sep 30, 2011

How does one get the array window in 2012 to open with the array command like it does in 2007

View 2 Replies View Related

AutoCad 2D :: Use Path Array Feature On 2013 To Array Stairs

Sep 19, 2012

I'm trying to use the PATH array feature on 2013 to array stairs, and I can't get the array to be 100% accurate. It seems like CAD rounds the decimal to the nearest 3/4" which could be causing the problem.

I set my run to 10.5" and rise to 7.25", array along the angle of the stringer, and there's always a small overlap on the stairs. The "distance between" should be 1'-209/256" and CAD rounds it to 1'-3/4" which is where I believe the error is. Is there any way to fix this or array this correctly? Otherwise...back to the COPY method I suppose.

View 4 Replies View Related

Illustrator :: Export Only 1 Element From AI Document?

Mar 17, 2010

how you could select only one element from within an AI document and be able to export just that element out. For example, I'm making a letterhead and I want to select just a logo element from my page and export just that to an eps so that it could be imported into something else.
 
Back when I was using Corel Draw I could simply select anything and as long as it was the only thing selected I could export it to a new eps file, or whatever kind of file I wanted. If I did it with an image, the image would be cropped to just the bounds of the image.
 
So far it seems the only way to do this in AI is to export the entire artboard. I'm sure this can't be because that would be ludicrous, right?

View 11 Replies View Related

Illustrator :: Make Pattern Brush With 3D Element?

Nov 2, 2012

I followed this tutorial to create 3D Christmas lights, and all was going well until I reached one of the final steps- release clipping mask in order to proceed with making a pattern brush. The "Release" option is simply not available, I'm only allowed to "Make."

My questions:

- What might have I missed/what should I look for to enable making a pattern brush with 3d objects?

View 4 Replies View Related

Illustrator :: Copying Element Which Has Graphic Style Applied

Mar 28, 2013

Copying an element  which has a graphic style applied  now breaks apart the style into individual elements if the style is applied to text, the text is outlined too. This never use to happen. Have tried changing the  paste board setting  but this changes nothing.

View 8 Replies View Related

Illustrator :: How To Cut First Stroke From Double Outlined Text Element

Mar 22, 2013

I have text with two strokes apllied to it. I want to cut/delete the first stroke to have the apperance of a stroke that has a gap between the text fill and the stroke. Or if there is an easier way to have the outline apllied, expanded (for lack of a better term) off of the fill?

View 3 Replies View Related

Illustrator :: Importing DXF Files Into CC And Keeping Every Element In Place And Size

Aug 28, 2013

When i import a DXF file into Illustrator created in AutoCAD, i have the problem that the positions of the elements (rectangles, circles etc.) are not on the exact position as created in AutoCAD. The variations are very minor (Centerposiotion of a element x 5mm y 5mm in AutoCad = x 4.969 y 4.949 after import in Illustrator). Sometimes the sizes of the elements variate also slightly (a line which is 102mm in AutoCAD is 101.99mm after import in Illustrator) but not generally.

I tried various files with different export versions from AutoCAD, including different measures such as mm to inch and points and so on. I tried also the different importing options in Illustrator. The closest i come is Centerposiotion of a element x 5mm y 5mm in AutoCad = x 4.969 y 4.949 but never exact. How to get a DXF file into illustrator by keeping every element in place and size?

View 2 Replies View Related

Illustrator Scripting :: Create Mirror Text And Stroke Text In AI Scripting

Mar 16, 2013

the Script of creating mirror text and stroke text in Adobe illustrator scripting.

View 4 Replies View Related

Illustrator Scripting :: How To Export JPG

Jan 15, 2014

Quite new to Ai's scripting stuff.
 
I'm having a complicate time with Ai's save to jpg options vs artboard sizes and units conversions.
 
Say, i have a doc (from my client), which they inherited and enhanced for 10 years may be.
 
It's "supposed" to be in millimeters, but artboardRect gives me those values :

-0.27880000000005
436.191388980878
646.457
-0.20900000000074
 
which sound like weird points or pixels.
 
I need to export a jpg (or gif, or png), that will be X pixels wide. For the purpose of the test i set it at 1200.
 
var maxLargeurPx = 1200;
 
First thing, getting the artboard's width :
 
largeurArtboard = Math.abs(thisArtboardRect[2]-thisArtboardRect[0]);
// 646.7358
 
Then i try to have a multiply factor to use
 
coefExport = /*Math.round*/ (100 * maxLargeurPx / largeurArtboard);
// 185.54717397738
 
and then set my ExportFile jpg to this value (i can't give it a number)
 
     // exportOptions.horizontalScale = coefExport
 
That's when it's getting fun : my images are 1204 px wide with or without clipping.
 
Of course, i "can't" resize the doc for each export, especially expecting to have dozens of those, with different values, dimensions, etc.

View 5 Replies View Related

Illustrator Scripting :: Converting PDF To PNG?

Jul 27, 2012

I wrote the following AppleScript to open a PDF file and export is as PNG. I am using Illustrator CS5.
 
The export command gets an error: Adobe Illustrator got an error: Can't get current document.
when it encounters the export command.
 
set inputFile to (choose file with prompt "Open PDF file to convert to PNG:") as text
set exportFile to inputFile & ".png"
tell application "Adobe Illustrator"
if not frontmost then activate
open inputFile as alias without dialogs
export current document to exportFile as PNG24 ¬
with options {class:PNG24 export options ¬
, resolution:300 ¬
, matte color:{red:0, green:0, blue:0}}
close current document saving no
end tell

View 5 Replies View Related

Illustrator Scripting :: How To Add PDF On Top Of Existing PDF

Jun 20, 2012

Im trying to add a pdf on top of an existing PDF in illustrator using a script. This is supposed to be done by anyone at my firm so that is why I want it in a script. I also have a lot of other functions that works that will do some other stuff with this document.
 
Created this from the scripting guide but it doesnt work. Im pretty sure its the embedDoc var thats empty and i dont understand why. Im not sure if the File "points" to the directory of the script or the original file but Ive tried both ofcoarse.
 
This is the masterpiece
 
var embedDoc = new File("/temp/testfile1.pdf");
if ( app.documents.length > 0 && embedDoc.exists ) {
var doc = app.activeDocument;
var placed = doc.groupItems.createFromFile( embedDoc );
}else {alert("suck")}

View 4 Replies View Related

Illustrator Scripting :: Get Layers By Name VBA?

Apr 7, 2012

Is it possible to reference layers or groups by their names instead of their index using VBA? If so, what is the sytax? I know you can do it in Extendscript, but I'm not finding info for VBA.

View 7 Replies View Related

Illustrator :: Scripting - How To Remove Swatch In CS5

Oct 10, 2012

Swatches Swatches Read-only. The swatches in this document.
 
Deletes a swatch from the current document
Set appRef = CreateObject("Illustrator.Application")
Set documentSwatches = appRef.ActiveDocument.Swatches
Set swatchToDelete = documentSwatches(5)
swatchToDelete.delete
 
How am I supposed to be able to make changes to the swatches collection - it is read only...
 
Not supprisingly I have failed to implement this in C-sharp

View 5 Replies View Related

Illustrator Scripting :: How To Cancel All Alert At Once

Mar 13, 2014

I am trying to close alert at once but the loop continues the alert, how can I stop the alert at once

var doc = app.activeDocument
var layersToTargetNameArray = ["Background", "Artwork", "diecut", "size", "sign off panel"];
for (var i = 0, il = doc.layers.length; i < il; i++) {
var curLayer = doc.layers[i];

[Code] ......

View 6 Replies View Related

Illustrator Scripting :: How To Replace One Swatch With Another

Feb 11, 2014

Is there anyway in JavaScript to replace one swatch with another?
 
I've seen other posts where similar questions have been asked, but the solution seems to involve iterating over all the pageItems, testing and then changing the fillColor.
 
All I want to do is delete/replace a specific color. Say replace Yellow with Green.
 
Is there a way of doing this without recursing through all of the page items?

View 3 Replies View Related

Illustrator Scripting :: How To Convert EPS File To SVG

Sep 11, 2012

I added CS6 COM reference in my VB.NET application and after that I have the following basic object creation in order to convert a eps file to svg. But for some reason when I create this COM object it is launching the Adobe Illustrator application. Why it is doing like this? It’s a simple COM object why it is interacting with Illustrator Editor?

View 9 Replies View Related

Illustrator Scripting :: How To Put All Answers In Two Arrays

Jul 30, 2013

I'm working on a script with an UI element. I want all values of the 2. cloumn (Rasterkeilfarbe) returned in one array and all values of the 3. column (Klischeenr.) returned in another arry.
 
var farben = ["black", "red", "blue", "green", "bla", "blupp"]
var myName = myInput (farben);
// rest of the script

[Code]....

View 5 Replies View Related

Illustrator Scripting :: How To Script A Tabbed UI

May 26, 2012

Is it possible to script a tabbed ui like this, i can't seem to get it to work,
 
My script for now:
 
#target illustrator
tabbed_ui();
//Functions
function tabbed_ui(){

[Code]....

View 2 Replies View Related

Illustrator Scripting :: How To Loop Through The Artboards

Feb 7, 2012

Is it possible to loop thru the artboards (with Illustrator CS5) and only work with the pageItems on the current iterated artboard?
 
For example, if I have 3 artboards, with 2 textFrames on each artboard.  And I add the textFrames sporadically (I add a TextFrame with contents "Text 1" on artboard 1, then a textFrame with contents "Text 2" on artboard 3, then a textFrame with contents "Text 3" on artboard 1, etc).
 
Artboard 1:
Text 1
Text 3
 
Artboard 2:
Text 4
Text 6
 
Artboard 3:
Text 5
Text 2
 
Is there a way to loop thru these artboards and get the textFrames tied to the appropariate artboard?  So, on the first iteration of the loop, I'm looking at artboard 1 and only looking at "Text 1" and "Text 3", then on the the 2nd iteration I'd be working with artboard 2 and it's textFrames "Text 4" and "Text 6", and so on.
 
If I loop thru only the doc.textFrames, the order would be incorrect, with the way I added each textFrame.  Instead of artboard order, they'd be in this order:
 
Text 1
Text 2
Text 3
Text 4
Text 5
Text 6

View 4 Replies View Related

Illustrator Scripting :: Create CDATA In XML?

Dec 17, 2013

What if for some reason a person wants to actually make an XML file and stick some <![CDATA[]]> in it? I looked through some manuals & OMV fairly quickly to discover no methods for that. Was wondering if there was some technique.And, just as pointed out in the indesign forums, a string of "]]>" makes the script hang up and debugging have to be stopped with the final message "Cannot execute".

View 9 Replies View Related

Illustrator Scripting :: Pin Scripts To Menu?

Mar 7, 2012

is there a way to pin certain scripts to the menu in Illustrator (File > Scripts)?
 
It's quite a work to access to scripts by "File > Scripts > Other script" every time, so I figure there must be some easier way out there.

View 3 Replies View Related

Illustrator Scripting :: Sort Artboards By Name?

Feb 7, 2012

We have over 50 artboards in most of our documents.  Is there a way to sort the artboards as listed in the artboards panel by name via script?

View 13 Replies View Related

Illustrator Scripting :: How To Terminate The Script

Sep 2, 2008

How do I terminate the script - not Adobe application(s)?

exit(), quit()... - they don't work.

The only workaround I can think of is a main() function with "returns" in appropriate places, but I am just curious if there is a terminating command.

View 5 Replies View Related

Illustrator Scripting :: Making A Tab In A Radiotext?

May 13, 2012

I want to make a tab in a radiotext and it does not work when i just add a tab.
 
I can add a space and other characters using unicode but i cant make it work with the tab character!
  
staticText     =     Grp1.add("statictext",undefined,"What?     ");          // Does not work
staticText2     =     Grp1.add("statictext",undefined,"What?u00A0");     // Works but this is a space character
 staticText3     =     Grp1.add("statictext",undefined,"What?u0009");     // Does not work with Tab character

View 1 Replies View Related

Illustrator Scripting :: Get Swatch Name For Character?

Feb 28, 2012

I'm needing to loop through each character of a text frame and check the color of each character.  Is it possible to get the swatch name of each character?  Or can you only get the red, green, blue values?
 
I've been experimenting with:
 
app.activeDocument.textFrames[0].characters[3].characterAttributes.fil lColor.typename;
// Returns SpotColor
 
But I can't figure out how to get the swatch name of the character this way?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved