Ghoul Fool
Engaged
Ghoul Fool
Engaged
Activity
‎Feb 22, 2025
01:56 AM
2 Upvotes
That's not gonna help Kappa Kappa Pi! 😄 - But yes a new solution to a script written about 12 years ago
... View more
‎Feb 21, 2025
09:07 AM
1 Upvote
Of course - the first point is effectively the last! Brilliant, as always!
... View more
‎Feb 21, 2025
02:33 AM
I wrote a script (years ago) to draw a circle using paths in Photoshop. It works! However, the thing that it doesn't quite do properly is close the path - the start and end point just co-incide (which used to be the way paths were closed) I've tried messing around with the code the obvious choice woule be to so set closed to true: lineSubPathArray[0].closed = true; But that adds an extra point to the circle and closes it. see screen shot - I've move the extra point out the way so you can see it clearly. I'm aiming for a closed, fourpoint circle. Here's my code: function draw_circle(X, Y, rad, pathName, col)
{
var K = (4 * (Math.sqrt(2) - 1) / 3)* rad;
// define circle points
var C = new Array();
C = [X, Y - rad, X + rad, Y, X, Y + rad, X - rad, Y, X + K, Y - rad, X + rad, Y - K, X + rad, Y + K, X - K, Y + rad, X + K, Y + rad, X - rad, Y + K, X - rad, Y - K, X - K, Y - rad];
// create the array of PathPointInfo objects
var lineArray = new Array();
lineArray.push(new PathPointInfo());
lineArray[0].kind = PointKind.CORNERPOINT;
lineArray[0].anchor = new Array(C[0], C[1]); // A
lineArray[0].leftDirection = [C[8], C[9]];
lineArray[0].rightDirection = lineArray[0].anchor;
lineArray.push(new PathPointInfo());
lineArray[1].kind = PointKind.CORNERPOINT;
lineArray[1].anchor = new Array(C[2], C[3]); // B
lineArray[1].leftDirection = [C[12], C[13]];
lineArray[1].rightDirection = [C[10], C[11]];
lineArray.push(new PathPointInfo());
lineArray[2].kind = PointKind.CORNERPOINT;
lineArray[2].anchor = new Array(C[4], C[5]); // C
lineArray[2].leftDirection = [C[14], C[15]];
lineArray[2].rightDirection = [C[16], C[17]];
lineArray.push(new PathPointInfo());
lineArray[3].kind = PointKind.CORNERPOINT;
lineArray[3].anchor = new Array(C[6], C[7]); // D
lineArray[3].leftDirection = [C[20], C[21]];
lineArray[3].rightDirection = [C[18], C[19]];
lineArray.push(new PathPointInfo());
lineArray[4].kind = PointKind.CORNERPOINT;
lineArray[4].anchor = new Array(C[0], C[1]);
lineArray[4].leftDirection = lineArray[4].anchor;
lineArray[4].rightDirection = [C[22], C[23]];
// create a SubPathInfo object, which holds the line array in its entireSubPath property.
var lineSubPathArray = new Array();
lineSubPathArray.push(new SubPathInfo());
lineSubPathArray[0].operation = ShapeOperation.SHAPEXOR;
lineSubPathArray[0].closed = false;
lineSubPathArray[0].entireSubPath = lineArray;
//create the path item, passing subpath to add method
var myPathItem = docRef.pathItems.add(pathName, lineSubPathArray);
}
... View more
‎Feb 19, 2025
01:08 AM
1 Upvote
I'm aware of Davide's book and it may come down to that. ...until then I'll try and stick with good old Photoshop ECMA script.
... View more
‎Feb 18, 2025
06:02 AM
That's right that'll show (alert) the active layers as a collection, but the fact that the heavily relied upon use of activeLayer is now going to be swept under the carpet, without mentioning that it's now missing or here's how it's done nowadays from the documention is increadibly frustrating.
... View more
‎Feb 18, 2025
05:06 AM
Documentaion is minimal at best , but... Why is there no document.activeLayer property in .PSJS? Is it because there can be more than one selected active layer? In which case which one is zero indexed? Or have the Adobe developers just decided to make everything even more difficult?
... View more
‎Feb 13, 2025
05:37 AM
Scrubby zoom isn't listed in preferences, its in tools, which is why I missed it. I've swiched it off because I tend to draw pixel art, which is made more complecated using a window at 1874% magnification - it's makes exactly pixel sizing visually difficult as opposed to increments of 100% ie (200%, 300%, 400%) - which I can gauge with precision. Why? The pixels cease to be displayed as square (iknow they're not actually square) but a non-uniform gird of pixels at varying sizes is just a mess to work with. I suspect the underlying cause is having an AMD processor - which has caused a host of frusrtations & Photoshop problems, One of which, i suspect, is causing a micro lag switching between video cards. ( When I figure out the bios settings to switch the lesser one off, I'll get back to you) As I'm using the same mouse and tablet as I've done for years with - same settings as old PC of which I had no problems drawing on.
... View more
‎Feb 12, 2025
08:24 AM
I'm aware of zoom shortcuts, being a long time Photoshop user, me - but I have never experienced problems like this. Possible exacerbated by a lag delay. Why, if this is by design, would you want to zoom into a single pixel at 32000% by default? There's no scope for a lack of sensisitivity.
... View more
‎Feb 12, 2025
04:19 AM
Is there anyway to stop Photoshop zooming from say 400% to 12800%?? - Which is both annoying and ridiculous. I think the problem is cause by a slight movement on the magnifying tool on a click and it uses that vector as a magnification level - even though I've got Flick Panning, Zoom with Scroll Wheel, animated Zoom, Zoom resises Window and Zoom clicked Point to Centre turned off. Here's a cut-down animated gif of the video:
... View more
‎Feb 10, 2025
01:27 AM
2 Upvotes
Sorry, I should have explained in the initial function brightness_contrast(50, 0, false); The first parameter is brightness, the second is contrast the third is optional and is legacy mode
... View more
‎Feb 07, 2025
09:00 AM
1 Upvote
Ok this it a bit of a hack, but it'll do: it will add an auto contrast adjustment layer - set the values and then set contrast to 0 regardless. auto_brightness();
set_contrast_to_zero();
function auto_brightness()
{
var d = new ActionDescriptor();
var r = new ActionReference();
r.putClass(stringIDToTypeID("adjustmentLayer"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
var d2 = new ActionDescriptor();
d2.putBoolean(stringIDToTypeID("auto"), true);
d2.putBoolean(stringIDToTypeID("useLegacy"), false);
d1.putObject(stringIDToTypeID("type"), stringIDToTypeID("brightnessEvent"), d2);
d.putObject(stringIDToTypeID("using"), stringIDToTypeID("adjustmentLayer"), d1);
executeAction(stringIDToTypeID("make"), d, DialogModes.NO);
}
function set_contrast_to_zero()
{
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc1848 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref354 = new ActionReference();
var idAdjL = charIDToTypeID( "AdjL" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref354.putEnumerated( idAdjL, idOrdn, idTrgt );
desc1848.putReference( idnull, ref354 );
var idT = charIDToTypeID( "T " );
var desc1849 = new ActionDescriptor();
// var idBrgh = charIDToTypeID( "Brgh" );
// desc1849.putInteger( idBrgh, 0 );
var idCntr = charIDToTypeID( "Cntr" );
desc1849.putInteger( idCntr, 0 );
var iduseLegacy = stringIDToTypeID( "useLegacy" );
desc1849.putBoolean( iduseLegacy, false );
var idBrgC = charIDToTypeID( "BrgC" );
desc1848.putObject( idT, idBrgC, desc1849 );
executeAction( idsetd, desc1848, DialogModes.NO );
}
... View more
‎Feb 07, 2025
06:32 AM
1 Upvote
I've stabilised it with an if /else: if (transformtype == "nn") // avoids passing string directly to stringIDToTypeID
{
var idNrst = charIDToTypeID( "Nrst" );
desc5623.putEnumerated( idIntr, idIntp, idNrst );
}
else
{
var idbicubicAutomatic = stringIDToTypeID( "bicubicAutomatic" );
desc5623.putEnumerated( idIntr, idIntp, idbicubicAutomatic );
}
... View more
‎Feb 07, 2025
06:29 AM
DO NOT TRY THIS AT HOME! In trying to script a transform that uses wither bicubic automatic or neares tneighbour transforms I managed to crash Photoshop with a script: It creates a new document, with a new layer and then transforms it down 90% by either bicubic automatic (works fine) or Nearest Neighbour - Crash! // USE THIS SCRIPT AT YOUR OWN RISK
// SAVE AND CLOSE ALL PHOTOSHOP DOCUMENTS
// YOU HAVE BEEN WARNED!!!
displayDialogs = DialogModes.ERROR; // OFF
var docRef = app.documents.add(20, 20, 72, "temp");
srcDoc = app.activeDocument;
duplicate_layer("temp");
transform_by_type("Nrst") // THIS WILL CRASH PHOTOSHOP
function transform_by_type(transformtype)
{
// =======================================================
var idTrnf = charIDToTypeID( "Trnf" );
var desc5623 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1379 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref1379.putEnumerated( idLyr, idOrdn, idTrgt );
desc5623.putReference( idnull, ref1379 );
var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc5623.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc5624 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc5624.putUnitDouble( idHrzn, idPxl, -0.000000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc5624.putUnitDouble( idVrtc, idPxl, -0.000000 );
var idOfst = charIDToTypeID( "Ofst" );
desc5623.putObject( idOfst, idOfst, desc5624 );
var idWdth = charIDToTypeID( "Wdth" );
var idPrc = charIDToTypeID( "#Prc" );
desc5623.putUnitDouble( idWdth, idPrc, 90.000000 );
var idHght = charIDToTypeID( "Hght" );
var idPrc = charIDToTypeID( "#Prc" );
desc5623.putUnitDouble( idHght, idPrc, 90.000000 );
var idIntr = charIDToTypeID( "Intr" );
var idIntp = charIDToTypeID( "Intp" );
var idTransform = stringIDToTypeID( transformtype );
desc5623.putEnumerated( idIntr, idIntp, idTransform );
executeAction( idTrnf, desc5623, DialogModes.NO );
}
// function DUPLICATE LAYER (str)
// --------------------------------------------------------
function duplicate_layer(str)
{
// duplicate layer normaly
// =======================================================
var id1572 = charIDToTypeID( "Dplc" );
var desc350 = new ActionDescriptor();
var id1573 = charIDToTypeID( "null" );
var ref184 = new ActionReference();
var id1574 = charIDToTypeID( "Lyr " );
var id1575 = charIDToTypeID( "Ordn" );
var id1576 = charIDToTypeID( "Trgt" );
ref184.putEnumerated( id1574, id1575, id1576 );
desc350.putReference( id1573, ref184 );
var id1577 = charIDToTypeID( "Nm " );
desc350.putString( id1577, str ); // layer name here
var id1578 = charIDToTypeID( "Vrsn" );
desc350.putInteger( id1578, 2 );
executeAction( id1572, desc350, DialogModes.NO );
} But the function works fine with transform_by_type("bicubicAutomatic"); Thought someone else out to know.
... View more
‎Feb 07, 2025
05:47 AM
2 Upvotes
You can add a Brightness and Contrast adjustment layer with this function; brightness_contrast(50, 0, false);
// function brightnessAndContrast (brightness, contrast)
// --------------------------------------------------------
function brightness_contrast(b, c, legacy)
{
if(legacy == undefined) legacy = false;
// create new Brightness contrast adjustment layer
// =======================================================
var idMk = charIDToTypeID( "Mk " );
var desc834 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref206 = new ActionReference();
var idAdjL = charIDToTypeID( "AdjL" );
ref206.putClass( idAdjL );
desc834.putReference( idnull, ref206 );
var idUsng = charIDToTypeID( "Usng" );
var desc835 = new ActionDescriptor();
var idType = charIDToTypeID( "Type" );
var desc836 = new ActionDescriptor();
var iduseLegacy = stringIDToTypeID( "useLegacy" );
desc836.putBoolean( iduseLegacy, false );
var idBrgC = charIDToTypeID( "BrgC" );
desc835.putObject( idType, idBrgC, desc836 );
var idAdjL = charIDToTypeID( "AdjL" );
desc834.putObject( idUsng, idAdjL, desc835 );
executeAction( idMk, desc834, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc826 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref201 = new ActionReference();
var idAdjL = charIDToTypeID( "AdjL" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref201.putEnumerated( idAdjL, idOrdn, idTrgt );
desc826.putReference( idnull, ref201 );
var idT = charIDToTypeID( "T " );
var desc827 = new ActionDescriptor();
var idBrgh = charIDToTypeID( "Brgh" );
desc827.putInteger( idBrgh, b ); //brightness
var idCntr = charIDToTypeID( "Cntr" );
desc827.putInteger( idCntr, c ); //Contrast
var iduseLegacy = stringIDToTypeID( "useLegacy" );
desc827.putBoolean( iduseLegacy, legacy );
var idBrgC = charIDToTypeID( "BrgC" );
desc826.putObject( idT, idBrgC, desc827 );
executeAction( idsetd, desc826, DialogModes.NO );
}
... View more
‎Feb 05, 2025
11:58 AM
😄
... View more
‎Feb 05, 2025
05:59 AM
2 Upvotes
Stephen, that's simple and elegant! ...but I'm trying to avoid any zooming/changing magnification levels.
... View more
‎Feb 05, 2025
05:57 AM
2 Upvotes
So if anyone's interested in order to make my version of teh script work I just removed the UI and added a function to get the selection bounds centre: // get window values;
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("viewInfo"));
r.putEnumerated(charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var bounds = executeActionGet(r).getObjectValue(stringIDToTypeID("viewInfo")).getObjectValue(stringIDToTypeID("activeView")).getObjectValue(stringIDToTypeID("globalBounds"));
var theLeft = bounds.getUnitDoubleValue(stringIDToTypeID("left"));
var theTop = bounds.getUnitDoubleValue(stringIDToTypeID("top"));
var theRight = bounds.getUnitDoubleValue(stringIDToTypeID("right"));
var theBottom = bounds.getUnitDoubleValue(stringIDToTypeID("bottom"));
var windowW = theRight - theLeft -16;
var windowH = theBottom - theTop - 16;
// get zoom;
var theZoom = getActiveDocumentZoom();
// set potision on selection
var sb = get_selection_bounds_centre();
if (sb != undefined)
{
var posX = sb[0]*(-1)*theZoom/100+windowW/2;
var posY = sb[1]*(-1)*theZoom/100+windowH/2;
set_doc_position(posX, posY);
}
// by r-bin;
function set_doc_position(x, y)
{
try
{
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("viewInfo"));
r.putEnumerated(stringIDToTypeID("document"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var bounds = executeActionGet(r).getObjectValue(stringIDToTypeID("viewInfo")).getObjectValue(stringIDToTypeID("activeView")).getObjectValue(stringIDToTypeID("globalBounds"));
var b = new Array();
b[0] = bounds.getUnitDoubleValue(stringIDToTypeID("left"));
b[1] = bounds.getUnitDoubleValue(stringIDToTypeID("top"));
b[2] = bounds.getUnitDoubleValue(stringIDToTypeID("right"));
b[3] = bounds.getUnitDoubleValue(stringIDToTypeID("bottom"));
var dx = 8; // what is it?
var dy = 8; // what is it?
x = (b[2]-b[0])/2 - x - dx;
y = (b[3]-b[1])/2 - y - dy;
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("center"));
r.putEnumerated(stringIDToTypeID("document"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
d1.putUnitDouble(stringIDToTypeID("horizontal"), stringIDToTypeID("distanceUnit"), x);
d1.putUnitDouble(stringIDToTypeID("vertical"), stringIDToTypeID("distanceUnit"), y);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("center"), d1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
}
catch (eeek)
{
throw(eeek);
}
};
// by mike hale;
function getActiveDocumentZoom()
{
var ref;
ref = new ActionReference();
ref.putProperty( charIDToTypeID( "Prpr" ),charIDToTypeID('Zm '));
ref.putEnumerated(charIDToTypeID('Dcmn'), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
return (executeActionGet(ref).getUnitDoubleValue (charIDToTypeID('Zm ')))*100;
};
// function GET SELECTION BOUNDS()
// ----------------------------------------------------------------
function get_selection_bounds_centre()
{
try
{
var l = parseFloat(app.activeDocument.selection.bounds[0]);
var t = parseFloat(app.activeDocument.selection.bounds[1]);
var r = parseFloat(app.activeDocument.selection.bounds[2]);
var b = parseFloat(app.activeDocument.selection.bounds[3]);
var selectionBounds = [parseInt(r -((r-l)*0.5)),parseInt(t-((t-b)*.5))]; // centre x, centre y
return selectionBounds;
}
catch(eek)
{
return undefined;
}
} No more zooming in and out for me!! 😄
... View more
‎Feb 05, 2025
05:39 AM
1 Upvote
Oooh! Things. Just. Got. Interesting.
... View more
‎Feb 05, 2025
01:38 AM
Just want to check with fellow scripters than panning (as in using the hand tool) to move around a zoomed in large image is NOT possible with scripting? I want to zoom in on a large image and then be able to pan to a selection - but I don't think there is anything that can help me on this one. Even the navigator doesn't highlight selections. So go from : to Using a zoomed in version of the Mona Lisa an an example
... View more
‎Feb 04, 2025
06:52 AM
1 Upvote
of course it doesn't work if the wacom tablets not plugged it! So yes, it works with both brush, pencil and eraser tools. Thank you!
... View more
‎Feb 04, 2025
06:21 AM
The modification to the manifest came up with the same error as before. Whilst the showCustomAlert - did nothing. Double click the script and no response - presumably it compile and ran ok, but didn't add anything to the screen alertwise.
... View more
‎Feb 03, 2025
07:22 AM
Sorry I've not had a chance to go over the script in detail. Obviously the script works but it doesn't seem to toggle the pen pressure on and off as expected - possibly because "StlP" might not be teh correct constant to shift.
... View more
‎Jan 31, 2025
05:51 AM
Not so much jumping into the deep end but going swimming with cement flippers with UXP, I try to create an alert in InDesign .injs: alert("hello!"); I get an alert of sorts... But not quite as friendly as I'd hoped. I can get around it by writing a bespoke alert function as mentioned in this recipe here. However... it says here that Since UXP v7.4, `alert()` can only be invoked in `plugin` via the featureFlags `enableAlerts`. Update your Manifest v5 with the following: so I've updated the manifest: {
"id": "myUniqueId",
"name": "Hello Worldplugin",
"version": "0.0.1",
"description": "Description goes here",
"summary": "Summary goes here",
"host": {
"app": "XD",
"minVersion": "13.0"
},
"uiEntryPoints": [
{
"type": "menu",
"label": "Create Rectangle",
"commandId": "createRectangle"
}
],
"featureFlags": {
"enableAlerts": true
}
} based on the Developer Starter project - so ignore references to rectangles. But get the same error as above. So what's going on?
... View more
‎Jan 31, 2025
05:25 AM
I've tried drilling down in teh AM code to get to currentToolOptions but it's an OBJECTTYPE - which I don't know how to turn into an actionreference This is what I've got so far: var str = "";
var topLevelObject = "application";
str += "Top Level Object: " + topLevelObject + "\n";
var r = new ActionReference ();
r.putEnumerated (stringIDToTypeID (topLevelObject), stringIDToTypeID ("ordinal"), stringIDToTypeID ("targetEnum"));
var d = executeActionGet (r);
var str = topLevelObject + " properties:\n";
var q = " - ";
for (var i = 0; i < d.count; i++)
{
str += typeIDToStringID(d.getKey(i)) + ':' + d.getType(d.getKey(i)) + "\n";
}
str += "\nDescriptor:\n";
var secondLayerObject = "currentToolOptions"; //Objecttpe
//currentToolOptions:DescValueType.OBJECTTYPE
str += secondLayerObject + "\n"
r = new ActionReference();
r.putEnumerated(stringIDToTypeID(secondLayerObject), stringIDToTypeID("object"), stringIDToTypeID("targetEnum"));
d = executeActionGet(r); // failes here
for (var i = 0; i < d.count; i++)
{
str += typeIDToStringID(d.getKey(i)) + q + d.getType(d.getKey(i)) + "\n";
}
alert(str);
... View more
‎Jan 31, 2025
02:47 AM
1 Upvote
Using Ai for something very niche like Action Manager code - rarely results in anything working. It's a bit like following a wild goose to get specific directions.
... View more
‎Jan 31, 2025
02:43 AM
I want to know if the pressure sensiticity button can be swtiched off via code. Initally I thought it could be toggle with a keyboardshortcut - no such luck. Scriptlistner doesn't come up with anything when it's toggled. - no good there. I did look up "StlP" as one of the four letter codes Photoshop uses. At which point I find myself trying to shoe-horn a Photoshop constant into Action Manager code which is the equivalent of giving a cat a spanner and telling it to fix a vaccuum cleaner.
... View more
‎Jan 30, 2025
06:19 AM
That doesn't answer my question, just my questions my methods.
... View more
‎Jan 29, 2025
03:48 AM
An Indesign you can import a custom dictionary quite easily as it's just a text file. My question is this: can you comment out words/lines at all? For example: Apples Pears Cherries // Donuts - won't show up, commented out Bananas
... View more
‎Jan 25, 2025
01:43 AM
The thing to learn is for Adobe to hold a meeting with Microsoft and Wacom and get things to work nicely in harmony with one another. Not having the hardware and software at odds with one another.
... View more