Deleting Patters using scripting

Explorer ,
Oct 31, 2021 Oct 31, 2021

Copy link to clipboard

Copied

I would like to make an auto-updater function to reload pattern files when they are updated.

I already have everything working.. reading pattern files, saving the dates, loading patterns, ect...

Only thing I'm still missing is a script that can remove groups.

I can only replace all patterns by loading the first pattern file with "append" false, and the rest as true.

This way, the first load will remove all patterns.

But is there a way to remove only 1 group, so I can load individual pattern files instead of reloading all pattern files for every update on a single pattern file?

Script listener gave me a Dlt event, but nothing that refers to a pattern group name...

 

var idDlt = charIDToTypeID( "Dlt " );
    var desc68 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref6 = new ActionReference();
        var idPtrn = charIDToTypeID( "Ptrn" );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref6.putEnumerated( idPtrn, idOrdn, idTrgt );
    desc68.putReference( idnull, ref6 );
executeAction( idDlt, desc68, DialogModes.NO );
TOPICS
Actions and scripting

Views

71

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Oct 31, 2021 Oct 31, 2021
s2t = stringIDToTypeID; (r = new ActionReference()).putName(s2t('pattern'), 'pattern group name'); (d = new ActionDescriptor()).putReference(s2t('target'), r); executeAction(s2t('delete'), d, DialogModes.NO);

Likes

Translate

Translate
Adobe Community Professional ,
Oct 31, 2021 Oct 31, 2021

Copy link to clipboard

Copied

 

s2t = stringIDToTypeID;
(r = new ActionReference()).putName(s2t('pattern'), 'pattern group name');
(d = new ActionDescriptor()).putReference(s2t('target'), r);
executeAction(s2t('delete'), d, DialogModes.NO);

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 02, 2021 Nov 02, 2021

Copy link to clipboard

Copied

Works great, Thanks!!!

How do you create these kinds of action manager scripts?

I know how to use scriptlistener, and I manage to make nice functions from those, but for these kind of scripts, scriptlistener is useless. What documentation can you advice me to learn more about this?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 02, 2021 Nov 02, 2021

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 02, 2021 Nov 02, 2021

Copy link to clipboard

Copied

LATEST

The official documentation boils down to a short description of the AM function methods in Adobe Photoshop CC JavaScript Reference  and a couple of pages in Adobe Photoshop CS6 Scripting Guide 

Everything else is proposed to be studied independently.

All I know - I know thanks to the users of this community and ps-scripts.com 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines