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

A Script to Find and Replace Layer Names

$
0
0

Are there any scripts to find and replace layer names?

 

There is an excellent script available for Photoshop which allows you to not only replace words in layer names, but also insert words as Prefixes, Suffixes and Sequential Numbers.

The illustrator version of this script only allows sequential numbering: It doesn't offer find and replacing of words.

 

Ideally, it would be great if there was something that could do multiple find and replaces in one go:

(e.g.

You have layers like this Car, Dog, Bat

You enter: car(Option1), dog(Option2), Bat(Option3)

Your layers then become: Option1, Option2, Option3).

)


Is it possible to run an action from a script?

$
0
0

Is it possible to run an action from a script? Could you make an example?

Batching In Illustrator??

$
0
0

In PhotoShop CS3, you can select File/Automate/Batch, and run an Action on an entire folder.  I don't see that option in Illustrator CS3?  Is there a way to run an action on an entire folder?

 

I'm attempting to save many EPS images as PNG images, and would really like to retain "vector attributes" - is any of this possible???

 

Thanks for any help.

select a word/text in illustrator

$
0
0

Hi,

 

how to select a text/word from textframe using script..

 

for ex,  "Adobe illustrator used for create logos, icons ,drawings"

 

in above sentence i want to select "illustrator"..

 

pls help

 

Thank you

Why is my Script timing out and sending up error?

$
0
0

I've been testing my scripts on a document with 16 objects and all my scripts work fine no errors.  But when I try it on the document I really need the scripts to work with they are very slow then time out and send up an error that doesn't make sense.  This document is a great deal larger then my test file, 14,310 objects.  I've tried running the script from both Illustrator CS6 and ExtendedScript.  I have a decent computer, but maybe it's not good enough to handle that many objects.  Any thought?

 

System Type: x64-based PC

Installed Physical Memory (RAM) 8.00GB

Total Physical Memory 7.48GB

Available Physical memory 4.54GB

Total Virtual Memory 22.1GB

Available Virtual Memory 19.0GB

How to make focus on input field in dialog?

$
0
0

How to make the value field be focused when dialog opened? I.e. the idea is to imitate user click in the input field to make it active.

 

diaogGroup.elements = [

        {

            "type":"edittext",

            "value":"",

            "characters":1,

            "visible":true

        },

      ];

Trying to improve my UI

$
0
0

Right now my script is very basic, it has 4 separate prompts to grab 4 different numbers.  My goal is to have just one prompt maybe with each entry having up and down arrow keys, so that the keyboard isn't needed, that increase or decrease the values.  Also maybe having some checkboxes as conditions besides each entry.  Maybe eventually a color selection that utilizes the eye dropper.

 


Since I'm using javascript, would I best learn about adding these things outside of Adobe maybe, from more from a programming tutorial site?  Anyone have any good resources for learning this area?

Is it possible to change focus in dialog after input?

$
0
0

Is it possible to change focus in dialog window after input?
For instance, after the input changed (there could be any value) the focus should be on the button, so that we could press Enter on the keyboard to submit the dialog.
fghjfgj.jpg


Text Replacement script

$
0
0

Hello all,

 

I am very new to the scripting world but have an issue that I was unsuccessful in resolving myself through googling and searching around. It may be impossible due to illustrator's set up but I am looking for a script to find and replace strings of text throughout a document. I realize in indesign this would be easy as all get out, but due to other limitations I am forced to use Illustrator.

 

I would need the script to search and find strings in both text boxes and text objects (or 2 scripts could work). I would be looking for something to find and replace as well as style for instance, find AA and replace with AA(registration mark) and superscript the registration mark. I would need to be able to do this for multiple instances of this string on a document. Is something like this possible?

 

Thanks in advance!

(JS) Checking if a folder exists

$
0
0

Hi everyone!

 

I would like to check if a folder exist. I was trying with this code but doesn't work.

I will thank you in advanced if you know a better way to do this.

 

Best regards_

 

- Code not working

path = Folder.desktop + "/MyFiles";
var folder = new Folder(path);
if(!folder.exists){  alert("Folder doesn't exists");
}else{   alert("Folder Exist");
}

Apply Dropshadow Live Effect

$
0
0

Hi All

 

I am trying to apply a drop shadow live effect.

The post is very helpful PageItem.applyEffect(LiveEffectXML)

The fxg string I get is

