Saving parameters when using scripts.

Moderator: Kathy_9

Posts: 20
Joined: Mon Dec 21, 2020 4:09 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Shuttle SH370R6 V2
processor: Intel Core i9
ram: 128 GB
Video Card: Onboard
sound_card: Onboard
Hard_Drive_Capacity: 2TB
Monitor/Display Make & Model: HP 27yh
Corel programs: Paint Shop Pro 2021
Location: Reno, Nevada

Saving parameters when using scripts.

Post by bobclevenger »

OK, using PSP 2021 64-bit.

Situation: Running a script that applies something (for instance Curves) to an image. Running it in interactive mode. Make changes to the RGB settings until image looks good. Save and load another image from the same set of photos (which would likely take the same or similar colour correction). The original settings are still applied in Curves when the script is run that second time and I have to adjust them again... and again... and again...

Question: Is there a way to apply the adjustments made during the first run of the script to the settings in the script itself so that the second run already has the new settings in it? Essentially, can parameters entered manually be passed to the script other than by manual script editing?
Posts: 6472
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Saving parameters when using scripts.

Post by LeviFiction »

There is no built-in way to overwrite the parameters in the file. That would kind of defeat the purpose of a script. However, if you delete the parameters of the command then it'll use the last used settings found in the registry. So it would work with the small caveat that the script will always use the last-used parameters. They will never be specific to this script.

Code: Select all

        App.Do( Environment, 'ColorAdjustCurves', {}) #Empty parameter curves adjustment will use last-used
Another option would be to create a preset, and record using that preset in the script, then you just need to make sure to overwrite the preset every time you run the script before accepting the command. Otherwise you run into the exact same problem.

The only other way I can think of would be to use the more advanced Python options, manually get the last used parameters (there is a command called CommandInfo that can assist with this) and then create a file with the last used settings as a preset and reload that file to get the parameters.