Apply a script to a whole folder/to all current loaded pics?

Moderator: Kathy_9

Post Reply
pstein
Posts: 110
Joined: Wed Dec 28, 2011 7:09 pm
operating_system: Windows 7 Professional
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PSP X2
Location: Germany/Canada

Apply a script to a whole folder/to all current loaded pics?

Post by pstein »

How can I apply an existing script to all pictures of a certain folder (e.g. in D:\pictures\2019\)?

How can I apply an existing script to all currently loaded pictures?

Thank you
Peter
LeviFiction
Advisor
Posts: 6831
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: Apply a script to a whole folder/to all current loaded p

Post by LeviFiction »

1) Applying a script to all images in a folder
Use Batch Processing

File -> Batch Process

Add your images from the folder

Add a Script action, or choose from a set of other preset actions

Choose how to save out the result, as copies or overwriting the originals

There is also a script by SuzShook (a previous scripting Guru) on using a trusted script to edit all of the images in a folder. The difference is the a script will load an image into the editor which is a slower process than how batch process simply loads the image into memory.

2) I don't believe there is a built-in option for this. But the manual scripting is easy enough. You simply need to loop over all of the documents using the RunScript command on each one.
Here is a very rough code example, not a full script.

Code: Select all

from PSPApp import *

def ScriptProperties():
    return {
        'Author': u'LeviFiction',
        'Copyright': u'2019',
        'Description': u'Run Script on all open images',
        'Host': u'PaintShop Pro',
        'Host Version': u'9'
        }

def Do(Environment):
    for doc in App.Documents:
        # RunSelectedScript
        App.Do( Environment, 'RunSelectedScript', {'ScriptName': u'Mosaic'}, doc)
So in this script, I used Python's for loop to go through the list of all open documents which PSP provides in the variable "App.Documents" placing each Document object into the variable "doc"

Then for each document, I run the "RunSelectedScript" command. Using the "doc" variable as the final parameter of the command. This tells PSP which document to run the command on.
https://levifiction.wordpress.com/
Post Reply