Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all 12845 articles
Browse latest View live

How to divide all textFrames in one-character-per-textFrame?

$
0
0

Hello:

 

How to divide all textFrames in one-character-per-textFrame?

 

Example: the textFrame "Letters" will be divided in 7 textFrames: "L", "e", "t", "t", "e", "r", "s".

 

Help, please.


Is there any way to convert recorded actions into JSX Javascript file?

How to embed multiple images

$
0
0

Hello!

 

I have been tying to figure out how I could easily embed multiple linked images easily. I have some 1000 .svg  images which have about 1-7 .tif images linked in to them. I now need to get those links embedded and becouse of the amount of images I'm hoping to make an action out of it. I have a script to embed single image in .svg but haven't have luck with multiple embeddings.

 

Any ideas?

Dimension Illustrator CS6

$
0
0

Does anyone know of a script that will automatically put dimensions on rectangular shapes in Illustrator CS6?

Script for Selecting Open Paths in Illustrator CS6

$
0
0

I have created this script for selecting open paths in illustrator cs6 as the graffix plugin is not working under CS6.

 

Just save the following text in /Applications/Adobe Illustrator CS6/Presets/en_US/Scripts/Select Open Paths.js

 

 

if (documents.length > 0 && activeDocument.pathItems.length > 0){
 
          var allPaths = activeDocument.pathItems;
          var allPathsCount = allPaths.length;
          var openPathsAreLocked = false;
          var lockedOpenPaths = 0;
          var locked = false;
          for (var i=0; i < allPathsCount; i++){
                    allPaths[ i ].selected = false;
 
                    if( ! allPaths[ i ].closed){
 
                              try{
                                        allPaths[ i ].selected = true;
                              } catch (e) {
                                        openPathsAreLocked = true;
                                        lockedOpenPaths++;
                              }
 
                    }
          }
          if (openPathsAreLocked) alert (lockedOpenPaths + " open paths are locked or hidden (or their layer is locked or hidden) and cannot be selected");
}

ExportType.SVG "Use Artboards" option

Secured PDF from Illustrator CS6

$
0
0

I've been banging my head against the wall on this for awhile and I can't figure out what I'm missing. My script updates the filename and date on an Illustrator file and exports a secured PDF that will not allow anyone to edit or print the pdf. I can get it secured and but I can not figure out how to disable printing.

 

Here is my scritp as it stands:

 

-- System Date

tell (current date) toget (it'smonthasinteger) & "/" & day& "/" & (it'syearasinteger)

setmgDatetotheresultasstring

 

tellapplication "Adobe Illustrator"

 

  -- Filename

          tellapplication "Adobe Illustrator" tosetmgNameto (nameofdocument 1)

          settheFilePathtofile pathofdocument 1 asstring

 

          settheoldDelimstoAppleScript'stext item delimiters

          setAppleScript'stext item delimitersto ":"

          setthePathItemstotext itemsoftheFilePath

          setAppleScript'stext item delimiterstotheoldDelims

          setparsedPathtoitems 1 thru ((countofitemsofthePathItems) - 1) ofthePathItems

          setAppleScript'stext item delimitersto ":"

          setparentPathtoparsedPathasstring

          setAppleScript'stext item delimiterstotheoldDelims

 

          settext item delimitersofAppleScriptto ""

          ifmgNamecontains ".ai" then

                    setaCounttocounteverycharacterofmgName

                    setaCounttoaCount - 3

                    setmgNametocharacters 1 thruaCountofmgNameasstring

                    setmgNametomgNameasstring

          endif

 

          setsavePDFPathtoparentPath& ":" & mgName& ".pdf"

 

  -- Date

          setcontentsoftext frame "date" ofdocument 1 tomgDate

          setcontentsoftext frame "filename" ofdocument 1 tomgName

 

  --PDF Save Options

          setpdfSaveOptionsto {class:PDF save options, compatibility:Acrobat 8, enable access:false, require doc password:true, require perm password:true, preserve editability:false, permission password:"Test", allow printing:pdf 40 print none, changes allowed:pdf 40 no changes}

  savecurrent documentinfilesavePDFPathaspdfwith optionspdfSaveOptions

 

endtell

 

 

It will create the pdf and it is secured but the printing is still enabled and I can't figure out how to disable it and help would be appreciated. I have included a screen shot of the security panel in Acrobat showing that printing is still allowed. All I want the end user to be able to do is view the pdf.

 

Screenshot.jpg

