Ghoul Fool
Engaged
Ghoul Fool
Engaged
Activity
‎Oct 27, 2022
12:41 AM
... Photoshop which suffers from the same problem, but at least Photoshop will respond with an unable to complete task type of error - rather than crashing.
... View more
‎Oct 26, 2022
07:20 AM
So here's a way to crash illustrator: Create an action that does something simple like creating a rectangle. Call it "rectangle". Create a script, lets; call it action.jsx var actionSet = "my actions";
var action = "rectangle";
app.doScript(action, actionSet); Running action "rectangle" is fine. As so is running the script action.jsx So far so good. But let's complicate matters by creating another action, bit this one is called "runscript" that plays action.jsx. If that gets played it'll run an action to run a script to run an action. And there's where illustator falls over. You can't run two actions at the same time. Ilustrator crashes without warning. Is there a way around this? And don't say don't run two actions at the same time.
... View more
‎Oct 26, 2022
01:19 AM
I already have a two line script. - That wasn't what I was after. app.copy();
app.executeMenuCommand("pasteInPlace"); I would apologise for the confusion, but I'm Autistic and written communication is just another way for me to be misheard or mis-understood. I just find it very odd that Illustrator scripting seems to lack basic functionality at a low level. - Which is blatanly obvious even from teh two lines above.
... View more
‎Oct 25, 2022
08:44 AM
Write a two line script (copy & paste in place) as a duplicate subsitute, to put on a keyboard shortcut.
... View more
‎Oct 25, 2022
05:57 AM
1 Upvote
Long time Photoshop scripter, first time Illustrator scripting. I'm trying to paste an object in place. I would expect there to a method that's similiar to "paste" app.pasteInPlace(); // won't work
app.paste.inPlace(); // and neither does this ...or something similar. I've used the work around of app.executeMenuCommand("pasteInPlace"); My question is this: Is there a dot method way of pasting in place which has eluded me? Ive checked Illustrator JavaScript Scripting Reference, but that only has 2 references to paste. That would seem more programatical then relying on macros of menu commands.
... View more
‎Sep 21, 2022
01:06 AM
Floaty!
... View more
‎Sep 20, 2022
11:34 AM
1 Upvote
More often than not I will have ALT-TABbed away from Photoshop to the desktop (or maybe the Bahamas), but on my return all previous Photoshop files that I was working on will have been minimised. - This can be quite annoying, especially, if you have several open. So...I wondered if a script could fix it - just looping over each document and setting it to the active document. And funnily enough, it fixes the problem I'm sharing it here, mainly for future reference for myself... and anyone else who encounters the same thing: // Brings all the minimized documents to the fore
unminimize();
function unminimize()
{
if (documents.length == 0) return;
for (var i = 0; i < documents.length; i++)
{
app.activeDocument = documents[i];
}
}
... View more
‎Sep 13, 2022
08:45 AM
Longtime Photoshop scripter, first time INDD scripter. I'm currently working on a page swaping script, though I'm stumped at the first hurdle. Assuming I have a indd document open, with pages, why would a page be considered NOT valid? var pages = app.activeDocument.pages;
var p = 0;
alert(pages.item("" + p).isValid); false What have I missed or overlooked?
... View more
‎Sep 05, 2022
06:03 AM
1 Upvote
Cheers, Stephen! Got it! For my future self: var srcDoc = app.activeDocument;
var rawData = srcDoc.xmpMetadata.rawData;
alert(find_text_layers(rawData));
function find_text_layers(str)
{
var regEx = new RegExp("\<photoshop:TextLayers\>", "gim");
var results = str.match(regEx);
if (results) return true;
else return false;
}
... View more
‎Sep 05, 2022
03:27 AM
In the interest of efficiency, without looping over all layers (whould can get slow), is it possible to determine if a .PSD countains or does not contain text layers? Sort of like this? var hasText = app.activeDocument.textLayers; - But obviously that won't work.
... View more
‎Sep 01, 2022
05:15 AM
1 Upvote
Cut and paste malfunction: THIS will do the trick: var inFolder = Folder.selectDialog("Please select folder to process");
if(inFolder != null)
{
var fileList = inFolder.getFiles(/\.(psd)$/i);
}
for (var i = 0; i < fileList.length; i++)
{
var f = fileList[i];
(d = new ActionDescriptor).putPath(stringIDToTypeID("target"), f);
executeAction(stringIDToTypeID("open"), d, DialogModes.NO);
}
// process image here
var srcDoc = app.activeDocument;
var docName = srcDoc.name;
... View more
‎Sep 01, 2022
05:13 AM
This'll do the trick: for (var i = 0; i < fileList.length; i++)
{
var f = fileList[i];
(d = new ActionDescriptor).putPath(stringIDToTypeID("target"), f);
executeAction(stringIDToTypeID("open"), d, DialogModes.NO);
}
// process image here
var srcDoc = app.activeDocument;
var docName = srcDoc.name;
alert(docName); 😄
... View more
‎Sep 01, 2022
04:53 AM
It's not that I don't know how to code around this. - That's just laziness on my part. No, the problem is when used in combination with File... Automate > Batch and then that part of the script is ignored. Unlesss you Overide Action "Open" Commands in which case you are picking files individually. ...which is why I was loonking for a temp switch change.
... View more
‎Sep 01, 2022
12:45 AM
That's good, but not what I'm after as it's a replacement for open dialog.
... View more
‎Aug 31, 2022
08:29 AM
Is there a temporary way to supress/ignore the missing fonts dialog box using a script? I'm batch running a script to look over a lot of .psd files. It'll just hang when it finds a psd that's missing a font and it'll pop up the dialog box. The idea is then, once the script has finished, to then switch back on the dilaogue once more. Restoring balance, peace, harmony and type substition options to the universe once more. Sort of something like this: // Switch off any dialog boxes
displayDialogs = DialogModes.NO; // OFF
// upon start
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
// do stuff
// upon completion
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
// Switch ON any dialog boxes
displayDialogs = DialogModes.ALL; Only that won't work for Photoshop 😉
... View more
‎Aug 03, 2022
02:57 AM
1 Upvote
Thanks for the confirmation - I'd go with ^\s+|\s+$ as I don't want to remove ALL spaces - just white space at the start and end. Incidentally, as c.pfaffenbichler mentioned, isn't using "trim" as a function going to cause problems even though they are evoked differently: canvas.trim() versus trim(str)?
... View more
‎Aug 02, 2022
07:00 AM
Did it ever though?
... View more
‎Aug 02, 2022
05:29 AM
I have an old Photoshop script from circa 2012 - which I remember working, that uses the trim() function. Strings, not pixels - let's make that clear. var text = " Hello Spoons! "; var result = text.trim(); alert(result) However, something like the code above no longer works. text.trim is not a function. I can use reg ex to trim the string, but my question is this: Has Photoshop scripting changed/updated it's version of ECMA Script (ver 3.x???) to no longer include trim?
... View more
‎Jul 14, 2022
05:20 AM
I noticed that switching from art layers to established layer mask that ScriptListner duplicates a variable // =======================================================
var idslct = charIDToTypeID( "slct" );
var desc63 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref18 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idChnl = charIDToTypeID( "Chnl" );
var idMsk = charIDToTypeID( "Msk " );
ref18.putEnumerated( idChnl, idChnl, idMsk );
desc63.putReference( idnull, ref18 );
var idMkVs = charIDToTypeID( "MkVs" );
desc63.putBoolean( idMkVs, false );
executeAction( idslct, desc63, DialogModes.NO ); The line "var idChnl = charIDToTypeID( "Chnl" );" is created twice. Just sayin'.
... View more
‎Jul 14, 2022
05:14 AM
I'm I correct in thinking that only a few filters are availabe directly in code? var b = 100;
// Spherize
activeDocument.activeLayer.applySpherize(b, SpherizeMode.NORMAL);
Spherize is fine, but using pixelate mosaic one is force to use script listner code: var mosaicAmt = 8;
apply_mosaic(mosaicAmt);
function apply_mosaic(val)
{
var idMsc = charIDToTypeID( "Msc " );
var desc5842 = new ActionDescriptor();
var idClSz = charIDToTypeID( "ClSz" );
var idPxl = charIDToTypeID( "#Pxl" );
desc5842.putUnitDouble( idClSz, idPxl, val );
executeAction( idMsc, desc5842, DialogModes.NO );
}
Or am I missing a trick somewhere?
... View more
‎Jun 13, 2022
04:20 AM
This morning I've been getting pop-up alerts that I *think* are from Photoshop related to LogTransport2.exe, even though it looks DAF. So lots of questions: Is this legit? How do I stop it? What to do? If LogTransport2 is related to acrobat why do I get it when using Photoshop? And this was of no help whatsoever.
... View more
‎May 23, 2022
05:38 AM
Any other "self-defined" or Photoshop only reserved words that may have eluded me?
... View more
‎May 23, 2022
02:57 AM
Is "cancel" a keyword or reserved word? My simple dialog box: var dlg = new Window("dialog");
dlg.text = "Proceed?";
dlg.preferredSize.width = 160;
// GROUP1
// ======
var group1 = dlg.add("group", undefined, {name: "group1"});
group1.preferredSize.width = 160;
// add buttons
var button1 = group1.add ("button", undefined);
button1.text = "OK";
var button2 = group1.add ("button", undefined);
button2.text = "Cancel";
var myReturn = dlg.show();
if (myReturn == 1)
{
// code here
} Works fine. All is well. However replace the string "Cancel" with "Can" and the button no longer functions. You need to add extra code in order to regain functionality. button2.onClick = function()
{
// alert("Byas!");
dlg.close();
dialogResponse = "cancel";
} So, what's going on, is "cancel" a keyword?
... View more
‎Apr 06, 2022
04:00 AM
1 Upvote
I've got several scripts that create chessboard style tiles. I did have a script in mind where two such tiles were created, and therefore had to reference the first one after the second was created. Plus I'm curious.
... View more
‎Mar 30, 2022
07:03 AM
That was Define Pattern, not Efine Pattern! 😞
... View more
‎Mar 30, 2022
07:03 AM
I can create the equivilant of Edit > Efine Pattern with function define_pattern()
{
var id8139 = charIDToTypeID( "Mk " );
var desc849 = new ActionDescriptor();
var id8140 = charIDToTypeID( "null" );
var ref387 = new ActionReference();
var id8141 = charIDToTypeID( "Ptrn" );
ref387.putClass( id8141 );
desc849.putReference( id8140, ref387 );
var id8142 = charIDToTypeID( "Usng" );
var ref388 = new ActionReference();
var id8143 = charIDToTypeID( "Prpr" );
var id8144 = charIDToTypeID( "fsel" );
ref388.putProperty( id8143, id8144 );
var id8145 = charIDToTypeID( "Dcmn" );
var id8146 = charIDToTypeID( "Ordn" );
var id8147 = charIDToTypeID( "Trgt" );
ref388.putEnumerated( id8145, id8146, id8147 );
desc849.putReference( id8142, ref388 );
var id8148 = charIDToTypeID( "Nm " );
desc849.putString( id8148, "my tile Name" );
executeAction( id8139, desc849, DialogModes.NO );
} However, I'd like it to return it's unique ID at the same time. Such as "31a540ce-1828-db45-a501-f6621ff79cdf" Is this possible?
... View more
‎Mar 07, 2022
08:30 AM
I can change the prefernces for resampling type // =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc1121 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref179 = new ActionReference();
var idPrpr = charIDToTypeID( "Prpr" );
var idGnrP = charIDToTypeID( "GnrP" );
ref179.putProperty( idPrpr, idGnrP );
var idcapp = charIDToTypeID( "capp" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref179.putEnumerated( idcapp, idOrdn, idTrgt );
desc1121.putReference( idnull, ref179 );
var idT = charIDToTypeID( "T " );
var desc1122 = new ActionDescriptor();
var idIntM = charIDToTypeID( "IntM" );
var idIntp = charIDToTypeID( "Intp" );
var idNrst = charIDToTypeID( "Nrst" );
desc1122.putEnumerated( idIntM, idIntp, idNrst );
var iduseClassicFileNewDialog = stringIDToTypeID( "useClassicFileNewDialog" );
desc1122.putBoolean( iduseClassicFileNewDialog, true );
var idGnrP = charIDToTypeID( "GnrP" );
desc1121.putObject( idT, idGnrP, desc1122 );
executeAction( idsetd, desc1121, DialogModes.NO ); But that doesn't change the last used type of resample for Image Resize and or Transforms - which is what I'm trying to do. Essentially var currentResizemethod = ??? var newResizemethod = ResampleMethod.NEARESTNEIGHBOR; Trying to force an image to resize doesn't seem to change that last human selection ofr the sample method.
... View more
‎Mar 04, 2022
04:11 AM
View > Show > <Selection Edges> It's that simple. Only Scriptlistener doesn't record anything when you shoe selection edges, and the only thing I could find related to show was from the event code list Show Shw 1399355168 So I'm at a loss on how to proceed. Cheers.
... View more
‎Feb 24, 2022
07:17 AM
D'oh! Thank you once again.
... View more