Save Preferences Script

Moderator: Kathy_9

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

Save Preferences Script

Post by LeviFiction »

Hello, anyone who reads this board. :D

So in the X8 wishlist topic I told a couple of people to give me 1 day and I would make a Save Preferences script. And I did. I just forgot all about it and so never told anyone.

It was also more or less just a proof of concept script. Very simplistic. And very ugly. It comes in two scripts, you have to manually program in the file location in both of them. The first script is a save script. The second is the load script. Using these you could easily save your preferences for read-back later. And provided PSP doesn't change those preferences too much between versions it should also technically work regardless of which version of PSP the preferences come from. I've only tested this with X6 and X7 though. SO I make no guarantees.

You can download the scripts here - https://drive.google.com/file/d/0B8FlFL ... sp=sharing

By default the script runs silently so once it's done saving it's done saving. There is no notification of completion. If you prefer to see a pop-up letting you know then download this alternative set. These scripts will send a short pop-up at the end of the script if it's successful.

https://drive.google.com/file/d/0B8FlFL ... sp=sharing

The scripts should be installed in the "Scripts Trusted" folder because they use libraries and save files to your hard drive.

Here's a video demonstrating its use - https://www.youtube.com/watch?v=S_CoGttsL2c
Last edited by LeviFiction on Thu May 05, 2016 2:01 pm, edited 1 time in total.
Kathy_9
Site Admin
Posts: 2859
Joined: Tue Nov 30, 2010 12:44 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
processor: 8th Generation Intel Core i7 8700 3 20 GHz
ram: 16GB
Video Card: NVIDIA GeForce RTX 2060 [6 GB GDDR6 dedicated]
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2TB
Monitor/Display Make & Model: HP EliteDisplay E243m 23.8-inch
Corel programs: PSPX2 ~2023; Painter 2018~23
Location: USA

Re: Save Preferences Script

Post by Kathy_9 »

Very slick - thanks!!!
PSPX9 | PSP2020 | PSP2021| PSP2022 | PSP2023 & PhotoMirage installed; PSPX | PSPX2 thru PSP2019 owned but not installed
http://www.flickr.com/photos/37153430@N03/
Jean-Luc
Advisor
Posts: 2138
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)

Re: Save Preferences Script

Post by Jean-Luc »

LeviFiction wrote:Hello, anyone who reads this board. :D

So in the X8 wishlist topic I told a couple of people to give me 1 day and I would make a Save Preferences script. And I did. I just forgot all about it and so never told anyone.

.../...
Very clever ! Thank you !
I don't understand why Corel itself didn't provide us this sort or script with each version of PSP!
:roll:
Jean-Luc
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
KathyB
Posts: 163
Joined: Fri Jun 13, 2014 5:14 pm
operating_system: Windows 7 Ultimate
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware 068R5X A03
processor: 2.70 gigahertz Intel Core i7-4800MQ 64 kilobyte pr
ram: 16 gb
Video Card: NVIDIA GeForce GTX 770M
sound_card: NVIDIA Virtual Audio Device WDM
Hard_Drive_Capacity: 4500.48 Gb
Monitor/Display Make & Model: Alienware Alienware 17 A07

Re: Save Preferences Script

Post by KathyB »

Thank you :D
KathyB
User avatar
arturox
Posts: 242
Joined: Fri Sep 16, 2011 6:51 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Yes-very-bored
processor: 3-90 gigahertz Intel Core i3-7100
ram: 8 Gigs
Hard_Drive_Capacity: 250Gb SSD+1 Tb SSD
Monitor/Display Make & Model: Acer 22 inch
Corel programs: PSP 9-01 and PSP 2022
Location: UK England

Re: Save Preferences Script

Post by arturox »

Long time since LeviFiction's original posting, but I've only just been pointed at it.

This is a most excellent bit o' scripting Levi, something we've needed for a long time.
Thanks, much appreciated.

Arturox.

FWIW. I've also tried it out on PSP 9.01 and it worked okay.