<ai:LiveEffect index="0" major="1" minor="0" name="Adobe Drop Shadow">  <ai:Dict data="B pair 1 R opac 1 R dark 100 R horz 7 R blur 0 I csrc 0 I blnd 0 R vert 7 B usePSLBlur 1 I Adobe Effect Expand Before Version 16 ">    <ai:Entry name="sclr" valueType="F">      <ai:Fill color="1 0.75 0.68 0.67 0.902"/>    </ai:Entry>  </ai:Dict></ai:LiveEffect>

 

I am stuck how to convert this into the LiveEffectXML string

The effects demonstrated in the above post and the links found on it don't have the extra <ai:Entry> tag, I don't know what to do with it.

I'm also confused by the last bit

I Adobe Effect Expand Before Version 16 "

I would think all the spaces between the words is going to cause trouble also I don't know why there's a space after the integer 16 ?

 

Has anyone figured this out?

 

Regards

 

Trevor

Selecting objects by fill color

$
0
0

Hi guys

Is possible to select objects by color in CMYK using JavaScript?

All I want to group several objects with the same fill color.

 

Many thanks for your time...

 

Please see the picture bellow...

 

2.jpg

Automatically change to the selected icon. Script files.

$
0
0

Hello friends.

 

 

It looks like there are just changing symbols. Is there a script for that?

Once created, I have a script that changes the symbols on the other working surface?

Ekran Alıntısı.JPGsda.JPG

 

Ekran Alıntısı.JPG

Illustrator Action

$
0
0

Hello,

There is an option in illustrator to select the Next object Above/Below in the Select menu.

 

But I would like to select next object above/below to be added to the current selected object(like Shift+selecting another object with mouse thus selecting 2 objects).

 

I am trying to record an Action and in the midway I need to select next three objects below my current selected object and group them. Please let me know if this is possible or any other work around is available.

Advanced "Save as PDF" script that saves 2 PDF presets with 2 different names.

$
0
0

Hi Everyone,

 

I am looking to improve a save as pdf workflow and was hoping to get some direction. Here is the background...

 

I routinely have to save numerous files as 2 separate PDFs with different settings (a high res printable version and a low res email version). Each file has to be renamed as follows...

 

Original filename = MikesPDF.ai

High Res PDF Filename = MikesPDF_HR.pdf

Low Res PDF Filename = MikesPDF_LR.pdf

 

I was able to alter the default "SaveAsPDF" script to save the files to my desired settings and to add the suffix to the name. So with these scripts here is how the workflow operates...

 

1. Open all files I wish to save as pdfs

2. Select script to save files as high res pdfs

3. Illustrator asks me to choose a destination.

4. Illustrator adds the appropriate suffix and saves each file as a pdf to my desired setting. ("Save As" not "Save a Copy").

5. Now all of the open windows are the new pdfs, not the original ai files.

6. Now I have to close each window. For some reason Illustrator asks me if I want to save each document when I tell it to close window, even though the file was just saved. I tell it to not save and everything seems to be fine.

7. Reopen all the files I just saved as high res pdfs.

8. Repeat the entire process except I run the script specifically designed for the low res pdfs.

 

What I would like to do is to combine these two processes so that there will be one script that saves both pdfs. From what I understand, the script can't support "Save A Copy" so the workflow would go as follows...

 

1. Open all files I wish to save as pdfs

2. Select single script to save files as both high res and low res pdfs

3. Illustrator asks me to choose a destination.

4. Illustrator saves each file as a High Res PDF and adds the the "_HR" suffix.

5. Illustrator then re-saves the open windows as a Low Res PDF and replaces the "_HR" suffix with "_LR".

 

Here is the code for the High Res script, The Low Res script is pretty much the same except for a different preset name and different suffix. Any pointer that anyone could give me would be most appreciated. I am pretty much a noob to this stuff so please keep that in mind.

 

Thanks!

Mike

 

---------------------------CODE----------------------------

 

/** Saves every document open in Illustrator

  as a PDF file in a user specified folder.

*/

 

 

// Main Code [Execution of script begins here]

 

 

try {

  // uncomment to suppress Illustrator warning dialogs

  // app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

 

 

  if (app.documents.length > 0 ) {

 

 

  // Get the folder to save the files into

  var destFolder = null;

  destFolder = Folder.selectDialog( 'Select folder for PDF files.', '~' );

 

 

  if (destFolder != null) {

  var options, i, sourceDoc, targetFile;

 

  // Get the PDF options to be used

  options = this.getOptions();

  // You can tune these by changing the code in the getOptions() function.

 

  for ( i = 0; i < app.documents.length; i++ ) {

  sourceDoc = app.documents[i]; // returns the document object

 

  // Get the file to save the document as pdf into

  targetFile = this.getTargetFile(sourceDoc.name, '.pdf', destFolder);

 

  // Save as pdf

  sourceDoc.saveAs( targetFile, options );

  }

  alert( 'Documents saved as PDF' );

  }

  }

  else{

  throw new Error('There are no document open!');

  }

}

catch(e) {

  alert( e.message, "Script Alert", true);

}

 

 

/** Returns the options to be used for the generated files. --------------------CHANGE PDF PRESET BELOW, var NamePreset = ----------------

  @return PDFSaveOptions object

*/

function getOptions()

{var NamePreset = 'Proof High Res PDF';

  // Create the required options object

  var options = new PDFSaveOptions();

     options.pDFPreset="High Res PDF";

  // See PDFSaveOptions in the JavaScript Reference for available options

 

  // Set the options you want below:

 

 

  // For example, uncomment to set the compatibility of the generated pdf to Acrobat 7 (PDF 1.6)

  // options.compatibility = PDFCompatibility.ACROBAT7;

 

  // For example, uncomment to view the pdfs in Acrobat after conversion

  // options.viewAfterSaving = true;

 

  return options;

}

 

 

/** Returns the file to save or export the document into.----------------CHANGE FILE SUFFIX ON LINE BELOW, var newName = ------------------

  @param docName the name of the document

  @param ext the extension the file extension to be applied

  @param destFolder the output folder

  @return File object

*/

function getTargetFile(docName, ext, destFolder) {

  var newName = "_HR";

 

 

  // if name has no dot (and hence no extension),

  // just append the extension

  if (docName.indexOf('.') < 0) {

  newName = docName + ext;

  } else {

  var dot = docName.lastIndexOf('.');

  newName = docName.substring(0, dot)+newName;

  newName += ext;

  }

 

  // Create the file object to save to

  var myFile = new File( destFolder + '/' + newName );

 

  // Preflight access rights

  if (myFile.open("w")) {

  myFile.close();

  }

  else {

  throw new Error('Access is denied');

  }

  return myFile;

}


A list of Illustrator menu commands we can call from JavaScript.

$
0
0

app.executeMenuCommand(StringFromListBelow); 


actualsize

Add Anchor Points2

AddArrowHeads2

Adjust Colors Dialog

Adjust3

Adobe Action Palette

Adobe Actions Batch

Adobe AI Device center

Adobe AI Save For Web

Adobe Apply Last Effect

Adobe Art Style Plugin Other libraries menu item

Adobe Bridge Browse

Adobe BrushManager Menu Item

Adobe Color Palette

Adobe Color Palette Secondary

Adobe Default Workspace

Adobe Flattening Preview

Adobe Gradient Palette

Adobe Harmony Palette

Adobe Illustrator Find Font Menu Item

Adobe Illustrator Smart Punctuation Menu Item

Adobe Last Effect

Adobe LinkPalette Menu Item

Adobe Manage Workspace

Adobe Minimal Workspace

Adobe New Fill Shortcut

Adobe New Stroke Shortcut

Adobe New Style Shortcut

Adobe New Swatch Shortcut Menu

Adobe New Symbol Shortcut

Adobe Optical Alignment Item

Adobe Paragraph Styles Palette

Adobe Save a Version

Adobe Save Workspace

Adobe Stroke Palette

Adobe Style Palette

Adobe SVG Interactivity Palette

Adobe Swatches Menu Item

Adobe Symbol Palette

Adobe Symbol Palette Plugin Other libraries menu item

Adobe Transparency Palette Menu Item

Adobe Update Link Shortcut

Adobe Variables Palette Menu Item

AdobeAlignObjects2

AdobeBrushMgr Other libraries menu item

AdobeBuiltInToolbox1

AdobeCheatSheetMenu

AdobeLayerPalette1

AdobeLayerPalette2

AdobeLayerPalette3

AdobeNavigator1

AdobeNavigator2

AdobePathfinderPalette1

AdobeSwatch_ Other libraries menu item

AdobeTransformObjects1

