Skip to main content
Inspiring
October 31, 2021
Answered

Deleting Patters using scripting

  • October 31, 2021
  • 1 reply
  • 617 views

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 );
This topic has been closed for replies.
Correct answer jazz-y

 

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

 

 

1 reply

jazz-yCorrect answer
Legend
October 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);

 

 

Marvin01Author
Inspiring
November 2, 2021

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?

Kukurykus
Legend
November 2, 2021