How do I copy active artboard from Illustrator to Photoshop?

$
0
0

Hi,

 

I need to copy the active artboard from Illustrator to Photoshop. Can this be accomplished? I got a handle to active artboard like this

 

//get artboard collection

var myArtboards = myDocument.artboards;

 

var activeArtBoardIndex = myArtboards.getActiveArtboardIndex();

var myActiveArtboard = myArtboards [activeArtBoardIndex];

 

any ideas on copying this artboard to a file in PhotoShop?

 

thanks for your help.


execute photoshop script via illustrator cs5

$
0
0

Hi

 

Is it possible to execute Photoshop script via illustrator

I have 2 different script

script 1 work in illustrator with eps file and export as jpeg

script 2 where i want to trim the exported jpeg for illustrator in photoshop and save it back

I have 2 differnt script with me

can anyone help me to club both and run at same time..

 

Thank you
Appu

Link to a web page from AI javascript?

$
0
0

I've written a script with a ScriptUI interface, which other people will be using. I'd like to include a 'help' button in the interface, which ideally would connect to a web page with more details. (The alternative is to create the 'help' window in javascript, but the web page already exists and it would be a shame not to use it.)

 

From what I've read, other Creative Suite programs may be able to connect to the web with javascript, but apparently not Illustrator. Can anyone please confirm this is so? Or better, point me towards a solution!

 

With thanks.

Extract text from illustrator for translation then replace with translated text

$
0
0

I am trying to find a way to expedite translations of our drawings.  Each drawing has a series of callouts showing what that piece of the drawing is via text.  I would need to do 100's of drawings for each book.

 

Questions:

 

1. Can I write something to batch a folder and extract the name of the file, and the text from each textbox so that when I get the translation back, I can automate the reinsertion of the translated text to its correct field (i.e. TextField1 = "Translate this" then repopulate that same exact field with "Translation")?  In order to do this I would think each text field would have to be tagged with some unique identifier so that it would know which translation goes where in the drawing.  Keep in mind, I'm ok with manually tagging each textbox if necessary.

 

2. Assuming the above is possible, what would be the best program to write the extracted text to so that reading and writing the translated text back into the drawing is as easy as possible (i.e. Word, Excel, PDF)?

Save All?

$
0
0

This may be a stupid question, but is an existing to Save All open documents? If not, is there a way to script this? I often make a bunch of changes in documents at once and it would save a lot of time if I could just hit one save instead of 5 or 6.

 

Thanks!

Is there any way to convert recorded actions into JSX Javascript file?

Getting 1346458189 ('PARM') error

$
0
0

From the readme:

"An Illustrator error occurred: 1346458189 ('PARM')" alert (1459349)    Affects: JavaScript    Problem:     This alert may be popped when badly written scripts are repeatedly      run in Illustrator from the ExtendScript Toolkit      Scripters need to be very careful about variable initialization and      namespace conflict when repeatedly pushing a batch of Illustrator scripts     for execution in Illustrator via the ExtendScript Toolkit (ESTK) in a      single Illustrator session. Each script run is executed within the same      persistent ExtendScript engine within Illustrator. The ESTK debugger      uses BridgeTalk to communicate with Illustrator. One global, persistent      ExtendScript engine inside Illustrator handles all BridgeTalk      communications. The net effect is that the state of the ExtendScript      engine is cumulative across all scripts that ran previously.      The following issues with script code can cause this problem:        - Reading uninitialized variables.        - Global namespace conflicts, like when two globals from different         scripts clobber each other.    Workaround:     Initialize variables before using them, and consider the scope of      your variables carefully. For example, isolate your variables by      wrapping them within systematically named functions. Instead of:             var myDoc = app.documents.add();       // Add code to process myDoc           Wrap myDoc in a function that follows a systematic naming scheme:             function myFeatureNameProcessDoc() {      var myDoc = app.documents.add();      // Add code to process myDoc      }      myFeatureNameProcessDoc();

 

 

This makes zero sense to me. If javascript variables are being reused or 'clobbered' or your javascript is 'poorly written' (this is not defined) it should have no effect on the scripting engine. Errors should cause exceptions to be thrown, which can be caught by the script.  I'm getting these errors when I try to evaluate properties of valid objects, for instance trying to access pathItem.fillColor. It's happening in various (almost random) lines in my script. Javascript doesn't have namespaces so I don't know what a 'namespace confilct' would be. Accessing variables from nested functions also seems to be a problem.

 

