Scripting and moving objects

Corel Paint Shop Pro

Moderator: Kathy_9

PromZA
Posts: 11
Joined: Fri Aug 25, 2023 6:05 pm
operating_system: Windows 7 Professional
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: Paintshop Pro 2019

Scripting and moving objects

Post by PromZA »

I can't believe how rudimentary the watermark feature is for such advanced software. You can only do basic alignment and not set any positioning, unless I missed it somewhere. Then after this the text looks VERY jagged even for large logos. So I made my own.

The script works fine, pastes the logo as a layer, aligns it to the lower right corner, until it has to move it. It seems to use absolute coordinates instead of relative ones so with larger images it ends up somewhere in the middle of the image completely ignoring and undoing the aligning steps. I can move it manually but then can't automatically let the script set the transparency and merge it. Here is a piece of the code snippet that seems to do the moving

Code: Select all

    # Pick
    App.Do( Environment, 'Pick', {
            'Type': App.Constants.ObjectSelection.Select, 
            'X': 0, 
            'Y': 0, 
            'Width': 1, 
            'Height': 1, 
            'Group': True, 
            'Handle1': (600,1190), 
            'Handle2': (600,1127), 
            'Handle3': (800,1127), 
            'Handle4': (800,1190), 
            'Pivot': (700,1158.5), 
            'EarlyX4Script': False, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((21,0,0),1)
                }
            })

    # Pick
    App.Do( Environment, 'Pick', {
            'Type': App.Constants.ObjectSelection.Select, 
            'X': 0, 
            'Y': 0, 
            'Width': 1, 
            'Height': 1, 
            'Group': True, 
            'Handle1': (590,1190), 
            'Handle2': (590,1127), 
            'Handle3': (790,1127), 
            'Handle4': (790,1190), 
            'Pivot': (690,1158.5), 
            'EarlyX4Script': False, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((21,0,0),1)
                }
            })
Is there a way to change it so it does a relative (with negative coordinates) move? Also can you paste the logo directly from an image instead of opening it and copying to clipboard?
LeviFiction
Advisor
Posts: 6774
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: Scripting and moving objects

Post by LeviFiction »

Use the Mover command.

https://help.corel.com/paintshop-pro/v2 ... Mover.html

See this topic in the scripting subforum - https://forum.corel.com/viewtopic.php?t=70062

As for opening an image as a layer, depending on the version of PSP you can use - https://help.corel.com/paintshop-pro/v2 ... Layer.html

I don't remember how long ago it was added. But it has been around for a while
PromZA
Posts: 11
Joined: Fri Aug 25, 2023 6:05 pm
operating_system: Windows 7 Professional
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: Paintshop Pro 2019

Re: Scripting and moving objects

Post by PromZA »

LeviFiction wrote: Fri Aug 25, 2023 9:21 pm Use the Mover command.

https://help.corel.com/paintshop-pro/v2 ... Mover.html

See this topic in the scripting subforum - https://forum.corel.com/viewtopic.php?t=70062

As for opening an image as a layer, depending on the version of PSP you can use - https://help.corel.com/paintshop-pro/v2 ... Layer.html

I don't remember how long ago it was added. But it has been around for a while
Thanks, I saw that but had no idea what it means. I'm new to this scripting thing so will have to figure it out first I guess.
PromZA
Posts: 11
Joined: Fri Aug 25, 2023 6:05 pm
operating_system: Windows 7 Professional
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: Paintshop Pro 2019

Re: Scripting and moving objects

Post by PromZA »

Move kept moving the image instead of the logo. Don't know if I wasn't using it correctly or if it's object specific (which would defeat the purpose) but it kept selecting the underlying layer instead of the current object on the layer. So I stumbled upon VectorMove, as there must be one if there's VectorAlignBottom and VectorAlignRight, which seems to do the trick.