Ax
Jean-Luc
Advisor
Posts: 2138
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)

Re: Save Preferences Script

Post by Jean-Luc »

Just a suggestion ...

When backingup the Preferences, after the saving I would see a pop-up window saying :
"Your preferences are now saved and stored here : ".. folder xxx ... etc. "
This window permits also to know that the job is done. Actually, the saving is silent and nothing is visible saying "ok, done" ... For first time users, it would be better.
:)
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
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: Save Preferences Script

Post by LeviFiction »

Done, edited original post to include the msgbox as a separate option.
trueblue
Moderator
Posts: 1563
Joined: Sat Dec 30, 2006 1:43 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Z97M Plus
processor: Intel Core i7-4790 CPU 3.60 GHz
ram: 12GB
Video Card: NVIDIA GeForce GTX 750
sound_card: NVIDIA High Def Audio Realtek High Def
Hard_Drive_Capacity: 1.740GB
Monitor/Display Make & Model: Benq E2420HD 24" wide x 2 monitors
Corel programs: PSPX8-VideoStudio-AfterShot
Location: Australia

Re: Save Preferences Script

Post by trueblue »

Thanks Levifiction, this is a super script and will be most useful.
~~~~Maureen~~~~
Tutorial Writer for PaintShop Pro

Creative-Designs
Free! PaintShop Pro Tutorials
PaintShop Pro - VideoStudio Pro - AfterShot - CorelDraw - Painter
Cassel
Posts: 1584
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

Re: Save Preferences Script

Post by Cassel »

Matthew, do you know how far back this script can work for different versions of PSP?
Is it limited to X8 and up?
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
Cassel
Posts: 1584
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

Re: Save Preferences Script

Post by Cassel »

Another question: where is the data saved?
If someone wants to save their preferences before installing PSP on a different machine for example, where would the 'file' be that they would need to grab and copy from?
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
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: Save Preferences Script

Post by LeviFiction »

It attempts to save the file to the Workspaces folder. If you watch the video linked in the original post it shows you how to edit the script to change the location of the file should you choose to do so.

I only tested back to X6. However, it relies on the PSP API to return the preferences settings. So as long as the version of PSP supports the command and returns all of the necessary information it should work in most versions of PSP. For an exact limit, you'd have to test it yourself. It's honestly an extremely simple script it's not doing anything too fancy.
Cassel
Posts: 1584
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

Re: Save Preferences Script

Post by Cassel »

Thanks. I ran it and the file was not saved in the Workspace folder, but instead, on the parent folder of the Workspace folder.
Not sure if it is typical or what. Just letting you know.
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
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: Save Preferences Script

Post by LeviFiction »

Well, i said it would try to save it to the Workspaces folder. If you use the defaults and don't edit the script at all it grabs the first location returned by the File Locations dialog. In the video you see it goes into my Workspaces folder. So, no, it's not typical for it to save outside of the workspaces folder.

Code: Select all

os.path.join(files['Workspaces'][0], FilePref)
So it's not like the code leaves out a folder location. It all depends on what that first value is and if PSP or Python or Windows do any kind of re-routing if that first location is not in your Documents folder. Which I don't believe any of the do reroute. They usually just throw an error if you try to save to an invalid location.
JoeB
Posts: 2774
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: Save Preferences Script

Post by JoeB »

I just tried this script, and while it works in X7 and X8 it won't load in X9. The problem is here line 2 - and I'm curious about what's with the pickle??
Executing RunScript
Traceback (most recent call last):
File "<string>", line 2, in <module>
ImportError: No module named pickle
Regards,

JoeB
Using PSP 2019 64bit
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: Save Preferences Script

Post by LeviFiction »

pickle is Python's serialization format. It makes saving and restoring native Python data very fast.

Make sure you have the latest patches for X9, the official version of PSP did not come with all of the python libraries. I think you need to specifically install Patch 1 before other patches. This was the result of Corel trying to make the download smaller. Did not go over well.