Copy link to clipboard
Copied
I've came across this script Scripting Help! Batch color swap between libraries. My question about this is. How would i edit this to make multiple columns per page as opposed to listing them in one column? THis works great For if we make a color book. however we would also like to print a Roll of swatches. IF this is insanely complex i'll just use this one.
Here's the script thats working so far.. This was made by "Trevor×… "
// Script by Trevor to make CMYK color Swabs http://forums.adobe.com/message/4890389#4890389
var il = app.scriptPreferences.userInteractionLevel;
- app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
- app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Make CMYK Swabs");
- app.scriptPreferences.userInteractionLevel = il;
function main()
{
var swatchDoc, doc, swatchColors, l, newSwatch, newSwatchName, cv, ps, m, mtb, tb, ms, tf, ptf;
swatchDoc = app.activeDocument;
setupDoc();
app.activeDocument = doc;
swatchColors = swatchDoc.swatches.everyItem().getElements();
l = swatchColors.length;
while (l--)
{
if (swatchColors
.name != "None" && swatchColors .name != "Registration" && swatchColors .name != "Paper") {
newSwatch = doc.colors.add ({model: swatchColors
.model, space: swatchColors .space, colorValue: swatchColors .colorValue}); newSwatch.space = ColorSpace.CMYK;
cv = newSwatch.colorValue;
newSwatchName = "C="+cv[0]+ " M="+cv[1]+ " Y="+cv[2]+ " K="+cv[3];
newSwatch.name = (doc.swatches.itemByName(newSwatchName).isValid) ? newSwatch.name : newSwatchName;
ps.insertionPoints[0].contents = "\r"+swatchColors
.name+"\r"+newSwatch.name+"\r" ps.insertionPoints[0].rectangles.add({geometricBounds:[0, 0, "15mm", "45mm"], fillColor: newSwatch.name /* appliedObjectStyle: myStyle */});
};
}
ps.overflows ? addPages(tf): 0;
function setupDoc()
{
doc = app.documents.add({documentPreferences:{facingPages:0, pageOrientation: PageOrientation.PORTRAIT}});
m = doc.pages[0].marginPreferences;
mtb = doc.pages[0].bounds;
tb = doc.pages[0].bounds;
mtb[0]=mtb[2]-m.bottom;
ms = doc.masterSpreads[0].textFrames.add ({geometricBounds:mtb, textFramePreferences:{verticalJustification:VerticalJustification.CENTER_ALIGN}});
ms.parentStory.properties = ({digitsType: DigitsTypeOptions.ARABIC_DIGITS, hyphenation: 0, justification: Justification.CENTER_ALIGN, paragraphDirection: ParagraphDirectionOptions.LEFT_TO_RIGHT_DIRECTION, contents: SpecialCharacters.AUTO_PAGE_NUMBER});
tb[0] += m.top; tb[1]+=m.left; tb[2]-=m.bottom; tb[3]-=m.right;
tf = doc.pages[0].textFrames.add({geometricBounds:tb})
ps= tf.parentStory;
ps.properties = {digitsType: DigitsTypeOptions.ARABIC_DIGITS, hyphenation: 0, justification: Justification.LEFT_ALIGN, paragraphDirection: ParagraphDirectionOptions.LEFT_TO_RIGHT_DIRECTION, rightIndent: 2};
}
function addPages(ptf)
{
np = doc.pages.add();
ptf = np.textFrames.add({geometricBounds:tb, previousTextFrame: ptf});
if (ps.overflows) addPages(ptf);
}
}
Thanks
Chris
Hi Chris
,
Here's a video you might enjoy
To see in full-screen high res you can go strait to Custom Swatch Book Maker on Vimeo
A wide range of music there so other might want to watch too.
Enjoy.
Copy link to clipboard
Copied
Hi Chris
,
Here's a video you might enjoy
To see in full-screen high res you can go strait to Custom Swatch Book Maker on Vimeo
A wide range of music there so other might want to watch too.
Enjoy.
Copy link to clipboard
Copied
Sorry it took me so long. i was on vacation. Thank you. I'll watch it today.