Calendar for one of 98 years!

Upload Photoshop Scripts, download Photoshop Scripts, Discussion and Support of Photoshop Scripts

Moderators: xbytor, DavideBarranca, Paul MR

User avatar
Kukurykus
Posts: 166
Joined: Mon Jul 25, 2016 12:36 pm

Calendar for one of 98 years!

Postby Kukurykus » 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...

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)
}
There is polish version of Holidays, for those who want to replace them with their country holidays play with this part of code:

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))
}
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)
Attachments
Calendar.rar
(5.42 KiB) Downloaded 201 times
Last edited by Kukurykus on Tue Jan 03, 2017 3:04 am, edited 1 time in total.

pixxxelschubser
Posts: 26
Joined: Mon Aug 01, 2016 8:59 pm

Re: Calendar for one of 98 years!

Postby pixxxelschubser » Sun Jan 01, 2017 2:15 pm

Nice give away and a good work

One note: Please restore the screen mode after all is done. Eg. add:

Code: Select all

runMenuItem(app.stringIDToTypeID("screenModeStandard"));

User avatar
Kukurykus
Posts: 166
Joined: Mon Jul 25, 2016 12:36 pm

Re: Calendar for one of 98 years!

Postby Kukurykus » Sun Jan 01, 2017 2:47 pm

Thank you for comment. That was my intention, for better impression in the result. You care there can be people they don't aware they have to press f key (by default) to change screen mode. If so I simply can add alert at end of script saying of :)

Btw. I read already half of those topics about RegEx you linked me in other theard. Js and particular Ps Regex is as it is, fortunatelly you can do workarounds, so nothing is lost. Too bad that Adobe team after they got to know something is wrong they didn't fix it in fully :(

Ps. i'll do so like you wish later, so I use that additional code line, and alert with some text, or simply perhaps $.sleep(3000) :)

pixxxelschubser
Posts: 26
Joined: Mon Aug 01, 2016 8:59 pm

Re: Calendar for one of 98 years!

Postby pixxxelschubser » Sun Jan 01, 2017 4:47 pm

$.sleep(3000)
:D

Yes. That seems possible.
;)
Many inexperienced users use scripts and they expect eg the same ruler units as before or the same work space as before. Otherwise you get questions like:
"Where are my palettes after running script?"

pixxxelschubser
Posts: 26
Joined: Mon Aug 01, 2016 8:59 pm

Re: Calendar for one of 98 years!

Postby pixxxelschubser » Sun Jan 01, 2017 11:14 pm

Me again.

Did you played with preferences transparency grid (changed to black/black) ?
If so, this point should be urgently restored after running script!

User avatar
Kukurykus
Posts: 166
Joined: Mon Jul 25, 2016 12:36 pm

Re: Calendar for one of 98 years!

Postby Kukurykus » Mon Jan 02, 2017 12:50 am

I'm in Adobe documentation but can't find first and second colour transpareny. There is only GamutWarning from that section. When you are in JavaScript Refference Guide don't you see any preference bound to this transparency point? I used Action Manager to set other colours (black and black). I can check original colours of Photoshop, and restore them the same way I set Black and Black. That is not a point of course, because someone could alredy change them. I hope there is such preference in documentation so I use it to restore them at end of script. Let me only know you know which ones they are unless I find them before you :) Ah, there is gridSize but I can't still find anything like gridColor, and you?

Btw, I know some thigns, probably color state of traspareny can be read from action manager. not directly, but some way I never used, and I don't know how to be honest. Do you know how to call those keys, values, properties etc ?

User avatar
txuku
Posts: 63
Joined: Thu Jan 01, 1970 12:00 am

Re: Calendar for one of 98 years!

Postby txuku » Mon Jan 02, 2017 10:15 am

Bonjour

CS5 Francais

I tested your script and towards the end (3 minutes) I had the alert "Cancellation"

I deleted try catch

And the error text was the following

Code: Select all

