Sg2.9
Version number in illustrator
Recent RSS
Version number in illustrator
From:  David
Date:  6. July 2010, 09:23

I would like to be able to run a script to update the artwork slug that we always run in the bottom of our artwork. I have found a script that does most of what I require. There are pre-defined boxes that are filled by the script:

#target illustrator

function main() {
if (app.documents.length == 0) {
alert("Please have an 'Illustrator' document before running this script.");
return;
}
var docRef = app.activeDocument;
with (docRef) {
if (saved == false) save();
var filePath = path;
if (inCollection(textFrames, 'titleblock-file')) {
var frameA = textFrames.getByName('titleblock-file');
frameA.contents = name;
}
if (inCollection(textFrames, 'titleblock-path')) {
var frameB = textFrames.getByName('titleblock-path');
frameB.contents = unescape(fullName);
}
if (inCollection(textFrames, 'titleblock-version')) {
var frameC = textFrames.getByName('titleblock-version');
if (filePath.created != null) {
var verNum = 0;
verNum++;
frameC.contents = verNum;
}
}
if (inCollection(textFrames, 'titleblock-revised')) {
var frameD = textFrames.getByName('titleblock-revised');
if (filePath.modified != null) {
var modDate = filePath.modified.toString().split(' ');
var modDate = modDate[1] + ' ' + modDate[2] + ' ' + modDate[3];
frameD.contents = modDate;
}
}
if (inCollection(textFrames, 'titleblock-editor')) {
var frameE = textFrames.getByName('titleblock-editor');
frameE.contents = 'DW'
}
}
}

main();

function inCollection(objArray, nameString) {
var x = false;
for (var i = 0; i < objArray.length; i++) {
if (objArray[i].name == nameString) x = true;
}
return x;
}

The bit about verNum is mine! And it doesn't work as intended. I imagine I need to somehow grab the existing number from the text frame in Illustrator and then increment it. But have no idea how to do so.

Any help greatly appreciated

Re: Version number in illustrator
From:  Jürg Lehni
Date:  6. July 2010, 20:44

The posted code here looks like it's not written for Scriptographer but for Adobe's ExtendScript instead. We cannot help with such scripts here, there are other places for that. But if you'd like to rewrite this script for Scriptographer, we could give you a hand.

Re: Version number in illustrator
From:  David
Date:  7. July 2010, 04:39

Thanks for that Jürg. I think it's probably best if I look elsewhere.

Dave

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Variator 08.01.12