Edit - this seems to be related to accessing global variables or variables defined in containing functions. For now, adding var to the first use in subfunction seems to have fixed the problem. What is strange is you don't get an undefined variable error, it just crashes when it tries to access the properties.

 

Edit - still not fixed. I'm guessing it has something to do with memory allocation, because I am processing a lot of big raster images in todays batch of files.

 

Edit - processed 84 files today with no errors the pattern I'm using is to use a bach file that loops

 

"(Path)/Extend Script Toolkit.exe" -run script

sleep 10

 

The script opens a group of files (in my case JSON files), processes one file, exports an ai file, deletes the JSON file, then exits.

an Illustrator error occurred: 1346458189 ('PARM')

$
0
0

Hello everyone,

 

I am trying to open some documents in Illustrator CS4 by javascript, walk through all layers including sublayers, doing something (for now just reading the layernames and showing them at an alert), closing the document and continue with the next document in the given folder until all documents in that folder are done.

 

By doing so I found an error I never have seen so far and I cant figure out where it comes from exactly to get rid of it.

The Error an Illustrator error occurred: 1346458189 ('PARM') appears randomly when cycling through the layers of the document but only every second document, so I guess there might be something wrong with closing a document and realeasing all references but I could not figure out what.

 

Maybe someone got an idea on this problem? Posting my sourcecode (just a simple test-code) below.

 

 

#target illustrator

 

var sourceFolderPath = "/e/TestAI";

var destinationFolderPath = "/e/TestZielverzeichnis";

var fileNameDefinition = "*.ai";

var sourceFolder = new Folder(sourceFolderPath);

var destinationFolder = new Folder(destinationFolderPath);

 

runCheckTool();

 

function runCheckTool() {

var contentInput = sourceFolder.getFiles(fileNameDefinition);

var fileRef;

var docRef;

for (var i = 0; i < contentInput.length; i++) {

fileRef = null;

docRef = null;

try {

fileRef = new File(contentInput[i]);

docRef = open(fileRef);

} catch(e) {

alert("# 1: " + e);

}

 

try{

checkLayers(docRef.layers);

} catch(e) {

alert("# 2: " + i + " " + e);

}

 

try {

docRef.close(SaveOptions.DONOTSAVECHANGES);

alert("end file index: " + i);

} catch(e) {

alert("#3: " + e);

}

}

}

 

function checkLayers(layerRef) {

var countLayers = layerRef.length;

for (var j = countLayers - 1; j >= 0; j--) {

if(layerRef[j].layers.length > 0) {

checkLayers(layerRef[j].layers);

}

alert ("Layer: " + layerRef[j].name);

}

}

 

 

Screenshot001.png


Auto Spell checking in illustrator

$
0
0

Hi All,

 

Like word, if we key the text in illustrator do we have any auto spell checking method.

 

Any scripts or plugin.

 

Regards,

Vinoth

Revert document?

$
0
0

Anyone know how to revert (or re-open) a document at the end of a script?

 

Cheers

Show color picker dialog JSX / CSAW

$
0
0

Can someone guide me on how to show the color picker dialog in Illustrator programmatically?

In photoshop that's really easy, just:

 

     app.showColorPicker(true);

 

In Illustrator I couldn't find any reference to such a method or other possibility to show the dialog programmatically, that you would normally get when double clicking on the fill color square within Illustrator.

 

Is that possible by using app.executeMenuCommand or some other method?

 

I am writing a script that opens the color picker dialog in reaction to a click on a button. I want to be able to get the chosen color and use it within the script.

 

thanks for the help!

Dominik

Link to a web page from AI javascript?

$
0
0

I've written a script with a ScriptUI interface, which other people will be using. I'd like to include a 'help' button in the interface, which ideally would connect to a web page with more details. (The alternative is to create the 'help' window in javascript, but the web page already exists and it would be a shame not to use it.)

 

From what I've read, other Creative Suite programs may be able to connect to the web with javascript, but apparently not Illustrator. Can anyone please confirm this is so? Or better, point me towards a solution!

 

With thanks.

Looking for "Replace with Symbol" script

$
0
0

So I am trying to replace gps points with a symbol I have created. I have found blogs referencing a script that can replace selected items with symbols saved in the symbols panel, but I can't seem to find the actual script! If anyone knows where I can find JET_ReplaceWithSymbol.jsx or any other script that can do the same function, it would be greatly appreciated!

Viewing all 12845 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>