Script change from CS6 to CC 2017
Posted: Mon Jul 10, 2017 10:41 am
I have been using the following java script with the Adobe Illustrator configurator i Switch for a long time. It simply crops to the art box and add a margin of 3 pixels. Up until now it has been running in Illustrator CS6. After upgrading to CC 2017 Switch returns an error that says: "Dynamic property 'jobIdentifier' has invalid value ''. I'm not a scripting expert and is wondering what has changed since this script that works fine in CS6 doesn't work in CC 2017?
Code: Select all
if (app.documents.length > 0)
{
//alert("more than 0");
var idoc = app.activeDocument;
var pageItemsCount = idoc.pageItems.length;
if (pageItemsCount>=1)
{
var margins = 3;
if (margins>=0)
{
var activeABindex = idoc.artboards.getActiveArtboardIndex();
var newAB = idoc.artboards[activeABindex];
var iartBounds = idoc.visibleBounds;
var ableft = iartBounds[0]-margins;
var abtop = iartBounds[1]+margins;
var abright = iartBounds[2]+margins;
var abbottom = iartBounds[3]-margins;
newAB.artboardRect = [ableft, abtop, abright, abbottom];
var myZoom = idoc.activeView.zoom;
idoc.activeView.zoom = myZoom+.01;
idoc.activeView.zoom = myZoom;
}
else
{
alert("nos vamos");
}
}
else
{
alert("there is no art in the active document");
}
}
else
{
alert ("there are no open documents");
}