Skip to main content
Participant
November 25, 2015
Question

"Insert Menu" not working for Javascript

  • November 25, 2015
  • 2 replies
  • 770 views

I found this script to create a non-printable path for my artboard.

function Path()

    var boxHeight = 611.999; //set this to whatever you like - value is in points. 

    var blackColor = new GrayColor(); 

    blackColor.gray = 100; 

    var doc = app.activeDocument; 

    var pages = doc.artboards; 

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

        var pageDims = pages.artboardRect; 

        var head = doc.pathItems.rectangle(pageDims[1],pageDims[0],pageDims[2]-pageDims[0],boxHeight); 

        head.stroked = false; 

        head.filled = false; 

               

    } 

 

 

make_Path();

Issue now is i am not able to apply this for a batch function( i have around 30000 files to finish).

The script is not recognised in "insert menu" in action command.

the other option i placed the script in presets\en_In\Scripts folder so that it appears as a menu, even then it was not recognised.

This topic has been closed for replies.

2 replies

Silly-V
Legend
November 25, 2015

The script has to be placed in the folder so that it appears in File > Scripts first, and then it should work. Problem is when Illustrator restarts, the action won't have it any more. To fix when restarted, you have to show the File > Scripts menu by clicking it & mouse-over the Scripts menu item, and then re-load the action.

In my screenshots, I show this working on CC2015 Windows7

This is not relevant to this question, but I just wanted to share my test results.

I used a simple script to assign a "random" Cmyk color to the document selection.

#target illustrator

function test(){

  

    var doc = app.activeDocument;

    var randomColor = new CMYKColor();

    randomColor.cyan = Math.random() * 100;

    randomColor.magenta = Math.random() * 100;

    randomColor.yellow = Math.random() * 100;

    randomColor.black = Math.random() * 50;

  

    doc.pageItems[0].selected = true;

    doc.defaultFillColor = randomColor;

  

}

test();

I then processed a set of 4 files 3 different times to produce 3 unique configuration sets using the Actions Batch feature.

Disposition_Dev
Legend
November 25, 2015

You could do the batching with javascript as well. I've never had very good luck with running scripts from actions, especially if the script runs in tandem with any other actions.

If you give some more information about what your goal is, we can help you write something.

Qwertyfly___
Legend
November 26, 2015

I agree, the batch should also be done in JS.

illustrator will freak out trying to batch 30,000 files.

i would also look at restarting illustrator every few hundred files.

if you do the bath in JS you can also create a log to let you know of any issues.