AI Bounding Box Toggle

AI Magic Wand

AI Object Mosaic Plug-in3

AI Place

AI Reset Bounding Box

ai_browse_for_script

AISlice Clip to Artboard

AISlice Combine

AISlice Create from Guides

AISlice Create from Selection

AISlice Delete All Slices

AISlice Divide

AISlice Duplicate

AISlice Feedback Menu

AISlice Lock Menu

AISlice Make Slice

AISlice Release Slice

AISlice Slice Options

alternate glyph palette plugin

alternate glyph palette plugin 2

Appearance of Black 1

Apply Last Filter

areatextoptions

arrangeicon

artboard

assignprofile

average

avgAndJoin

bringAllToFront

Brush Strokes menu item

cascade

centerAlign

Character Styles

Check Spelling

cleanup menu item

clear

clearguide

clearTrack

clearTypeScale

Clipping Masks menu item

close

closeAll

color

Colors3

Colors4

Colors5

Colors6

Colors7

Colors8

Colors9

compoundPath

control palette plugin

convertlegacyText

convertlegacyText1

convertlegacyText2

convertlegacyText3

convertlegacyText4

copy

Create Envelope Grid

cut

Define Pattern Menu Item

deselectall

discretHyphen

Distort2

doc-color-cmyk

doc-color-rgb

DocInfo1

document

DropShadow2

Dynamic Text

edge

Edit Custom Dictionary...

Edit Envelope Contents

editGraphData

editMask

EditOriginal Menu Item

editview

enterFocus

Envelope Options

exitFocus

Expand as Viewed

Expand Envelope

Expand Planet X

Expand Tracing

Expand3

expandStyle

export

faceSizeDown

faceSizeUp

File Handling & Clipboard 1

File Info

Find and Replace

Find Blending Mode menu item

Find Fill & Stroke menu item

Find Fill Color menu item

Find Link Block Series menu item

Find Next

Find Opacity menu item

Find Reselect menu item

Find Stroke Color menu item

Find Stroke Weight menu item

Find Style menu item

Find Symbol Instance menu item

fitall

fitHeadline

fitin

Flash Text

FlattenTransparency1

Gradient Feedback

graphDesigns

group

guidegridPref

helpcontent

hide

hide2

hideApp

hideOthers

highlightFont

highlightFont2

hyphenPref

ink

Input Text

internal palettes posing as plug-in menus-attributes

internal palettes posing as plug-in menus-character

internal palettes posing as plug-in menus-info

internal palettes posing as plug-in menus-opentype

internal palettes posing as plug-in menus-paragraph

internal palettes posing as plug-in menus-tab

Inverse menu item

join

justify

justifyAll

justifyCenter

justifyRight

KBSC Menu Item

keyboardPref

Knife Tool2

Last Filter

leftAlign

Live 3DExtrude

Live 3DRevolve

Live 3DRotate

Live AddArrowHeads2

Live Color Dialog

Live Deform Arc

Live Deform Arc Lower

Live Deform Arc Upper

Live Deform Arch

Live Deform Bulge

Live Deform Fish

Live Deform Fisheye

Live Deform Flag

Live Deform Inflate

Live Deform Rise

Live Deform Shell Lower

Live Deform Shell Upper

Live Deform Squeeze

Live Deform Twist

Live Deform Wave

Live DropShadow2

Live Ellipse

Live Feather

Live Free Distort

Live Inner Glow

Live Offset Path

Live Outer Glow

Live Outline Object

Live Outline Stroke

Live Pathfinder Add

Live Pathfinder Crop

Live Pathfinder Divide

Live Pathfinder Exclude

Live Pathfinder Hard Mix

Live Pathfinder Intersect

Live Pathfinder Merge

Live Pathfinder Minus Back

Live Pathfinder Outline

Live Pathfinder Soft Mix

Live Pathfinder Subtract

Live Pathfinder Trap

Live Pathfinder Trim

Live Pucker & Bloat

Live Rasterize

Live Rasterize Effect Setting

Live Rectangle

Live Roughen

Live Round3

Live Rounded Rectangle

Live Scribble and Tweak

Live Scribble Fill

Live Transform

Live Twist

Live Zig Zag

lock

lock2

lockguide

LowerCase Change Case Item

Make and Convert to Live Paint

Make and Expand

Make Envelope

make mesh

Make Planet X

Make Text Wrap

