Changing Neural Filter by script not working/refreshing.

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

TiggertheT
Posts: 1
Joined: Tue Oct 27, 2020 10:58 pm

Changing Neural Filter by script not working/refreshing.

Post by TiggertheT »

Creating a script for applying Neural Filters. But I want to use parameters in code.

It works fine if I create an Action. I can convert the Action to javascript. Runs generated script and runs fine.

It works fine if I use the scriptlistener. Runs generated script and runs fine.

If I change the scripts at the obvious parameters, Age, Style brush size it does not refresh with the different parameters. In fact it uses the original script ones. However if I open the neural filter, the changed parameters are there and it refreshs and I press OK, then fine.

Thing is, comparing the generated scripts when just one parameter, say Age has changed, there is a difference in a hextobin unintelligible code, some random numbers, as well as the obvious variable.

So if the answer is obvious sorry, this is my first PS script (I do code AE).

App.refresh(); didn't force the filter to refresh, is there another way?

Any thoughts and thanks.
Lucas brown
Posts: 1
Joined: Fri Nov 19, 2021 10:34 am

Re: Changing Neural Filter by script not working/refreshing.

Post by Lucas brown »

TiggertheT wrote: Wed Oct 28, 2020 8:45 am Creating a script for applying Neural Filters. But I want to use parameters in code.

It works fine if I create an Action. I can convert the Action to javascript. Runs generated script and runs fine.

It works fine if I use the scriptlistener. Runs generated script and runs fine.

If I change the scripts at the obvious parameters, Age, Style brush size it does not refresh with the different parameters. In fact it uses the original script ones. However if I open the neural filter, the changed parameters are there and it refreshs and I press OK, then fine.

Thing is, comparing the generated scripts when just one parameter, say Age has changed, there is a difference in a hextobin unintelligible code, some random numbers, as well as the obvious variable.

So if the answer is obvious sorry, this is my first PS script (I do code AE).

App.refresh(); didn't force the filter to refresh, is there another way?

Any thoughts and thanks.
When you change the parameters in the script, are you updating the correct variable names and values in the code?

One solution could be to create a function that takes in the parameters as arguments and generates the script based on those values. This way, the script will always be generated with the correct parameters.

Another solution could be to use the executeAction() method instead of App.refresh(). This method allows you to run an action with specific parameters. You can create an action with the desired Neural Filters and parameters, save it, and then use executeAction() to run the action with the updated parameters.

Here's an example of how you can use executeAction():

Code: Select all

var idNS = charIDToTypeID("NS  "); 
var action = stringIDToTypeID("AdobeScriptAutomation Scripts");
var filter = stringIDToTypeID("neuralFilter");

var desc = new ActionDescriptor();
desc.putString(stringIDToTypeID("preset"), "Age");
desc.putInteger(stringIDToTypeID("value"), 20);

var ref = new ActionReference();
ref.putEnumerated(action, filter, stringIDToTypeID("neuralFilter"));

executeAction(ref, desc, DialogModes.NO);
In this example, the putString() and putInteger() methods are used to set the preset and value parameters for the Neural Filter. You can modify gbwa this code to include any other parameters that you want to use.

I hope this helps! Let me know if you have any further questions.
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Changing Neural Filter by script not working/refreshing.

Post by Kukurykus »

You 'refreshed' old thread to advertise the (linked) product. You did not understand the problem of author (since you didn't refer to curprit of problem, that is 'hextobin unintelligible code'). There are some other omissions. I think you (as most likely trained bot) used chatGPT to auto create your answer, all the more, you quoted original poster content (although it's obvious who you answer to). If you are not a bot, have you used chatGPT?