NEW! Corel PaintShop Pro 2018

Script help

Moderator: trueblue

Script help

Postby leahcimi » Tue Sep 12, 2017 11:57 am

I'm not very familiar with scripts but am looking for a way to load the current PSP X9 image into an external program, work on it and return it to PSP.
Can anyone help please?
Thanks.
leahcimi
 
Posts: 51
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL

Re: Script help

Postby LeviFiction » Tue Sep 12, 2017 6:48 pm

Such a script has been made before with different programs. Can't remember what they were.

What program are you looking to make it work with?
LeviFiction
Advisor
 
Posts: 4750
Joined: Thu Oct 02, 2008 1:07 pm
Location: USA
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PSP (Installed): XI, X7, X8,X9

Re: Script help

Postby leahcimi » Tue Sep 12, 2017 6:55 pm

LandScapePro
leahcimi
 
Posts: 51
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL

Re: Script help

Postby JoeB » Tue Sep 12, 2017 11:08 pm

LeviFiction wrote:Such a script has been made before with different programs. Can't remember what they were.


Could you be referring to the script that was created to get Nik plugins like Viveza to work in PSP when people were having issues getting them installed and working properly?
Regards,

JoeB
Using PSP X9 and 2018, 32-bit
JoeB
 
Posts: 1391
Joined: Fri Mar 28, 2008 10:04 pm
Location: Canada
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: LENOVO 4524PE4 ThinkCentre M91p
processor: 3.10 gigahertz Intel Quad Core i5-2400
ram: 8 GB
Hard_Drive_Capacity: 4.6 TB
Corel programs: PSP 9, X7 to 2018, 32 & 64-bit

Re: Script help

Postby LeviFiction » Wed Sep 13, 2017 1:06 am

Yes, I believe so.
LeviFiction
Advisor
 
Posts: 4750
Joined: Thu Oct 02, 2008 1:07 pm
Location: USA
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PSP (Installed): XI, X7, X8,X9

Re: Script help

Postby JoeB » Wed Sep 13, 2017 2:24 am

LeviFiction wrote:Yes, I believe so.


I don't have Landscape Pro (the OP's program) but perhaps the script would work with that also. If I recall correctly it may just be a matter of some editing to point it to the program of choice, but I could be wrong.
Regards,

JoeB
Using PSP X9 and 2018, 32-bit
JoeB
 
Posts: 1391
Joined: Fri Mar 28, 2008 10:04 pm
Location: Canada
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: LENOVO 4524PE4 ThinkCentre M91p
processor: 3.10 gigahertz Intel Quad Core i5-2400
ram: 8 GB
Hard_Drive_Capacity: 4.6 TB
Corel programs: PSP 9, X7 to 2018, 32 & 64-bit

Re: Script help

Postby leahcimi » Wed Sep 13, 2017 6:07 pm

I am using the modified script that was created to get Nik plugins like Viveza to work in PSP but have hit a problem:

When I run the script, a new layer containing the temporary image file is created in PSP immediately and the same inage opens in LandscaePro.

I can edit that image in LandscapePro, save the changes and exit but, although these changes have been made to the temporary file, they are not shown in the new layer in PSP.

It seems that the temporary files is opened as a new layer in PSP before LandscapePro has had a chance to work on it.

Any suggestions gratefully received.
leahcimi
 
Posts: 51
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL

Re: Script help

Postby JoeB » Wed Sep 13, 2017 7:44 pm

The script should not be creating a new layer on your PSP image as soon as you run it and before the image has been processed by the outside program. That layer should only be created after the outside program has processed it and that processed image is save as a temporary file in your Documents folder, where it is captured and ultimately pasted as a new layer on your PSP image. If you watch your layers palette when you start the script do you see a layer being created prior to processing the image in Landscape? If you can't see your layers palette when Landscape opens you can minimize it to be able to check and see if a new layer has already been created.
Regards,

JoeB
Using PSP X9 and 2018, 32-bit
JoeB
 
Posts: 1391
Joined: Fri Mar 28, 2008 10:04 pm
Location: Canada
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: LENOVO 4524PE4 ThinkCentre M91p
processor: 3.10 gigahertz Intel Quad Core i5-2400
ram: 8 GB
Hard_Drive_Capacity: 4.6 TB
Corel programs: PSP 9, X7 to 2018, 32 & 64-bit

Re: Script help

Postby LeviFiction » Wed Sep 13, 2017 7:45 pm

Can you post a link to the script? I don't have time to search myself and it's a pain using this site on a phone. :P

If I remember correctly the script uses a Python command to call a shell command. But, if the program it runs returns control back to the calling script the script has no need to wait and then proceeds to finish running. So we may need to use the Pause script to make it a two click situation.

Running the program the first time will open Landscape Pro. Then when you're done you run the script a second time to have it load in the edited image. Should be easy enough.
LeviFiction
Advisor
 
Posts: 4750
Joined: Thu Oct 02, 2008 1:07 pm
Location: USA
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PSP (Installed): XI, X7, X8,X9

Re: Script help

Postby JoeB » Wed Sep 13, 2017 7:51 pm

LeviFiction wrote:Can you post a link to the script? I don't have time to search myself and it's a pain using this site on a phone. :P

If I remember correctly the script uses a Python command to call a shell command. But, if the program it runs returns control back to the calling script the script has no need to wait and then proceeds to finish running. So we may need to use the Pause script to make it a two click situation.

Running the program the first time will open Landscape Pro. Then when you're done you run the script a second time to have it load in the edited image. Should be easy enough.


Here are all the scripts.
Attachments
PSP X4 Scripts for free Nik Collection.zip
Nik scripts
(11.43 KiB) Downloaded 17 times
Regards,

JoeB
Using PSP X9 and 2018, 32-bit
JoeB
 
Posts: 1391
Joined: Fri Mar 28, 2008 10:04 pm
Location: Canada
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: LENOVO 4524PE4 ThinkCentre M91p
processor: 3.10 gigahertz Intel Quad Core i5-2400
ram: 8 GB
Hard_Drive_Capacity: 4.6 TB
Corel programs: PSP 9, X7 to 2018, 32 & 64-bit

Re: Script help

Postby leahcimi » Wed Sep 13, 2017 8:24 pm

Solved by adding:

# Wait for input
ButtonTypes = ( 'Cancel/No', 'OK/Yes' )
result = App.Do(Environment, 'MsgBox', {
'Buttons': App.Constants.MsgButtons.OK,
'Icon': App.Constants.MsgIcons.Info,
'Text': 'OK for importing picture as new layer',
})
ButtonTypes[ result ]

after 'the subprocess.call' line.

Thanks for everyones input.
leahcimi
 
Posts: 51
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL

Re: Script help

Postby LeviFiction » Wed Sep 13, 2017 10:11 pm

True, that's probably a better and easier solution. xD

And I had just finished the pause script edit.
LeviFiction
Advisor
 
Posts: 4750
Joined: Thu Oct 02, 2008 1:07 pm
Location: USA
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PSP (Installed): XI, X7, X8,X9

Re: Script help

Postby leahcimi » Wed Sep 13, 2017 10:45 pm

Thanks anyway :)
leahcimi
 
Posts: 51
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL

Re: Script help

Postby JoeB » Thu Sep 14, 2017 3:19 am

LeviFiction wrote:True, that's probably a better and easier solution. xD


Would you or the OP be willing to explain how that code snippet cured the problem? All I can guess at is that it paused the script somehow until the OP did his editing in Landscape and saved it (which should have resulted in the edited image being saved in the Documents folder as a temp file) and then he could click the script's msgbox OK button to continue the script to import the saved temp file as a new layer on the original image. But even if that's the case (which is just a guess on my part) I'm not sure how/why it works.
Regards,

JoeB
Using PSP X9 and 2018, 32-bit
JoeB
 
Posts: 1391
Joined: Fri Mar 28, 2008 10:04 pm
Location: Canada
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: LENOVO 4524PE4 ThinkCentre M91p
processor: 3.10 gigahertz Intel Quad Core i5-2400
ram: 8 GB
Hard_Drive_Capacity: 4.6 TB
Corel programs: PSP 9, X7 to 2018, 32 & 64-bit

Re: Script help

Postby LeviFiction » Thu Sep 14, 2017 3:34 am

That is exactly what happens, and it works because Python is a procedural language.

Each step in the script waits for the prior step to complete before executing. In the original script they use "subprocess.call()" which is a command that starts up another program or process and then waits until it receives an "a ok" from the program that it ran. However, LandscapePro immediately returns control back to Python even though it's still running. So this method doesn't work for Landscape Pro as there's nothing forcing the command to wait.

What leachcimi did was pop up a Message Box which pauses the program until you choose either OK or Cancel. The script runs the command and then all other functions stop until the message box is closed. Since the script relies on an external program this works perfectly. PSP doesn't need to be able to do anything while you're working inside LandscapePro. So there is no harm in stopping the program from doing anything else. Once they've completed their image they hit "OK" and the script stops waiting and moves onto the next commands completing the script.

With the original command this waiting is handled by the process/program itself taking full control and only returning that control when you've closed it. With this program you had to simulate forcing the script to wait. Easiest way is a message box.
LeviFiction
Advisor
 
Posts: 4750
Joined: Thu Oct 02, 2008 1:07 pm
Location: USA
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PSP (Installed): XI, X7, X8,X9

Next

Return to PSP Scripting

Who is online

Users browsing this forum: No registered users and 3 guests