Make Tracing

Make Warp

makeguide

makeMask

Marge Planet X

minimizeWindow

navigateToNextDocument

navigateToNextDocumentGroup

navigateToPreviousDocument

navigateToPreviousDocumentGroup

new

newFromTemplate

newview

newwindow

noCompoundPath

OffsetPath2

OffsetPath3

open

outline

Overprint2

pagetiling

Paint Tracing

paste

pasteBack

pasteFront

pasteInAllArtboard

pasteInPlace

PathBlend Expand

PathBlend Make

PathBlend Options

PathBlendRelease

PathBlend Replace Spine

PathBlend Reverse Spine

PathBlend Reverse Stack

PDF Presets

Planet X Options

pluginPref

preference

preview

Print

Print Presets

proofColors

proof-custom

proof-document

proof-mac-rgb

proof-monitor-rgb

proof-win-rgb

Punk2

quit

raster

Rasterize 8 menu item

redo

Registration...

Release Envelope

Release Planet X

Release Text Wrap

Release Tracing

releaseCropMarks

releaseguide

releaseMask

releaseThreadedTextSelection

Remove Anchor Points menu

removeThreading

repeatPathfinder

Replace Colors Dialog

revert

rightAlign

Roughen3

Round3

Rows and Columns....

ruler

rulerCoordinateSystem

Saturate3

save

Save for Office

saveacopy

saveas

saveasTemplate

Scribble3

selectall

selectallinartboard

Selection Hat 1

Selection Hat 10

Selection Hat 11

Selection Hat 2

Selection Hat 3

Selection Hat 4

Selection Hat 5

Selection Hat 6

Selection Hat 7

Selection Hat 8

Selection Hat 9

selectionPref

sendBackward

sendForward

sendToBack

sendToFront

Sentence case Change Case Item

setBarDesign

setCropMarks

setGraphStyle

setIconDesign

Show Gaps Planet X

Show Perspective Grid

Show Preprocessed Image

showAll

showAllWindows

ShowArtwork

showgrid

showguide

showHiddenChar

ShowNoArtwork

ShowNoImage

ShowOriginalImage

ShowPaths

ShowPathsAndTransparentArtwork

showtemplate

ShowTransparentImage

simplify menu item

sizeStepDown

sizeStepUp

snapgrid

Snapomatic on-off menu item

snappoint

snapPref

spacing

Stray Points menu item

Style Palette

SWFPresets

switchSelTool

switchUnits

systemInfo

Text Objects menu item

Text Wrap Options...

textpathtype3d

textpathtypeGravity

textpathtypeOptions

textpathtypeRainbow

textpathtypeSkew

textpathtypestairs

textthreads

threadTextCreate

tile

Title Case Change Case Item

toggleAutoHyphen

toggleLineComposer

Tracing Options

TracingPresets

tracking

Transform3

transformagain

transformmove

transformreflect

transformrotate

transformscale

transformshear

Transparency Presets

TransparencyGrid Menu Item

TrimMark2

Twirl Tool2

type-horizontal

type-vertical

undo

ungroup

unitundoPref

unlockAll

UpperCase Change Case Item

userInterfacePref

view1

view10

view2

view3

view4

view5

view6

view7

view8

view9

Welcome screen menu item

ZigZag2

zoomin

zoomin2

zoomout

Can you set a file to "self destruct" after a set period of time?

$
0
0

Hi!

 

I have someone interested in using a script that I had made. I would like to let them use it but I want to have some control over the period of time they are able to. My plan is to encrypt the script and hopefully set it to self destruct after a year, so they need a new file from me to continue using it. This way, if we stop doing business they can no longer use the script.

 

Is there a simple way to do something like this?

 

Thanks!

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?

Batching In Illustrator??

$
0
0

In PhotoShop CS3, you can select File/Automate/Batch, and run an Action on an entire folder.  I don't see that option in Illustrator CS3?  Is there a way to run an action on an entire folder?

 

I'm attempting to save many EPS images as PNG images, and would really like to retain "vector attributes" - is any of this possible???

 

Thanks for any help.

Running a script switches Illustrator units to Picas

$
0
0

Every time I run a script the Illustrator switches to Picas measurement units so that if I create a new document it will be like this

 

 

screen_ai.png


Before that the default measurement units was mm.

Why does the script changes units?

Viewing all 12845 articles
Browse latest View live


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