Illustrator Scripting :: How To Clear All Stored Variables
Jun 7, 2012
is there a way to clear all stored variables in ES? I could set them to null at end of script, but this would be really annoying. Sometimes I just need to write some quick ditry code and don't want to worry about clearing them.
I have an XML file containing a number of data-sets each consisting of a number of text variables which I want to use to create a deck of trading cards. Each trading card consists of a Text Field for the title of the card and a number of icons, which are instances of various Symbols
I have written a script to create each card and i can load the variables into my javascript using: newCard.importVariables(new File(xmlPath));I now need to access the data in the datasets in order to populate the card.
To provide some context, this is an image of one of the cards with placeholder art.
When you select a linked image on the artboard you should have the option to " Create a Linked File variable: Select a linked file and click the Make Object Dynamic button in the Variables panel." That is right out of the Adobe Illustrator reference. When I select linked files the button to make object dynamic is greyed out.I see no other way to continue(CS6) also reading about similar problems in (CS5).
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?
Regarding the conversion of an excel sheet into Illustrator variables... I am able to import an excel sheet into Illustrator datasets. I am curious if it is possible to link the excel file to the Illustrator data sets, so that when I alter something within the excel sheet, the data sets automatically change. Is this possible? Or must I always freshly convert/import the excel file?
I am creating one custom plug - in for my project. and for this i want to create one dictionary.In this dictionary i want to store my object and one custom property related to this selected object( exp path item, raster item. etc).
i want to know after closing AI CS6 how can i access the same value what i stored in dictionary.actually i want to create one property for the selected item and want to save and retrieve back. this property.
i have made a custom stroke width profile and want to back it up for future use i found two files called variablewidth or something but the date modified wasn't congruent to when i created the profile.
where can i find the files that contain this preset to back up?
What the maximum size xml file one can use when making data driven graphics in Illustrator?
I can successfully batch when I load a single variable library with about 100 datasets at one time but anything much larger than that in the same xml format gives me a “the incoming variable library is invalid” error. Elsewhere on this discussion forum I have seen answers say there is no limit to the size of the XML file. [URL]..... But my experience with Illustrator CS5 says otherwise.
1. If there is a maximum size either in file size, number of datasets, or number of variables/values, what the limit is. 2. I still need to create thousands of the final document I am creating - if the limit is close to 100 and I need to create many thousands - scripting or other methods to get this done?
I'm used to photoshop and understand illustrator works on different principals, but I can't get a white to clear gradient or a gradient that has white on either end, or a graident in color..I've tried making a new gradient swatch like in InDesign and have tried loading various default graidents but can't get what I wNt I want to do this:
can see that the edges of the guy's fingers are bleeding off the artboard and into the canvas. It's my goal to animate it frame by frame, and have his hands move in from the canvas. The thing is, when I export the frames as PNG files, I am still able to see what is on the canvas. I don't want that. I want to only see what is on the artboard.
As I was researching into this, it appears that I have to create a clipping mask, but none of the pages I read really seemed to specify on how to do that. There is this page which is in 7 steps (URL....), but I can't complete it since I don't know my changed image attributes. And it appears that the image attributes are not in the Document Setup, so how do I determine how large my artboard is (besides using the rulers)?
Is there not just a regular cropping tool that automatically clears anything exceeding the edges of the artboard?
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
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")}
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.
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
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];
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?
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?
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
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:
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".
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
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?