Error 8800: A general error in Photoshop has occurred. This function may not be available in this version of Photoshop.
- The current parameters of the "Define" command are not correct.
Line: 224
-> executeAction (sTT ('set'), dsc1, DialogModes.NO);
Image

User avatar
Kukurykus
Posts: 166
Joined: Mon Jul 25, 2016 12:36 pm

Re: Calendar for one of 98 years!

Postby Kukurykus » Mon Jan 02, 2017 11:58 am

Yes, I know about it. I got the same when I used english wrote script on polish Ps version. Fortunately it's a question of just one word. You must change one word "Linerar" to your french equivalent in this code:

Code: Select all

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') // <--- translate this "Linear" word
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);
}
If translation won't give result you need then simply record following action, and check result in ScriptListenerJS.log:

Add effects to your layer, and in drop shadow I think you must choose specific counter, but I don't remember well, maybe that wasn't counter.


Btw. too bad it takes for you so long (3 mins). On my computer it's half of this, and on one of computer in my work it's under one minute.

pixxxelschubser
Posts: 26
Joined: Mon Aug 01, 2016 8:59 pm

Re: Calendar for one of 98 years!

Postby pixxxelschubser » Mon Jan 02, 2017 7:37 pm

I'm in Adobe documentation but can't find first and second colour transpareny. There is only GamutWarning from that section. When you are in JavaScript Refference Guide don't you see any preference bound to this transparency point? I used Action Manager to set other colours (black and black). I can check original colours of Photoshop, and restore them the same way I set Black and Black. That is not a point of course, because someone could alredy change them. I hope there is such preference in documentation so I use it to restore them at end of script. Let me only know you know which ones they are unless I find them before you :) Ah, there is gridSize but I can't still find anything like gridColor, and you?

Btw, I know some thigns, probably color state of traspareny can be read from action manager. not directly, but some way I never used, and I don't know how to be honest. Do you know how to call those keys, values, properties etc ?
Two ways:

Code: Select all

// xtools
function changeTransparencyGridColors2lightColored_1() {
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };

var desc3 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty( cTID('Prpr'), cTID('TrnP') );
ref1.putEnumerated( cTID('capp'), cTID('Ordn'), cTID('Trgt') );
desc3.putReference( cTID('null'), ref1 );
var desc4 = new ActionDescriptor();
desc4.putEnumerated( cTID('TrnC'), cTID('Trnl'), cTID('Lgt ') );
desc3.putObject( cTID('T '), cTID('TrnP'), desc4 );
executeAction( cTID('setd'), desc3, DialogModes.NO );
};
changeTransparencyGridColors2lightColored_1 ();
alert ("changing _1 successful");

// ------------------------------------------------------------------------------------------------------------------------------------------


// your own cTID2sTID changer
function cTT(v) {return charIDToTypeID(v)}; function sTT(v) {return stringIDToTypeID(v)}

function changeTransparencyGridColors2lightColored_2() {
(ref1 = new ActionReference()).putProperty(sTT('property'), sTT('transparencyPrefs'))
ref1.putEnumerated(sTT('application'), sTT('ordinal'), sTT('targetEnum'));
(dsc1 = new ActionDescriptor()).putReference(sTT('null'), ref1);
(dsc2 = new ActionDescriptor()).putEnumerated(sTT('transparencyGridColors'), sTT('transparencyGridColorsType'), sTT('light'))
dsc1.putObject(sTT('to'), sTT('transparencyPrefs'), dsc2)
executeAction(sTT('set'), dsc1, DialogModes.NO)

}
changeTransparencyGridColors2lightColored_2();
alert ("changing _2 successful");

Btw
3:30min (but running from ESTK with active ScriptListener)

User avatar
txuku
Posts: 63
Joined: Thu Jan 01, 1970 12:00 am

Re: Calendar for one of 98 years!

Postby txuku » Mon Jan 02, 2017 8:34 pm

I'm coming to the end !

'Linéaire' works. :)


Return to “Photoshop Scripts”

Who is online

Users browsing this forum: No registered users and 6 guests