Script help

Moderator: Kathy_9

leahcimi
Posts: 106
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
Location: SE Cornwall

Script help

Post by leahcimi »

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.
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 help

Post by LeviFiction »

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?
https://levifiction.wordpress.com/
leahcimi
Posts: 106
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
Location: SE Cornwall

Re: Script help

Post by leahcimi »

LandScapePro
JoeB
Posts: 2778
Joined: Fri Mar 28, 2008 10:04 pm
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 2019, 32 & 64-bit
Location: Canada

Re: Script help

Post by JoeB »

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 2019 64bit
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 help

Post by LeviFiction »

Yes, I believe so.
https://levifiction.wordpress.com/
JoeB
Posts: 2778
Joined: Fri Mar 28, 2008 10:04 pm
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 2019, 32 & 64-bit
Location: Canada

Re: Script help

Post by JoeB »

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 2019 64bit
leahcimi
Posts: 106
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
Location: SE Cornwall

Re: Script help

Post by leahcimi »

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.
JoeB
Posts: 2778
Joined: Fri Mar 28, 2008 10:04 pm
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 2019, 32 & 64-bit
Location: Canada

Re: Script help

Post by JoeB »

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 2019 64bit
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 help

Post by LeviFiction »

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.
https://levifiction.wordpress.com/
JoeB
Posts: 2778
Joined: Fri Mar 28, 2008 10:04 pm
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 2019, 32 & 64-bit
Location: Canada

Re: Script help

Post by JoeB »

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 230 times
Regards,

JoeB
Using PSP 2019 64bit
leahcimi
Posts: 106
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
Location: SE Cornwall

Re: Script help

Post by leahcimi »

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.
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 help

Post by LeviFiction »

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

And I had just finished the pause script edit.
https://levifiction.wordpress.com/
leahcimi
Posts: 106
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
Location: SE Cornwall

Re: Script help

Post by leahcimi »

Thanks anyway :)
JoeB
Posts: 2778
Joined: Fri Mar 28, 2008 10:04 pm
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 2019, 32 & 64-bit
Location: Canada

Re: Script help

Post by JoeB »

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 2019 64bit
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 help

Post by LeviFiction »

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.
https://levifiction.wordpress.com/
Post Reply