Script command "App.Setonly()" instead of "App.Do()" avail?

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

Script command "App.Setonly()" instead of "App.Do()" avail?

Post by pstein »

Is there a command for Scripts which only sets parameters BUT NOT EXECUTE/APPLY an operation?

Something like:

App.Do( Environment, 'ColorAdjustBrightnessContrast', {
'BrightnessContrast': {
'Brightness': -12,
'Contrast': 0
},
'GeneralSettings': {
'SetonlyMode': App.Constants.SetonlyMode.Default,
'AutoSetonlyMode': App.Constants.AutoSetonlyMode.Match,
'Version': ((12,0,1),1)
}
})
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: Script command "App.Setonly()" instead of "App.Do()" ava

Post by LeviFiction »

As far as I know, no there is no other command. (Well, if you use the inspect module there are other names that show up but nothing like what you want)

Are you trying to set the values inside the UI? Or, why would you want to set the values without executing the command?

If you're trying to set the values in the UI, no there is no such link inside of PSP. Only presets can be used to set the values for a tool or dialog. However, if you enter "intereactive" mode then dialogs will show the values that you set. But they have to be accepted or else they won't stick.
https://levifiction.wordpress.com/
Radim
Posts: 712
Joined: Mon Nov 01, 2010 5:54 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 4GB
Monitor/Display Make & Model: 27 inch

Re: Script command "App.Setonly()" instead of "App.Do()" ava

Post by Radim »

But you can do/execute something simple and fast...like draw small rectangle or something that use this (your's) specific settings and then delete it. Even keep history commands unchanged. :P
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

Re: Script command "App.Setonly()" instead of "App.Do()" ava

Post by pstein »

Radim wrote:But you can do/execute something simple and fast...like draw small rectangle or something that use this (your's) specific settings and then delete it. Even keep history commands unchanged. :P
Ok. Sounds good

...and how do I delete/undo an operation from a script?
Radim
Posts: 712
Joined: Mon Nov 01, 2010 5:54 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 4GB
Monitor/Display Make & Model: 27 inch

Re: Script command "App.Setonly()" instead of "App.Do()" ava

Post by Radim »

pstein wrote:...and how do I delete/undo an operation from a script?

Code: Select all

App.Do( Environment, 'UndoLastCmd')
Radim
Posts: 712
Joined: Mon Nov 01, 2010 5:54 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 4GB
Monitor/Display Make & Model: 27 inch

Re: Script command "App.Setonly()" instead of "App.Do()" ava

Post by Radim »

Here is my attempt. It sets Foreground and Backgroud colors (red and yellow).

Code: Select all

from PSPApp import *

def ScriptProperties():
    return {
        'Author': u'',
        'Copyright': u'',
        'Description': u'',
        'Host': u'PaintShop Pro',
        'Host Version': u'16.00'
        }

def Do(Environment):
    # New Raster Layer
    App.Do( Environment, 'NewRasterLayer', {
            'General': {
                'Opacity': 100, 
                'Name': u'Raster 2', 
                'IsVisible': True, 
                'IsTransparencyLocked': False, 
                'LinkSet': 0, 
                'UseHighlight': False, 
                'PaletteHighlightColor': (255,255,64), 
                'GroupLink': True, 
                'BlendMode': App.Constants.BlendMode.Normal
                }, 
            'BlendRanges': {
                'BlendRangeGreen': (0,0,255,255,0,0,255,255), 
                'BlendRangeRed': (0,0,255,255,0,0,255,255), 
                'BlendRangeBlue': (0,0,255,255,0,0,255,255), 
                'BlendRangeGrey': (0,0,255,255,0,0,255,255)
                }, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((16,0,0),1)
                }
            })

    # CreateRectangleObject
    App.Do( Environment, 'CreateRectangleObject', {
            'Antialias': True, 
            'MiterLimit': 15, 
            'Join': App.Constants.JointStyle.Miter, 
            'CreateAsVector': False, 
            'Fill': {
                'Color': (254,255,3), 
                'Pattern': None, 
                'Gradient': None, 
                'Texture': None, 
                'Art': None
                }, 
            'LineStyle': {
                'Name': u'', 
                'FirstCap': (u'Butt',7.21,7.21), 
                'LastCap': (u'Butt',1,1), 
                'FirstSegCap': None, 
                'LastSegCap': None, 
                'UseSegmentCaps': False, 
                'Segments': None
                }, 
            'LineWidth': 1, 
            'Stroke': {
                'Color': (255,71,7), 
                'Pattern': None, 
                'Gradient': None, 
                'Texture': None, 
                'Art': None
                }, 
            'ObjectName': u'New Rectangle', 
            'Left': 11.5, 
            'Top': 11.5, 
            'Width': 19, 
            'Height': 21, 
            'RadiusX': 0, 
            'RadiusY': 0, 
            'Matrix': None, 
            'Visibility': True, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Interactive, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((16,0,0),1)
                }
            })

    App.Do( Environment, 'UndoLastCmd')
    App.Do( Environment, 'UndoLastCmd')
Cassel
Posts: 1587
Joined: Fri Oct 29, 2010 6:49 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
ram: 16Gb
Corel programs: PSP 8 (JASC) to PSP 2023
Location: Canada
Contact:

Re: Script command "App.Setonly()" instead of "App.Do()" ava

Post by Cassel »

You can use these for setting colors:

Code: Select all

    # SetMaterial
    App.Do( Environment, 'SetMaterial', {
        'IsPrimary': App.Constants.Boolean.false,
        'NewMaterial': {
        'Color': (255,255,0),
        'Pattern': None,
        'Gradient': None,
        'Texture': None
        }
    }) 

    # SetMaterial
    App.Do( Environment, 'SetMaterial', {
        'IsPrimary': App.Constants.Boolean.true,
        'NewMaterial': {
        'Color': (255,0,0),
        'Pattern': None,
        'Gradient': None,
        'Texture': None
        }
    }) 
    
Cassel
https://creationcassel.com/store
Specializing in PSP specific products: scripts and tubes

https://scrapbookcampus.com
for beginner and seasoned scrappers and designers and other PSP users
Post Reply