mirror of
https://github.com/sbrow/ps.git
synced 2026-02-27 02:51:44 -05:00
Can now color layers and apply strokes
This commit is contained in:
76
scripts/colorLayer.vbs
Normal file
76
scripts/colorLayer.vbs
Normal file
@@ -0,0 +1,76 @@
|
||||
DIM objApp
|
||||
SET objApp = CreateObject("Photoshop.Application")
|
||||
DIM dialogMode
|
||||
dialogMode = 3
|
||||
DIM idsetd
|
||||
idsetd = objApp.CharIDToTypeID("setd")
|
||||
DIM desc134
|
||||
SET desc134 = CreateObject("Photoshop.ActionDescriptor")
|
||||
DIM idnull
|
||||
idnull = objApp.CharIDToTypeID("null")
|
||||
DIM ref44
|
||||
SET ref44 = CreateObject("Photoshop.ActionReference")
|
||||
DIM idPrpr
|
||||
idPrpr = objApp.CharIDToTypeID("Prpr")
|
||||
DIM idLefx
|
||||
idLefx = objApp.CharIDToTypeID("Lefx")
|
||||
Call ref44.PutProperty(idPrpr, idLefx)
|
||||
DIM idLyr
|
||||
idLyr = objApp.CharIDToTypeID("Lyr ")
|
||||
DIM idOrdn
|
||||
idOrdn = objApp.CharIDToTypeID("Ordn")
|
||||
DIM idTrgt
|
||||
idTrgt = objApp.CharIDToTypeID("Trgt")
|
||||
Call ref44.PutEnumerated(idLyr, idOrdn, idTrgt)
|
||||
Call desc134.PutReference(idnull, ref44)
|
||||
DIM idT
|
||||
idT = objApp.CharIDToTypeID("T ")
|
||||
DIM desc135
|
||||
SET desc135 = CreateObject("Photoshop.ActionDescriptor")
|
||||
DIM idScl
|
||||
idScl = objApp.CharIDToTypeID("Scl ")
|
||||
DIM idPrc
|
||||
idPrc = objApp.CharIDToTypeID("#Prc")
|
||||
Call desc135.PutUnitDouble(idScl, idPrc, 416.666667)
|
||||
DIM idSoFi
|
||||
idSoFi = objApp.CharIDToTypeID("SoFi")
|
||||
DIM desc136
|
||||
SET desc136 = CreateObject("Photoshop.ActionDescriptor")
|
||||
DIM idenab
|
||||
idenab = objApp.CharIDToTypeID("enab")
|
||||
Call desc136.PutBoolean(idenab, True)
|
||||
DIM idMd
|
||||
idMd = objApp.CharIDToTypeID("Md ")
|
||||
DIM idBlnM
|
||||
idBlnM = objApp.CharIDToTypeID("BlnM")
|
||||
DIM idNrml
|
||||
idNrml = objApp.CharIDToTypeID("Nrml")
|
||||
Call desc136.PutEnumerated(idMd, idBlnM, idNrml)
|
||||
DIM idOpct
|
||||
idOpct = objApp.CharIDToTypeID("Opct")
|
||||
idPrc = objApp.CharIDToTypeID("#Prc")
|
||||
Call desc136.PutUnitDouble(idOpct, idPrc, 100.000000)
|
||||
DIM idClr
|
||||
idClr = objApp.CharIDToTypeID("Clr ")
|
||||
DIM desc137
|
||||
SET desc137 = CreateObject("Photoshop.ActionDescriptor")
|
||||
DIM idRd
|
||||
idRd = objApp.CharIDToTypeID("Rd ")
|
||||
Call desc137.PutDouble(idRd, CInt(wScript.Arguments(0)))
|
||||
' Call desc137.PutDouble(idRd, 255)
|
||||
DIM idGrn
|
||||
idGrn = objApp.CharIDToTypeID("Grn ")
|
||||
Call desc137.PutDouble(idGrn, Cint(wScript.Arguments(1)))
|
||||
' Call desc137.PutDouble(idGrn, 255)
|
||||
DIM idBl
|
||||
idBl = objApp.CharIDToTypeID("Bl ")
|
||||
Call desc137.PutDouble(idBl, CInt(wScript.Arguments(2)))
|
||||
' Call desc137.PutDouble(idBl, 255)
|
||||
DIM idRGBC
|
||||
idRGBC = objApp.CharIDToTypeID("RGBC")
|
||||
Call desc136.PutObject(idClr, idRGBC, desc137)
|
||||
idSoFi = objApp.CharIDToTypeID("SoFi")
|
||||
Call desc135.PutObject(idSoFi, idSoFi, desc136)
|
||||
idLefx = objApp.CharIDToTypeID("Lefx")
|
||||
Call desc134.PutObject(idT, idLefx, desc135)
|
||||
Call objApp.ExecuteAction(idsetd, desc134, dialogMode)
|
||||
120
scripts/colorStroke.vbs
Normal file
120
scripts/colorStroke.vbs
Normal file
@@ -0,0 +1,120 @@
|
||||
DIM objApp
|
||||
SET objApp = CreateObject("Photoshop.Application")
|
||||
REM Use dialog mode 3 for show no dialogs
|
||||
DIM dialogMode
|
||||
dialogMode = 3
|
||||
DIM idsetd
|
||||
idsetd = objApp.CharIDToTypeID("setd")
|
||||
DIM desc2
|
||||
SET desc2 = CreateObject("Photoshop.ActionDescriptor")
|
||||
DIM idnull
|
||||
idnull = objApp.CharIDToTypeID("null")
|
||||
DIM ref2
|
||||
SET ref2 = CreateObject("Photoshop.ActionReference")
|
||||
DIM idPrpr
|
||||
idPrpr = objApp.CharIDToTypeID("Prpr")
|
||||
DIM idLefx
|
||||
idLefx = objApp.CharIDToTypeID("Lefx")
|
||||
Call ref2.PutProperty(idPrpr, idLefx)
|
||||
DIM idLyr
|
||||
idLyr = objApp.CharIDToTypeID("Lyr ")
|
||||
DIM idOrdn
|
||||
idOrdn = objApp.CharIDToTypeID("Ordn")
|
||||
DIM idTrgt
|
||||
idTrgt = objApp.CharIDToTypeID("Trgt")
|
||||
Call ref2.PutEnumerated(idLyr, idOrdn, idTrgt)
|
||||
Call desc2.PutReference(idnull, ref2)
|
||||
DIM idT
|
||||
idT = objApp.CharIDToTypeID("T ")
|
||||
DIM desc3
|
||||
SET desc3 = CreateObject("Photoshop.ActionDescriptor")
|
||||
DIM idScl
|
||||
idScl = objApp.CharIDToTypeID("Scl ")
|
||||
DIM idPrc
|
||||
idPrc = objApp.CharIDToTypeID("#Prc")
|
||||
Call desc3.PutUnitDouble(idScl, idPrc, 416.666667)
|
||||
DIM idSoFi
|
||||
idSoFi = objApp.CharIDToTypeID("SoFi")
|
||||
DIM desc4
|
||||
SET desc4 = CreateObject("Photoshop.ActionDescriptor")
|
||||
DIM idenab
|
||||
idenab = objApp.CharIDToTypeID("enab")
|
||||
Call desc4.PutBoolean(idenab, True)
|
||||
DIM idMd
|
||||
idMd = objApp.CharIDToTypeID("Md ")
|
||||
DIM idBlnM
|
||||
idBlnM = objApp.CharIDToTypeID("BlnM")
|
||||
DIM idNrml
|
||||
idNrml = objApp.CharIDToTypeID("Nrml")
|
||||
Call desc4.PutEnumerated(idMd, idBlnM, idNrml)
|
||||
DIM idOpct
|
||||
idOpct = objApp.CharIDToTypeID("Opct")
|
||||
idPrc = objApp.CharIDToTypeID("#Prc")
|
||||
Call desc4.PutUnitDouble(idOpct, idPrc, 100.000000)
|
||||
DIM idClr
|
||||
idClr = objApp.CharIDToTypeID("Clr ")
|
||||
DIM desc5
|
||||
SET desc5 = CreateObject("Photoshop.ActionDescriptor")
|
||||
DIM idRd
|
||||
idRd = objApp.CharIDToTypeID("Rd ")
|
||||
Call desc5.PutDouble(idRd, CInt(wScript.Arguments(0)))
|
||||
DIM idGrn
|
||||
idGrn = objApp.CharIDToTypeID("Grn ")
|
||||
Call desc5.PutDouble(idGrn,CInt(wScript.Arguments(1)))
|
||||
DIM idBl
|
||||
idBl = objApp.CharIDToTypeID("Bl ")
|
||||
Call desc5.PutDouble(idBl, CInt(wScript.Arguments(2)))
|
||||
DIM idRGBC
|
||||
idRGBC = objApp.CharIDToTypeID("RGBC")
|
||||
Call desc4.PutObject(idClr, idRGBC, desc5)
|
||||
idSoFi = objApp.CharIDToTypeID("SoFi")
|
||||
Call desc3.PutObject(idSoFi, idSoFi, desc4)
|
||||
DIM idFrFX
|
||||
idFrFX = objApp.CharIDToTypeID("FrFX")
|
||||
DIM desc6
|
||||
SET desc6 = CreateObject("Photoshop.ActionDescriptor")
|
||||
idenab = objApp.CharIDToTypeID("enab")
|
||||
Call desc6.PutBoolean(idenab, True)
|
||||
DIM idStyl
|
||||
idStyl = objApp.CharIDToTypeID("Styl")
|
||||
DIM idFStl
|
||||
idFStl = objApp.CharIDToTypeID("FStl")
|
||||
DIM idOutF
|
||||
idOutF = objApp.CharIDToTypeID("OutF")
|
||||
Call desc6.PutEnumerated(idStyl, idFStl, idOutF)
|
||||
DIM idPntT
|
||||
idPntT = objApp.CharIDToTypeID("PntT")
|
||||
DIM idFrFl
|
||||
idFrFl = objApp.CharIDToTypeID("FrFl")
|
||||
DIM idSClr
|
||||
idSClr = objApp.CharIDToTypeID("SClr")
|
||||
Call desc6.PutEnumerated(idPntT, idFrFl, idSClr)
|
||||
idMd = objApp.CharIDToTypeID("Md ")
|
||||
idBlnM = objApp.CharIDToTypeID("BlnM")
|
||||
idNrml = objApp.CharIDToTypeID("Nrml")
|
||||
Call desc6.PutEnumerated(idMd, idBlnM, idNrml)
|
||||
idOpct = objApp.CharIDToTypeID("Opct")
|
||||
idPrc = objApp.CharIDToTypeID("#Prc")
|
||||
Call desc6.PutUnitDouble(idOpct, idPrc, 100.000000)
|
||||
DIM idSz
|
||||
idSz = objApp.CharIDToTypeID("Sz ")
|
||||
DIM idPxl
|
||||
idPxl = objApp.CharIDToTypeID("#Pxl")
|
||||
Call desc6.PutUnitDouble(idSz, idPxl, CLng(wScript.Arguments(3)))
|
||||
idClr = objApp.CharIDToTypeID("Clr ")
|
||||
DIM desc7
|
||||
SET desc7 = CreateObject("Photoshop.ActionDescriptor")
|
||||
idRd = objApp.CharIDToTypeID("Rd ")
|
||||
Call desc7.PutDouble(idRd, CInt(wScript.Arguments(4)))
|
||||
idGrn = objApp.CharIDToTypeID("Grn ")
|
||||
Call desc7.PutDouble(idGrn, CInt(wScript.Arguments(5)))
|
||||
idBl = objApp.CharIDToTypeID("Bl ")
|
||||
Call desc7.PutDouble(idBl, CInt(wScript.Arguments(6)))
|
||||
idRGBC = objApp.CharIDToTypeID("RGBC")
|
||||
Call desc6.PutObject(idClr, idRGBC, desc7)
|
||||
idFrFX = objApp.CharIDToTypeID("FrFX")
|
||||
Call desc3.PutObject(idFrFX, idFrFX, desc6)
|
||||
idLefx = objApp.CharIDToTypeID("Lefx")
|
||||
Call desc2.PutObject(idT, idLefx, desc3)
|
||||
Call objApp.ExecuteAction(idsetd, desc2, dialogMode)
|
||||
|
||||
@@ -8,20 +8,6 @@ function newFile(path) {
|
||||
return f
|
||||
}
|
||||
|
||||
// Moves a layer
|
||||
function positionLayer(lyr, x, y, alignment){
|
||||
if(lyr.iisBackgroundLayer||lyr.positionLocked) return
|
||||
var layerBounds = lyr.bounds;
|
||||
var layerX = layerBounds[0].value;
|
||||
if (alignment == 'top' || alignment == null)
|
||||
var layerY = layerBounds[1].value;
|
||||
else if (alignment == 'bottom')
|
||||
var layerY = layerBounds[3].value;
|
||||
var deltaX = x-layerX;
|
||||
var deltaY = y-layerY;
|
||||
lyr.translate(deltaX, deltaY);
|
||||
}
|
||||
|
||||
// Prints an error message.
|
||||
function err(e) {
|
||||
return 'ERROR: ' + e.message + ' at ' + e.fileName + ':' + e.line;
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
function setTitle(title) {
|
||||
var nameLayer = this.textLayers.getByName('name');
|
||||
var found = false;
|
||||
for (var i = 0; i < this.titleBackgrounds.length; i++) {
|
||||
if (!found && (nameLayer.bounds[2] + this.tolerance.title) < this.titleBackgrounds[i].bounds[2]) {
|
||||
this.log.log('"{0}" is long enough'.format(this.titleBackgrounds[i].name), '-');
|
||||
this.titleBackgrounds[i].visible = true;
|
||||
found = true;
|
||||
} else {
|
||||
this.log.log('"{0}" is too short'.format(this.titleBackgrounds[i].name),'-')
|
||||
this.titleBackgrounds[i].visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function main() {
|
||||
setTitle()
|
||||
if ((this.Type).indexOf("Channel") != -2) {
|
||||
this.changeColor(this.resolveBanner.normal, this.colors.Rarity);
|
||||
} else {
|
||||
this.changeColor(this.resolveBanner.normal, [128, 128, 128]);
|
||||
}
|
||||
formatText()
|
||||
}
|
||||
|
||||
function formatText() {
|
||||
|
||||
var lyrs = getLayers(arguments[1])
|
||||
|
||||
var speed = lyrs.getByName('speed');
|
||||
if (speed.visible) {
|
||||
this.changeStroke(speed, (speed.textItem.contents == 1) ? [128, 128, 128] : [255, 255, 255],
|
||||
this.colors.banner)
|
||||
}
|
||||
var bottom = this.doc.height-this.tolerance.flavor_text
|
||||
|
||||
// var short_text = this.setTextLayer('short_text', undefined, null, 'Arial', 'Regular',[this.bold_words, "Bold"]);
|
||||
var short_text = lyrs.getByName('short_text')
|
||||
var long_text = lyrs.getByName('long_text');
|
||||
var flavor_text = lyrs.getByName('flavor_text');
|
||||
|
||||
positionLayer(this.short_textBackground, this.short_textBackground.bounds[0], short_text.bounds[3] + this.tolerance.short_text, 'bottom');
|
||||
positionLayer(long_text, long_text.bounds[0], this.short_textBackground.bounds[3] + this.tolerance.long_text, 'top');
|
||||
positionLayer(flavor_text, flavor_text.bounds[0], bottom, 'bottom');
|
||||
|
||||
short_text.visible = short_text.textItem.contents != "“";
|
||||
long_text.visible = long_text.textItem.contents != "“";
|
||||
flavor_text.visible = flavor_text.textItem.contents != "“";
|
||||
|
||||
if (long_text.bounds[3] > this.doc.height - bottom) {
|
||||
long_text.visible == false;
|
||||
}
|
||||
|
||||
if ( (long_text.visible && flavor_text.bounds[1] < long_text.bounds[3])
|
||||
|| (short_text.visible && flavor_text.bounds[1] < short_text.bounds[3])) {
|
||||
flavor_text.visible = false;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user