Pasting from clipboard as new image?

Moderator: Kathy_9

Post Reply
terrypin
Posts: 492
Joined: Tue Jun 29, 2010 9:51 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Asus Z170 Pro 4
processor: Intel Core i7 6700K 4.0GHz
ram: 32 GB
Video Card: None - uses built-in graphics
sound_card: HD onboard sound card
Hard_Drive_Capacity: 4.256 TB
Monitor/Display Make & Model: iLyama Prolite E2403WS 24" 1920x1200
Corel programs: Paint Shop Pro 8; Paint Shop Pro 2018
Location: East Grinstead UK

Pasting from clipboard as new image?

Post by terrypin »

I have an image on the Windows 10 clipboard and want to paste it as a new image in PSP 8.

To work around the problem I described here
http://forum.corel.com/EN/viewtopic.php ... 27#p351127
I'm wondering if a script could paste it instead please?
--
Terry, East Grinstead, UK
Using PSP 8 & PSP 2018 under Win 10
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: Pasting from clipboard as new image?

Post by LeviFiction »

You might be able to use a scriptlet. Just record a script that does "PasteGraphicAsNewImage" or "PasteImage' whichever version PSP8 uses. :P Then set the script as one of the parameters for opening PSP starting with "/Script". The script should execute upon PSP opening. Assuming PSP8 allows scriptlets.

Not being familiar with Macro Express at all this is my guess as to what that command would look like

Code: Select all

Activate or Launch: Window "Jasc Paint Shop Pro", Program "Paint Shop Pro.exe", Parameters "/Script C:\users\username\documents\mypsp8\scripts-restricted\yourscriptname.pspscript"
Scriptlets were designed to let you drag a photo onto the shortcut for PSP and have the script execute on opening the image, for very fast pre-programmed editing.
https://levifiction.wordpress.com/
terrypin
Posts: 492
Joined: Tue Jun 29, 2010 9:51 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Asus Z170 Pro 4
processor: Intel Core i7 6700K 4.0GHz
ram: 32 GB
Video Card: None - uses built-in graphics
sound_card: HD onboard sound card
Hard_Drive_Capacity: 4.256 TB
Monitor/Display Make & Model: iLyama Prolite E2403WS 24" 1920x1200
Corel programs: Paint Shop Pro 8; Paint Shop Pro 2018
Location: East Grinstead UK

Re: Pasting from clipboard as new image?

Post by terrypin »

Thanks Levi, I'll get stuck into that promising approach asap.

I've activated several of the PSP 8 scripts you developed with me last year and recently. The method I use is illustrated in this example:

Macro Run: Script Open
Delay: 100 milliseconds
Text Type (Use Clipboard and Paste Text): Elevation Edit (LeviFiction).PspScript // Elevation Edit
Delay: 100 milliseconds
Text Type (Simulate Keystrokes): <ENTER> // Run that script.
Delay: 0.2 seconds
Text Type (Simulate Keystrokes): <ENTER> // Apply & close.


That first macro (or 'sub-macro') is common to all such macros. It gets to the Script > Run box and enters the fixed folder name:
Text Type (Simulate Keystrokes): C:\Users\terry\My PSP8 Files\Scripts-Trusted\ // Cursor to empty name box
So that the 'main' macro above can then enter the specific script.
It works - but I'm sure there must be a more elegant way of comunicating my macro stuff with the magic of Python scripts!
--
Terry, East Grinstead, UK
Using PSP 8 & PSP 2018 under Win 10
terrypin
Posts: 492
Joined: Tue Jun 29, 2010 9:51 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Asus Z170 Pro 4
processor: Intel Core i7 6700K 4.0GHz
ram: 32 GB
Video Card: None - uses built-in graphics
sound_card: HD onboard sound card
Hard_Drive_Capacity: 4.256 TB
Monitor/Display Make & Model: iLyama Prolite E2403WS 24" 1920x1200
Corel programs: Paint Shop Pro 8; Paint Shop Pro 2018
Location: East Grinstead UK

Re: Pasting from clipboard as new image?

Post by terrypin »

With an image already captured to the clipboard (outside PSP8) I recorded a script by keying Ctrl+V. That gave me

Code: Select all

from JascApp import *

def ScriptProperties():
    return {
        'Author': u'',
        'Copyright': u'',
        'Description': u'',
        'Host': u'Paint Shop Pro',
        'Host Version': u'8.10'
        }

def Do(Environment):
    # EnableOptimizedScriptUndo
    App.Do( Environment, 'EnableOptimizedScriptUndo', {
            
            })

    # PasteGraphicAsNewImage
    App.Do( Environment, 'PasteGraphicAsNewImage', {
            'CreateFromDropData': App.Constants.Boolean.false, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match
                }
            })

    # SelectDocument
    App.Do( Environment, 'SelectDocument', {
            'SelectedImage': 0, 
            'Strict': App.Constants.Boolean.false, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match
                }
            })
On running that I got

Code: Select all

------- Command Execution Failed -----------
Command Name:	PasteGraphicAsNewImage
Error Text:	The attempted operation is not valid in the current program state.
Traceback (most recent call last):
  File "C:\Users\terry\My PSP8 Files\Scripts-Trusted\PasteImage.PspScript", line 19, in Do
    App.Do( Environment, 'PasteGraphicAsNewImage', {
JascApp.InvalidProgramState: Internal program state invalid
------- Command Execution Failed -----------
Command Name:	RunScript
Error Text:	The attempted operation is not valid in the current program state.
Apart from that, I want to be able to either
- Paste to an already open PSP 8
- Open PSP 8 and paste

I've now narrowed the MX Pro issue to its Activate or Launch command. So it's unrelated to Paste. Therefore even if we can get the script method working I have to resolve that. One improvement I've made is to instead open PSP 8 by using the Run box. But it takes 6 s before PSP 8 accepts the subsequent paste command! At least the macro then stops, but clearly that's a totally unsatisfactory solution. I'm seeking help from the MX Pro folk. Can't help thinking it must be down to a recent Win 10 WU, as this used to work sweetly.

Meanwhile, the other issue that arises from this Run box method is that it starts another instance of PSP 8. Is there some parameter I can use (either in Run box or Command Prompt) that will prevent this? IOW, force PSP 8 to use an existing single instance?
--
Terry, East Grinstead, UK
Using PSP 8 & PSP 2018 under Win 10
terrypin
Posts: 492
Joined: Tue Jun 29, 2010 9:51 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Asus Z170 Pro 4
processor: Intel Core i7 6700K 4.0GHz
ram: 32 GB
Video Card: None - uses built-in graphics
sound_card: HD onboard sound card
Hard_Drive_Capacity: 4.256 TB
Monitor/Display Make & Model: iLyama Prolite E2403WS 24" 1920x1200
Corel programs: Paint Shop Pro 8; Paint Shop Pro 2018
Location: East Grinstead UK

Re: Pasting from clipboard as new image?

Post by terrypin »

Pleased to report that I now have the simple script PasteImage.PspScript based on PasteGraphicAsNewImage working, applied to an already open PSP 8.

So my only outstanding question is whether it's possible to force PSP 8 to open only a single instance?
--
Terry, East Grinstead, UK
Using PSP 8 & PSP 2018 under Win 10
Post Reply