Skip to main content
Participant
September 20, 2019
Question

Scripting for disort & transform effect fisheye

  • September 20, 2019
  • 2 replies
  • 709 views

Hi everyone, 

 

I'm looking for a similar script to adapt it. 

I would like to go from -100% on the effect to 0, while rendering each image. 

I looked for on google but only found 2004-2005 unuseful scripts. 

 

Thanks in advance, 

 

Loïc 

This topic has been closed for replies.

2 replies

CarlosCanto
Community Expert
Community Expert
September 23, 2019

check this thread, ther's a sample that saves each artboard to png, you don't need that but it has a loop and png save sample you can adapt to your needs. Post back if you get stuck.

https://community.adobe.com/t5/Illustrator/Setting-the-resolution-output-in-an-export-PNG-script/m-p/10568663#M142139

Participant
September 23, 2019

Thanks for your answer, works well. I merged 3 scripts, png export, disort, and duplicate artboard. Here is my script, I cannot figure out why illustrator keep crashing when it begins to draw.

 

 

var nbr = 99;
var doc = app.activeDocument;;//Gets the active document
/// SAVE  PNG
$.writeln(doc.name);
var fileName = doc.name.slice(0, 9);//Gets the G Number

var numArtboards = doc.artboards.length;//returns the number of artboards in the document
var filePath = (app.activeDocument.fullName.parent.fsName).toString().replace(/\\/g, '/');
var options = new ImageCaptureOptions();

function save()	{
	for (var i = 0; i < numArtboards; i++) {
	
	  doc.artboards.setActiveArtboardIndex(i);
	
	   var activeAB = doc.artboards[doc.artboards.getActiveArtboardIndex()];
	
	
	  options.artBoardClipping = true;
	
	  options.resolution = 300;
	
	  options.antiAliasing = true;
	
	  options.matte = false;
	
	  options.horizontalScale = 108.3;
	
	  options.verticalScale = 108.3;
	
	  options.transparency = true;
	
	
	   var artboardName = doc.artboards.name;
	
	   var destFile = new File(filePath + "/" + fileName + " " + i + ".png");
	
	  doc.imageCapture(destFile, activeAB.artboardRect, options);
	
	}
}

// DRAW
function draw(nbr){
	var p = doc.selection[0]; 
    for (index = 0; index <  1; index =+ 1) {
	value = index+1 / 100;
	xmlstring = '<LiveEffect name="Adobe Deform"><Dict data="B Rotate 0 R DeformVert 0 R DeformHoriz 0 I DeformStyle 12 R DeformValue #value "/></LiveEffect>'.replace('#value', value);	
    p.applyEffect(xmlstring);
	app.redraw();
};
    }

function copyartboard(){
    var doc = app.activeDocument;
    var thisBoardIndex = doc.artboards.getActiveArtboardIndex();
    var thisBoard = doc.artboards[thisBoardIndex];
    var thisRect = thisBoard.artboardRect;
    var lastBoard = doc.artboards[doc.artboards.length - 1];
    var lastRect = lastBoard.artboardRect;
    doc.selectObjectsOnActiveArtboard();
    app.copy();
    var newBoard = doc.artboards.add(thisRect);
    var offsetH = 0;
    //$.writeln(doc.selection[active]);
    newBoard.artboardRect = [
        lastRect[2] + offsetH,
        lastRect[1],
        lastRect[2] + offsetH + (thisRect[2] - thisRect[0]),
        lastRect[3]
    ];
    newBoard.name = thisBoard.name + " copy";
    app.executeMenuCommand("pasteFront");
    doc.selection = null;
};

function go(nbr){
for (index = 0; index < nbr ; index++) {
	copyartboard();
};
for (active = 0; active < nbr ; active++) {
	draw(nbr,active);
};
//save();
}
go(nbr);

 

Silly-V
Legend
September 27, 2019
For one there is a syntax error and you are using "=+" when you mean to use "+="
CarlosCanto
Community Expert
Community Expert
September 21, 2019

check my example code in this thread and change the Deform Style from 9 to 12

 

https://community.adobe.com/t5/Illustrator/How-to-create-envolope-Text-in-C-with-ExecuteMenuCommand/td-p/10080527

Participant
September 22, 2019
Hi Carlos, thanks for your answer ! Script works ! Now, I want it to export at each percentage change in the effect. For example if I have got a square and apply it a 80% fisheye effect, I would like the script to go at 1%, save png, 2% save png, and so... Any idea where I can find a similar script to combine both ? Thanks in advance !