• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Script for closing the open paths on Illustrator CC2015

Explorer ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

Can someone give me a script to close all the open paths on Illustrator CC2015 ?  Thanks.

TOPICS
Scripting

Views

5.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

for (var i=0;i<app.activeDocument.pathItems.length;i++)

  if (app.activeDocument.pathItems.closed==false)

  app.activeDocument.pathItems.closed=true ;

I don't test it. Probably it works.

Ten

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

Thanks Ten, but I got this one from previous forum.  Could you help me with a check whether it can be applied with Ai CC2015?

Script for Selecting Open Paths in Illustrator CS6

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

The script you referenced in the other thread only "selects" it does not close. So given that, did you try "Ten A"'s script since that does what you asked: closes open paths ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

Please advise how to add it.  I must copy and paste on NotePad ??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

The thread you referenced above goes over how to do that. So is it safe to assume you never tested nor used that script either, from the referenced thread you posted?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

I'm very new on Ai, just try to start. So what I need to do is just copy it and paste on notepad??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

I would recommend using the ESTK.

this stands for ExtendScript Toolkit.

as you mentioned 'notepad' I am guessing you are on a PC.

press the win key and type extend.

the Adobe ExtendScript Toolkit should be the first option.

open ESTK and paste your code in the editor.

in the pull down menu choose 'Adobe Illustrator CC 2015'

then you can use the little green Play button to run your script.

from there you can then save your script as a .jsx (this is the default)

to have the script appear in the File>Scripts menu in illustrator it need to be placed in this folder:

C:\Program Files\Adobe\Adobe Illustrator CC 2015\Presets\en_GB\Scripts

yours may vary slightly, ie \en_US\

illustrator will need to be restarted after you have saved your script in the above directory.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 06, 2015 Aug 06, 2015

Copy link to clipboard

Copied

Thanks Qwertyfly, mine is pc. I got also last night a script from someone pasted on MS Word.

However, I'll  try up to what you said though ESTK is new for me.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Aug 06, 2015 Aug 06, 2015

Copy link to clipboard

Copied

wongchanc59288790 wrote:  I'm very new on Ai, just try to start. So what I need to do is just copy it and paste on notepad??

OK. The most basic approach (for using Scripts in Illustrator):


1.) Copy & Paste the code in a plain text ,text editor (ie: NotePad, etc. ( it must be "plain text" ))

2.) Then save the Text file from above with the extension of .js or .jsx to your desktop.

3.) Then inside Illustrator go "File Menu > Scripts > Other Script..."


This allows you to easily execute random/specific scripts that are not installed in the Scripts folder. Selecting Other Scripts displays a File Browser dialog, which you use to navigate to the script file on your desktop or wherever. When you select the file, the script will be executed.

Hope something someone suggested helps your efforts to get started with things.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Aug 06, 2015 Aug 06, 2015

Copy link to clipboard

Copied

Should Clarify that MSword is NOT a Plain Text Editor.

there are many great notepads great for scripting.

NotePad that comes with Win will work but does not have any scripting formatting.

I like "NotePad++" & " Brackets" is also quite nice.

for illustrator I use the ESTK as it links with illustrator very well and makes testing and debugging very simple.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 07, 2015 Aug 07, 2015

Copy link to clipboard

Copied

thanks Qwertyfly, will download ESTK and try, may bother you again if i got a problem...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 13, 2022 Jul 13, 2022

Copy link to clipboard

Copied

LATEST

I realize this is an old thread, but it was helpful to me. I updated the script written by Ten A. The last 2 lines just needed "i" to identify the current path. Works great in AI 2022:

function closePaths() {

for (var i = 0; i < app.activeDocument.pathItems.length; i++) {

if (app.activeDocument.pathItems[i].closed == false)

app.activeDocument.pathItems[i].closed = true;

}

redraw();

}

 

closePaths();

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines