Calendar for one of 98 years!
Posted: Sun Jan 01, 2017 6:56 am
Make sure you tickied on Redraw in Ps preferences, then close and open your Photoshop to see live creation of Calendar.
Ps. If you find it doesn't fully work in other versions than CS 5.1 and probably CS 6 let me know, I'll see what I can do...
There is polish version of Holidays, for those who want to replace them with their country holidays play with this part of code:
If you don't know how I may help in this topic. You can simply change content of MNT function to empty, ie. function MNT() {}, so thre won't be specified any additional days for orange colour.
DOWNLOAD BOTH TWO FILES:
(+3 times before replacement)
Ps. If you find it doesn't fully work in other versions than CS 5.1 and probably CS 6 let me know, I'll see what I can do...
Code: Select all
try {
var eft = "fit('screenModeFullScreen'); fit('FtOn')"
// SHORTENED FUNCTION NAMES OF ACTION MANAGER:
function cTT(v) {return charIDToTypeID(v)}; function sTT(v) {return stringIDToTypeID(v)}
function TaG(bR, bG, bB, fR, fG, fB) {// TRANSPARARENCY COLOR CHANGE:
(ref = new ActionReference()).putProperty(cTT('Prpr'), t = cTT('TrnP')), ref.putEnumerated(cTT('capp'), cTT('Ordn'), cTT('Trgt'));
(dsc2 = new ActionDescriptor()).putEnumerated(cTT('TrnC'), cTT('Trnl'), cTT('Cst '));
for(i = 4, n = -1; i > 2; i--) {
eval("((d = dsc" + i + " = new ActionDescriptor())).putDouble(r = cTT('Rd '), arguments[++n]),\
d.putDouble(g = cTT('Grn '), arguments[++n]), d.putDouble(b = cTT('Bl '), arguments[++n])")
dsc2.putObject(cTT(i == 4 ?'BckC' : 'FrgC'), rgb = cTT('RGBC'), eval("dsc" + i)); if (arguments.length == 3) n = -1
}
(dsc1 = new ActionDescriptor()).putReference(cTT('null'), ref), dsc1.putObject(cTT('T '), t, dsc2);
executeAction(cTT('setd'), dsc1, DialogModes.NO)
}
function cBC(v1, v2, v3) {// FULL SCREEN MODE COLOR CHANGE:
(ref = new ActionReference()).putProperty(cTT('Prpr'), iP = sTT('interfacePrefs')), ref.putEnumerated(cTT('capp'), cTT('Ordn'), cTT('Trgt'));
function dsc(v) {return eval('dsc' + v + ' = new ActionDescriptor()')}; (dsc(1)).putReference(cTT('null'), ref);
(dsc(3)).putEnumerated(sTT('screenMode'), sTT('canvasScreenMode'), sTT('screenModeFullScreen'))
if (!isNaN(v1)) {
cBC('Cstm'); var dsc4; for(i = 0; i < (arr = ['Rd ', 'Grn ', 'Bl ']).length; i ++) (dsc4 || dsc(4)).putDouble(cTT(arr[i]), arguments[i])
dsc3.putObject(cTT('Clr '), cTT('RGBC'), dsc4)
}
else dsc3.putEnumerated(sTT('canvasColorMode'), sTT('canvasColorType'), cTT(v1)); (lst = new ActionList()).putObject(sTT('canvasAttributes'), dsc3);
(dsc(2)).putList(sTT('canvasBackgroundColors'), lst), dsc1.putObject(cTT('T '), iP, dsc2), executeAction(cTT('setd'), dsc1, DialogModes.NO)
}
function CLM(v1, v2, v3) {// CANAL / MASK / LAYER WITH TRANSPARENCY SELECTION:
(ref1 = new ActionReference()).putProperty(c = cTT('Chnl'), cTT('fsel'));
eval('(ref2 = new ActionReference())' + (v = (v1 && v2) ? '.putEnumerated(c, cTT(v1), cTT(v2))' : ''))
if (v3) ref2.putName(cTT(v ? 'Lyr ' : 'Chnl'), v3); (dsc = new ActionDescriptor()).putReference(cTT('null'), ref1)
dsc.putReference(cTT('T '), ref2), executeAction(cTT('setd'), dsc, DialogModes.NO)
}
function aTS(v1, v2) {// (SEQUENTIAL) SELECTION OF (CERTAIN) LAYERS
(ref = new ActionReference()).putName(cTT('Lyr '), v1.name || v1);
(dsc = new ActionDescriptor()).putReference(cTT('null'), ref)
dsc.putEnumerated(sTT('selectionModifier'), sTT('selectionModifierType'), sTT(v2))
dsc.putBoolean(cTT('MkVs'), false), executeAction(cTT('slct'), dsc, DialogModes.NO);
}
function sAL() {// ALL LAYERS SELECTION:
(ref1 = new ActionReference()).putEnumerated(sTT('layer'), sTT('ordinal'), sTT('targetEnum'));
(dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref1)
executeAction(sTT('selectAllLayers'), dsc1, DialogModes.NO);
}
function fit(ft) {// SCREEN FITTING:
tle = RegExp(tV = 'tileVertically').test(ft) ? (/^\d\.|10/.test(version) ? tV : ((function(){if (documents.length == 2) fit('consolidateAllTabs')})(), 'Tile')) : ft;
(ref = new ActionReference()).putEnumerated(cTT('Mn '), cTT('MnIt'), eval((tle.length <= 4 ? 'c' : 's') + 'TT(tle)'));
(dsc = new ActionDescriptor()).putReference(cTT('null'), ref), executeAction(cTT('slct'), dsc, DialogModes.NO)
}
// CLOSING ALL OPENED FILES WITHOUT SAVING:
function ZAM(v) {if (documents.length) for(d = documents.length - 1; d >= 0; d--) documents[d].close(v ? SaveOptions.DONOTSAVECHANGES : null)}
// LAYER MEASURE:
function bnd(v1) {for(var i = 0, o = {}; i < (b = activeDocument.activeLayer.bounds).length; i++) o[i + 1] = b[i]; if (v1) return bW = o[3] - o[1]; return bH = o[4] - o[2]}
// EFFECTS COPYING:
function coE(v) {executeAction(sTT('copyEffects'), undefined, DialogModes.NO)}
// EFFECTS PASTING:
function paE(v) {executeAction(sTT('pasteEffects'), (dsc1 = new ActionDescriptor()), DialogModes.NO)}
#target photoshop
displayDialogs = DialogModes.NO, preferences.rulerUnits = Units.PIXELS, TaG(0, 0, 0), cBC('Blck')
doc = documents.add(UnitValue("25.4 cm"), UnitValue("35.5 cm"), 300, nme = 'Calendar', null, nD()), fit('FtOn'), eval(eft);
function nD() {(SC = SolidColor).rgb.hexValue = 'ffaf00', backgroundColor = SC; return DocumentFill.TRANSPARENT}
mns = {
1: ['JANUARY', 31], 2: ['FEBRUARY', 28], 3: ['MARCH', 31], 4: ['APRIL', 30], 5: ['MAY', 31], 6: ['JUNE', 30],
7: ['JULY', 31], 8: ['AUGUST', 31], 9: ['SEPTEMBER', 30], 10: ['OCTOBER', 31], 11: ['NOVEMBER', 30], 12: ['DECEMBER', 31]
}
function dat() {
grp1 = (win = new Window ('dialog')).add ('group')
txt = 'Enter the year from range of 2001 - 2099 you\'d like to create calendar from, '
txt += 'and then choose an initializing month:', grp1.add ('statictext', undefined, txt),
txt = grp1.add ('edittext {preferredSize: [36, 18], active: true}'), grp = win.add('group')
n = 0, lst = []; for(i in mns) lst.push(mns[i][0]), eval('button' + n++ + " = grp.add('button', undefined, lst[n - 1])")
for(i = 0; i < 12; i++) eval('button' + i + '.onClick = function() {btn = button' + i + '.text, win.close()}'); win.show()
for(i = 0; i < lst.length; i++) if (lst[i] == btn) {M = i + 1; break}
}
txt = ''; while(!(txt = txt .text) || txt < 2001 || txt > 2099 || isNaN(txt)) dat(); R = +txt
function crt() {for(B = Array(14), i = 0; i < B.length; i++) {B[i] = [ ,]} return B = [B]}; arr = crt(), ARR = crt()
function I(v) {return i = ((R + v - 2001) * 365) + ~~((R + v - 2000) / 4)}; I(0), n = 0, o = false, j = false
function N(v) {ARR[0][n][0] = mns[m][0], ARR[0][n][1] = R + v, arr[0][n][0] = mns[m][1]}
function MNS() {
for(m in mns) {
if (!j) {
if (!o && m < M) {i = i + mns[m][1]; continue}; if (o && m >= M + 2) break;
if (o && m <= M + 1) N(1), n++; if (!o && m >= M) N(0), n++
arr[0][n - 1][1] = ~~((i) % 7), i = i + arr[0][n - 1][0]
}
if (j) {N(1), arr[0][n][1] = ~~((I(2)) % 7); if (j) break}
}
o = true
}
MNS(), MNS(); if (M == 12) j = true, MNS()
rmv = ARR[0].splice(7, 7), ARR = [ARR[0]].concat([rmv]), rmv = arr[0].splice(7, 7), arr = [arr[0]].concat([rmv])
day = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
function kal(v1, v2, v3, v4, v11, v12) {
for(x = ((c = (v1 + (v2 - 1)) / 5) >= 7 ? c = (~~c - 1) : (c == 5.4 ? 4 : 5)), n = 0, k = 0; k < eval(v3); k++) {
for(j = eval(v4); j < y = 7; j++) {
if (!v1) break; eval(v12),
(sel = (aD = documents.length < 2 ? documents.add(UnitValue((!+arguments[2] ? x : 1) * .44 +' cm'),
UnitValue('2.66 cm'), 300, 'month', null, DocumentFill.TRANSPARENT) : aD).selection)
.select([[((w = aD.width) / x) * k, (h = aD.height) / y * j], [(w / x) * k + (w / x), h / y * j],
[(w / x) * k + (w / x), h / y * (j + 1)], [(w / x) * k, h / y * (j + 1)]]), eval(v11), aD.artLayers.add(), aD.paste(), v1--
}
}
aD.layers[aD.layers.length - 1].remove(), sAL(), aD.mergeVisibleLayers(),
(sel = aD.selection).selectAll(), sel.copy(), aD.close(SaveOptions.DONOTSAVECHANGES)
}
function KAL(v1, v2, v3, v4, v5) {
for(K = 0; K < arr.length; K++) {for(J = 0; J < 7; J++) {
eval(v1), dW = doc.width + (arr[K] == arr[0] ? 0 : 9750), X = 5, Y = 7.7
doc.selection.select([[(dW / X) * K, doc.height / Y * J], [(dW / X) * K + (dW / X), doc.height / Y * J],
[(dW / X) * K + (dW / X), doc.height / Y * (J + 1)], [(dW / X) * K, doc.height / Y * (J + 1)]]), doc.paste(),
v4 ? ((aL = doc.activeLayer).translate(v2, v3), aL.name = v4 + (((K < 1) ? J : 7 + J) + 1)) :
(doc.activeLayer = doc.layers[doc.layers.length - 1 - (((K < 1) ? J : 7 + J) + 1)],
doc.layers[0].translate(bnd(1) > 286 ? -25 : - 40, 5 + v5))
}}
}
KAL('cal()', null, 250, 'Days of month ')
function cal() {
kal(arr[K][J][0], arr[K][J][1], 'x', 'k == 0 ? v2 : 0',
"if (n < 10) sel.translateBoundary(10, null); if (j == v2) fit('FtOn'), eval(eft)",
"TXT(\"j == 6 || (mnt = MNT()) ? 'ffa000' : (j == 5 ? 'ffff00' : 'ffffff')\",\
'CRISP', \"(mnt = j == 6 || mnt) ? 'Arial-BoldMT' : 'ArialMT'\", 10, '++n',\
\"SC.rgb.hexValue = 'ffffff'; if (mnt) {aD.selection.stroke(SC, 1, StrokeLocation.OUTSIDE), mnt = false}\")"
)
}
kal(31, 6, 1, 0, null, "TXT(\"'ffffff'\", 'STRONG', \"'ArialMT'\", 5, 'day[j]', null)"), KAL(null, -185, 255, 'Days of week ')
KAL("TXT(\"'ffaf00'\", 'STRONG', \"'Arial-BoldMT'\", 12.5, \
\"ARR[K][J][0]\", \"(SC = SolidColor).rgb.hexValue = 'ffffff',\\\
(sel = aD.selection).stroke(SC, 1, StrokeLocation.OUTSIDE)\")", null, null, null, 50)
KAL("TXT(\"'ffffff'\", 'STRONG', \"'Arial-BoldMT'\", 11.5, ARR[K][J][1], null)", null, null, null, 0)
function TXT(v5, v6, v7, v8, v9, v10) {
txt = (aL = (aD = activeDocument).artLayers).add(), txt.kind = LayerKind.TEXT,
(SC = SolidColor).rgb.hexValue = eval(v5); (txt = txt.textItem).antiAliasMethod = eval('AntiAlias.' + v6),
(txt.font = eval(v7)), txt.color = SC, txt.size = v8, txt.contents = eval(v9)
aL[0].rasterize(RasterizeType.TEXTCONTENTS), eval(v10), (sel = aD.selection).selectAll(), sel.cut()
}
function MNT() {
return ((akj = ARR[K][J][0]) == 'JANUARY' && (!n|0 || n == 5)) ||
(/L$/.test(akj) && n == 16) || (/MAY/.test(akj) && (!n|0 || n == 2)) ||
(/E$/.test(akj) && n == 14) || (/T$/.test(akj) && n == 14) ||
(/^N/.test(akj) && (!n|0 || n == 10)) || (/^D/.test(akj) && (n == 23 || n == 24))
}
doc.layers[doc.layers.length - 1].isBackgroundLayer = true
aHS = doc.activeHistoryState, doc.artLayers.add(), (SC = SolidColor).rgb.hexValue = '505080', doc.selection.fill(SC)
doc.activeLayer.resize((425 / doc.width) * 100, (445 / doc.height) * 100, AnchorPosition.MIDDLECENTER)
CLM('Chnl', 'Trsp'), doc.selection.smooth(10), doc.selection.copy(), doc.activeHistoryState = aHS
doc.activeLayer = doc.layers[doc.layers.length - 1], KAL(null, -40, 193, p ='Podkladka ')
function SaS(v) {
(ref1 = new ActionReference()).putEnumerated(sTT('layer'), sTT('ordinal'), sTT('targetEnum'));
(dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref1);
(dsc2 = new ActionDescriptor()).putUnitDouble(sTT('fillOpacity'), sTT('percentUnit'), 33);
(dsc3 = new ActionDescriptor()).putUnitDouble(sTT('scale'), sTT('percentUnit'), 416.666667);
(dsc4 = new ActionDescriptor()).putBoolean(sTT('enabled'), true)
dsc4.putEnumerated(sTT('mode'), sTT('blendMode'), sTT('multiply'));
(dsc5 = new ActionDescriptor()).putDouble(sTT('red'), 0)
dsc5.putDouble(sTT('grain'), 0)
dsc5.putDouble(sTT('blue'), 0)
dsc4.putObject(sTT('color'), sTT('RGBColor'), dsc5)
dsc4.putUnitDouble(sTT('opacity'), sTT('percentUnit'), 75)
dsc4.putBoolean(sTT('useGlobalAngle'), false)
dsc4.putUnitDouble(sTT('localLightingAngle'), sTT('angleUnit'), v)
dsc4.putUnitDouble(sTT('distance'), sTT('pixelsUnit'), 20)
dsc4.putUnitDouble(sTT('chokeMatte'), sTT('pixelsUnit'), 20)
dsc4.putUnitDouble(sTT('blur'), sTT('pixelsUnit'), 70)
dsc4.putUnitDouble(sTT('noise'), sTT('percentUnit'), 0)
dsc4.putBoolean(sTT('antiAlias'), false);
(dsc6 = new ActionDescriptor()).putString(sTT('name'), 'Linear')
dsc4.putObject(sTT('transferSpec'), sTT('shapeCurveType'), dsc6)
dsc4.putBoolean(sTT('layerConceals'), true)
dsc3.putObject(sTT('dropShadow'), sTT('dropShadow'), dsc4);
(dsc7 = new ActionDescriptor()).putBoolean(sTT('enabled'), true)
dsc7.putEnumerated(sTT('style'), sTT('frameStyle'), sTT('outsetFrame'))
dsc7.putEnumerated(sTT('paintType'), sTT('frameFill'), sTT('solidColor'))
dsc7.putEnumerated(sTT('mode'), sTT('blendMode'), sTT('normal'))
dsc7.putUnitDouble(sTT('opacity'), sTT('percentUnit'), 100)
dsc7.putUnitDouble(sTT('size'), sTT('pixelsUnit'), 10);
(dsc8 = new ActionDescriptor()).putDouble(sTT('red'), 255)
dsc8.putDouble(sTT('grain'), 255)
dsc8.putDouble(sTT('blue'), 255)
dsc7.putObject(sTT('color'), sTT('RGBColor'), dsc8)
dsc3.putObject(sTT('frameFX'), sTT('frameFX'), dsc7)
dsc2.putObject(sTT('layerEffects'), sTT('layerEffects'), dsc3)
dsc1.putObject(sTT('to'), sTT('layer'), dsc2)
executeAction(sTT('set'), dsc1, DialogModes.NO);
}
SaS(120), coE(), aTS(p + 8, 'addToSelectionContinuous'), paE(), doc.activeLayer = doc.layers.getByName(p + 7)
SaS(60), coE(), aTS(p + 1, 'addToSelectionContinuous'), paE(), doc.activeLayer = (bG = doc.layers[doc.layers.length - 1])
bG.visible = false, sAL(), doc.mergeVisibleLayers(), doc.activeLayer.name = nme, doc.selection.selectAll(), doc.selection.copy()
doc.selection.deselect(), doc.activeLayer = bG;
(ref1 = new ActionReference()).putClass(sTT('contentLayer'));
(dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref1);
(dsc2 = new ActionDescriptor()).putString(sTT('name'), 'Tunnel')
dsc2.putEnumerated(sTT('color'), sTT('color'), sTT('violet'));
(dsc3 = new ActionDescriptor()).putBoolean(sTT('reverse'), true)
dsc3.putUnitDouble(sTT('angle'), sTT('angleUnit'), 45)
dsc3.putEnumerated(sTT('type'), sTT('gradientType'), sTT('diamond'));
(dsc4 = new ActionDescriptor()).putString(sTT('name'), 'Custom')
dsc4.putEnumerated(sTT('gradientForm'), sTT('gradientForm'), sTT('customStops'))
dsc4.putDouble(sTT('interfaceIconFrameDimmed'), 4096);
(dsc6 = new ActionDescriptor()).putDouble(sTT('red'), 95.002441)
dsc6.putDouble(sTT('grain'), 47.003174)
dsc6.putDouble(sTT('blue'), 95.002441);
(dsc5 = new ActionDescriptor()).putObject(sTT('color'), sTT('RGBColor'), dsc6)
dsc5.putEnumerated(sTT('type'), sTT('colorStopType'), sTT('userStop'))
dsc5.putInteger(sTT('location'), 0)
dsc5.putInteger(sTT('midpoint'), 50);
(lst1 = new ActionList()).putObject(sTT('colorStop'), dsc5);
(dsc8 = new ActionDescriptor()).putDouble(sTT('red'), 95.002441)
dsc8.putDouble(sTT('grain'), 47.003174)
dsc8.putDouble(sTT('blue'), 95.002441);
(dsc7 = new ActionDescriptor()).putObject(sTT('color'), sTT('RGBColor'), dsc8)
dsc7.putEnumerated(sTT('type'), sTT('colorStopType'), sTT('userStop'))
dsc7.putInteger(sTT('location'), 4096)
dsc7.putInteger(sTT('midpoint'), 50)
lst1.putObject(sTT('colorStop'), dsc7)
dsc4.putList(sTT('colors'), lst1);
(dsc9 = new ActionDescriptor()).putUnitDouble(sTT('opacity'), sTT('percentUnit'), 100)
dsc9.putInteger(sTT('location'), 0)
dsc9.putInteger(sTT('midpoint'), 50);
(lst2 = new ActionList()).putObject(sTT('transferSpec'), dsc9);
(dsc10 = new ActionDescriptor()).putUnitDouble(sTT('opacity'), sTT('percentUnit'), 0)
dsc10.putInteger(sTT('location'), 3277)
dsc10.putInteger(sTT('midpoint'), 50)
lst2.putObject(sTT('transferSpec'), dsc10)
dsc4.putList(sTT('transparency'), lst2)
dsc3.putObject(sTT('gradient'), sTT('gradientClassEvent'), dsc4)
dsc2.putObject(sTT('type'), sTT('gradientLayer'), dsc3)
dsc1.putObject(sTT('using'), sTT('contentLayer'), dsc2)
executeAction(sTT('make'), dsc1, DialogModes.NO);
(dsc1 = new ActionDescriptor()).putEnumerated(cTT("GEfk" ), cTT("GEfk" ), sTT('diffuseGlow'))
dsc1.putInteger(sTT('graininess'), 10)
dsc1.putInteger(sTT('glowAmount'), 5)
dsc1.putInteger(sTT('clearAmount'), 10)
executeAction(sTT('diffuseGlow'), dsc1, DialogModes.NO);
(dsc1 = new ActionDescriptor()).putEnumerated(sTT('presetKind'), sTT('presetKindType'), sTT('presetKindCustom'));
(ref1 = new ActionReference()).putEnumerated(sTT('channel'), sTT('channel'), sTT('composite'));
(dsc2 = new ActionDescriptor()).putReference(sTT('channel'), ref1)
dsc2.putDouble(sTT('gamma'), 3);
(lst1 = new ActionList()).putObject(sTT('levelsAdjustment'), dsc2);
(ref2 = new ActionReference()).putEnumerated(sTT('channel'), sTT('channel'), sTT('red'));
(dsc3 = new ActionDescriptor()).putReference(sTT('channel'), ref2)
dsc3.putDouble(sTT('gamma'), 4)
lst1.putObject(sTT('levelsAdjustment'), dsc3);
(ref3 = new ActionReference()).putEnumerated(sTT('channel'), sTT('channel'), sTT('blue'));
(dsc4 = new ActionDescriptor()).putReference(sTT('channel'), ref3)
dsc4.putDouble(sTT('gamma'), 0.1)
lst1.putObject(sTT('levelsAdjustment'), dsc4)
dsc1.putList(sTT('adjustment'), lst1)
executeAction(sTT('levels'), dsc1, DialogModes.NO)
bG.remove(), doc.mergeVisibleLayers()
}catch(err) {
alert('Cancellation'), ZAM(true)
}
Code: Select all
function MNT() {
return ((akj = ARR[K][J][0]) == 'JANUARY' && (!n|0 || n == 5)) ||
(/L$/.test(akj) && n == 16) || (/MAY/.test(akj) && (!n|0 || n == 2)) ||
(/E$/.test(akj) && n == 14) || (/T$/.test(akj) && n == 14) ||
(/^N/.test(akj) && (!n|0 || n == 10)) || (/^D/.test(akj) && (n == 23 || n == 24))
}
DOWNLOAD BOTH TWO FILES:
(+3 times before replacement)