Copy link to clipboard
Copied
Does anyone have a script for a slug that they are willing to share. I suck at this scripting stuff, but want to learn.
My needs are: Filename, Version #, Date Created, Date Modified, Colours used, Page Size, Proof output at %.
Thanks in advance.
Copy link to clipboard
Copied
(DAMN the Jive editor!! Starting over.)
This script displays a dialog, filling in as much as possible. Sorry, the explanation was quite a bit longer, but DAMN the Jive Editor!!
//DESCRIPTION:Slug fill-in
// Jongware, 12-Sep-2009// Create a list of colors used
allcolors_array = new Array;
for (i=0; i<app.activeDocument.swatches.length; i++)
{
allcolors_array.push (app.activeDocument.swatches.name);
for (j=0; j<app.activeDocument.unusedSwatches.length; j++)
if (app.activeDocument.swatches == app.activeDocument.unusedSwatches)
{
allcolors_array.pop();
break;
}
}colorlist = allcolors_array.join(' / ');
// Create dialog so you can adjust stuff
myDialog = app.dialogs.add ({name:"Slug Fill-in",canCancel:true});today = new Date();
with (myDialog)
{
with (dialogColumns.add())
{
staticTexts.add ({staticLabel:"Filename"});
staticTexts.add ({staticLabel:"Version"});
staticTexts.add ({staticLabel:"Created"});
staticTexts.add ({staticLabel:"Modified"});
staticTexts.add ({staticLabel:"Colors"});
staticTexts.add ({staticLabel:"Page Size"});
}
with (dialogColumns.add())
{
var field1 = textEditboxes.add ({editContents:app.activeDocument.name, minWidth:200});
var field2 = textEditboxes.add ({editContents:"1.0", minWidth:200});
var field3 = textEditboxes.add ({editContents:today.toDateString(), minWidth:200});
var field4 = textEditboxes.add ({editContents:today.toDateString(), minWidth:200});
var field5 = textEditboxes.add ({editContents:colorlist, minWidth:200});
var field6 = textEditboxes.add ({editContents:app.activeDocument.documentPreferences.pageWidth+" x "+app.activeDocument.documentPreferences.pageHeight, minWidth:200});
}
}if (myDialog.show() == false)
exit(0);// Create slug frame
slugframe = app.activeWindow.activePage.textFrames.add ();
slugframe.geometricBounds = [ app.activeDocument.documentPreferences.pageHeight, 0, app.activeDocument.documentPreferences.pageHeight+app.activeDocument.documentPreferences.slugBottomOffset, app.activeDocument.documentPreferences.pageWidth];
slugframe.textFramePreferences.verticalJustification = VerticalJustification.CENTER_ALIGN;
slugframe.insertionPoints[0].justification = Justification.CENTER_ALIGN;
slugframe.insertionPoints[0].fillColor = app.activeDocument.swatches.item("Registration");
slugframe.contents = field1.editContents+" \u2022 "+field2.editContents+" \u2022 "+field3.editContents+" \u2022 "+field4.editContents+" \u2022 "+field5.editContents+" \u2022 "+field6.editContents;
Copy link to clipboard
Copied
Now I've cooled off a bit, here is the slightly longer story. ![]()
As you can see, the new text frame is positioned at (0, pageheight, pagewidth, pageheight + bottom slug height) -- in regular (lx,ly, rx,ry) coordinates (geometricBounds is a bit different). It needs absolute coordinates, and I am assuming the zero ruler point is at the left top of your document.
The slug frame is created on the active page in your current viewing window; perhaps you'd like it to be placed on a master page, or on every single page of the document instead.
As you can see, there is not really a good way to retrieve a 'creation date' -- unless you use a text variable for that! I'd have to look it up, but it is possible to create that and insert into the slug frame.
As for 'version' -- how do you decide this? Perhaps the script could store its current 'version' number into the document, so you can update it by running the script. In that case, I'd think about adding a unique label identifier to the slug text frame, so you can clear it before updating the text.
I forgot to add an output percentage edit field to the dialog, which is easily fixed -- but you need to fill in that text yourself. I don't think I could grab the value from anywhere.
I set the text color of the slug frame to 'Registration', and its horizontal and vertical alignment to centered; if required, it's also possible to set a font and font size. And when I create a color list (by hand), I usually set the color of each name to that color
-- that way, each plate only shows one color name.
Copy link to clipboard
Copied
Thanks for the script, but I keep getting errors in applescript. Am I doing
this right?
From: "[Jongware]" <forums@adobe.com>
Reply-To: <clearspace-1393920936-504487-2-2244319@mail.forums.adobe.com>
Date: Sat, 12 Sep 2009 11:31:18 -0600
To: Attilio Lucchese <attil@sympatico.ca>
//DESCRIPTION:Slug fill-in
// Jongware, 12-Sep-2009
// Create a list of colors used
allcolors_array = new Array;
for (i=0; i<app.activeDocument.swatches.length; i++)
{
allcolors_array.push (app.activeDocument.swatches+.name);
for (j=0; j<app.activeDocument.unusedSwatches.length; j++)
if (app.activeDocument.swatches+ ==
app.activeDocument.unusedSwatches
) {
allcolors_array.pop();
break;
}
}
colorlist = allcolors_array.join(' / ');
// Create dialog so you can adjust stuff
myDialog = app.dialogs.add ();
today = new Date();
with (myDialog)
{
with (dialogColumns.add())
{
staticTexts.add ({staticLabel:"Filename"});
staticTexts.add ();
staticTexts.add ();
staticTexts.add ();
staticTexts.add ();
staticTexts.add ();
}
with (dialogColumns.add())
{
var field1 = textEditboxes.add ({editContents:app.activeDocument.name,
minWidth:200});
var field2 = textEditboxes.add ();
var field3 = textEditboxes.add ();
var field4 = textEditboxes.add ();
var field5 = textEditboxes.add ();
var field6 = textEditboxes.add
();
}
}
if (myDialog.show() == false)
exit(0);
// Create slug frame
slugframe = app.activeWindow.activePage.textFrames.add ();
slugframe.geometricBounds = [
app.activeDocument.documentPreferences.pageHeight, 0,
app.activeDocument.documentPreferences.pageHeight+app.activeDocument.documentP
r eferences.slugBottomOffset,
app.activeDocument.documentPreferences.pageWidth];
slugframe.textFramePreferences.verticalJustification =
VerticalJustification.CENTER_ALIGN;
slugframe.insertionPoints[0].justification = Justification.CENTER_ALIGN;
slugframe.insertionPoints[0].fillColor =
app.activeDocument.swatches.item("Registration");
slugframe.contents = field1.editContents" \u2022 "field2.editContents+"
\u2022 "field3.editContents" \u2022 "field4.editContents" \u2022
"field5.editContents" \u2022 "+field6.editContents;
Copy link to clipboard
Copied
attil wrote:
Thanks for the script, but I keep getting errors in applescript. Am I doing
this right?
this is JavaScript - you need to save this script as SLUG.JSX
robin
www.adobescripts.co.uk
Copy link to clipboard
Copied
So it is. I was so peed off by this editor I forgot my usual "copy-into-ESTK-and-save-as" stuff. Dziękuję, Robert!
Copy link to clipboard
Copied
[Jongware] wrote:
So it is. I was so peed off by this editor I forgot my usual "copy-into-ESTK-and-save-as" stuff. Dziękuję, Robert!
you are welcome ![]()
robin
www.adobescripts.co.uk
Copy link to clipboard
Copied
Hey, Gents. Sorry for the long delay. The script keeps giving me an error in line one. Am i still doing something wrong?
Copy link to clipboard
Copied
you mean these lines ?
From: "[Jongware]" <forums@adobe.com>
Reply-To: <clearspace-1393920936-504487-2-2244319@mail.forums.adobe.com>
Date: Sat, 12 Sep 2009 11:31:18 -0600
To: Attilio Lucchese <attil@sympatico.ca>
Subject: InDesign Scripting Slug Script...
this is header of e-mail - you need to delete it and start script from:
//DESCRIPTION:Slug fill-in
robin
www.adobescripts.co.uk
Copy link to clipboard
Copied
Copy link to clipboard
Copied
A javascript should be saved as plain text. It's your text editor -- TextEdit, probably --, that doesn't live up to its name and saves the document by default as RTF.
Alternatively, use the ESTK Editor that comes with InDesign -- it doesn't have this particular flaw.
Copy link to clipboard
Copied
You guys are awesome. Thank you!
Copy link to clipboard
Copied
Wait, one more thing. Is there any way to make the script run everytime you save the file so i can update the info eg. version and colours???
Copy link to clipboard
Copied
so, is there a way to get the slug to show up on every page in the .indd file?
Copy link to clipboard
Copied
Hello,
I was hoping to extend this script by adding coloured boxes next to each Pantone used.
Can someone point me in the right direction?
Copy link to clipboard
Copied
Maybe this will help you http://forums.adobe.com/message/5027707#5027707
I hope to come out with my pro version of the script in about 2 or3 weeks but it's not exactly what you want.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more