Highlighted

Script to Help Back-up Photoshop Settings

Adobe Community Professional ,
Oct 19, 2020

Copy link to clipboard

Copied

I created a script to help users back up their settings before updating or migrating to a new computer. There are other methods for this, including an Adobe script to migrate settings, however, when it comes to backing up one can't have too many backups!

 

My GitHub repo can be found here:

MarshySwamp/Backup-Photoshop-Settings

 

All it does is open up some "hard to find" folders for the user to copy data (presets, Actions Palette.psp file etc). 

 

And here is the code:

 

 

 

/* Open Photoshop Presets & Settings Folders */

#target photoshop

app.bringToFront();

openPresetsAndSettingsFolders();

function noteOne() {
    alert("This script will open 3 folders to facilitate backing up data before updating or migrating Photoshop.")
}

function noteTwo() {
    alert("Script completed! Backup the following files and folders:" + "\r" + "\r" +
        "* Actions Palette.psp file inside the User's Settings folder" + "\r" + "\r" +
        "* All folders inside the Application's Presets folder" + "\r" + "\r" +
        "* All folders inside the User's Presets folder")
}

function noteThree() {
    alert("Note:" + "\r" + "In addition to backing up the Actions Palette.psp file, it is strongly recommended that each action set is saved to individual .atn action files!")
}

function openPresetsAndSettingsFolders() {
    var os = $.os.toLowerCase().indexOf('mac') >= 0 ? "MAC" : "WINDOWS";
    if (os === 'MAC') {
        // alert("It's a Mac!");

        noteOne();
        noteTwo();
        noteThree();

        appSettings();
        appPresets();
        userPresets();

        function appSettings() {
            var appPath = app.path.fsName.replace(/^\/.+\//, '');
            var userSettingsDir = '~/Library/Preferences/' + appPath + ' Settings';
            var userSettingsDirOpen = Folder(userSettingsDir);
            userSettingsDirOpen.execute();
        }

        function appPresets() {
            var presetDir = app.path + '/Presets';
            var presetDirOpen = Folder(presetDir);
            presetDirOpen.execute();
        }

        function userPresets() {
            var appPath = app.path.fsName.replace(/^\/.+\//, '');
            var userPresetDir = '~/Library/Application Support/Adobe/' + appPath;
            var userPresetDirOpen = Folder(userPresetDir);
            userPresetDirOpen.execute();
        }

    } else {
        // alert("It's Windows!");

        noteOne();
        noteTwo();
        noteThree();

        appSettings();
        appPresets();
        userPresets();

        function appSettings() {
            var appPath = app.path.fsName.replace(/^.+\\/, '');
            var userSettingsDir = '~/appData/Roaming/Adobe/' + appPath + '/' + appPath + ' Settings';
            var userSettingsDirOpen = Folder(userSettingsDir);
            userSettingsDirOpen.execute();
        }

        function appPresets() {
            var presetDir = app.path + '/Presets';
            var presetDirOpen = Folder(presetDir);
            presetDirOpen.execute();
        }

        function userPresets() {
            var appPath = app.path.fsName.replace(/^.+\\/, '');
            var userPresetDir = '~/appData/Roaming/Adobe/' + appPath + '/Presets';
            var userPresetDirOpen = Folder(userPresetDir);
            userPresetDirOpen.execute();
        }

    }
}

 

 

 

If this script saves at least one person from losing their custom actions or other presets, then I'm happy!

 

Tested on Mac CC 2018 + CC 2019 and Win CC 2020 + Win CC 2021.

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

TOPICS
Actions and scripting

Views

203

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Script to Help Back-up Photoshop Settings

Adobe Community Professional ,
Oct 19, 2020

Copy link to clipboard

Copied

I created a script to help users back up their settings before updating or migrating to a new computer. There are other methods for this, including an Adobe script to migrate settings, however, when it comes to backing up one can't have too many backups!

 

My GitHub repo can be found here:

MarshySwamp/Backup-Photoshop-Settings

 

All it does is open up some "hard to find" folders for the user to copy data (presets, Actions Palette.psp file etc). 

 

And here is the code:

 

 

 

/* Open Photoshop Presets & Settings Folders */

#target photoshop

app.bringToFront();

openPresetsAndSettingsFolders();

function noteOne() {
    alert("This script will open 3 folders to facilitate backing up data before updating or migrating Photoshop.")
}

function noteTwo() {
    alert("Script completed! Backup the following files and folders:" + "\r" + "\r" +
        "* Actions Palette.psp file inside the User's Settings folder" + "\r" + "\r" +
        "* All folders inside the Application's Presets folder" + "\r" + "\r" +
        "* All folders inside the User's Presets folder")
}

function noteThree() {
    alert("Note:" + "\r" + "In addition to backing up the Actions Palette.psp file, it is strongly recommended that each action set is saved to individual .atn action files!")
}

function openPresetsAndSettingsFolders() {
    var os = $.os.toLowerCase().indexOf('mac') >= 0 ? "MAC" : "WINDOWS";
    if (os === 'MAC') {
        // alert("It's a Mac!");

        noteOne();
        noteTwo();
        noteThree();

        appSettings();
        appPresets();
        userPresets();

        function appSettings() {
            var appPath = app.path.fsName.replace(/^\/.+\//, '');
            var userSettingsDir = '~/Library/Preferences/' + appPath + ' Settings';
            var userSettingsDirOpen = Folder(userSettingsDir);
            userSettingsDirOpen.execute();
        }

        function appPresets() {
            var presetDir = app.path + '/Presets';
            var presetDirOpen = Folder(presetDir);
            presetDirOpen.execute();
        }

        function userPresets() {
            var appPath = app.path.fsName.replace(/^\/.+\//, '');
            var userPresetDir = '~/Library/Application Support/Adobe/' + appPath;
            var userPresetDirOpen = Folder(userPresetDir);
            userPresetDirOpen.execute();
        }

    } else {
        // alert("It's Windows!");

        noteOne();
        noteTwo();
        noteThree();

        appSettings();
        appPresets();
        userPresets();

        function appSettings() {
            var appPath = app.path.fsName.replace(/^.+\\/, '');
            var userSettingsDir = '~/appData/Roaming/Adobe/' + appPath + '/' + appPath + ' Settings';
            var userSettingsDirOpen = Folder(userSettingsDir);
            userSettingsDirOpen.execute();
        }

        function appPresets() {
            var presetDir = app.path + '/Presets';
            var presetDirOpen = Folder(presetDir);
            presetDirOpen.execute();
        }

        function userPresets() {
            var appPath = app.path.fsName.replace(/^.+\\/, '');
            var userPresetDir = '~/appData/Roaming/Adobe/' + appPath + '/Presets';
            var userPresetDirOpen = Folder(userPresetDir);
            userPresetDirOpen.execute();
        }

    }
}

 

 

 

If this script saves at least one person from losing their custom actions or other presets, then I'm happy!

 

Tested on Mac CC 2018 + CC 2019 and Win CC 2020 + Win CC 2021.

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

TOPICS
Actions and scripting

Views

204

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 19, 2020 3
Advocate ,
Oct 20, 2020

Copy link to clipboard

Copied

Stephen a great script
2 questions
the first question
where backups are saved

the second question
when I take the backup to another computer
you can make a script that places them in the right place.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 20, 2020 0
Adobe Community Professional ,
Oct 20, 2020

Copy link to clipboard

Copied

It is all manual at the moment.

 

More can be done, however, I'm only a newb at scripting. I thought that it was better to make the script public than to sit on it forever in the hope of making it more functional. I'd love it if somebody extended the script to do more!

 

All the script does it open up three folders... The rest is up to you!

 

  • One should backup the Actions Palette.psp file inside the User's Settings folder
  • Also backup all folders inside the Application's Presets folder
  • And all folders inside the User's Presets folder

 

Where you copy them is up to you. Perhaps you will decide to select the appropriate files and folders and then right/contextual click and zip compress the assets?

 

The script can also be used to open the folders in the new version or computer, where you can then copy over the items from the backup that you manually created.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 20, 2020 0
Adobe Community Professional ,
Oct 27, 2020

Copy link to clipboard

Copied

Can somebody running CC 2020 or CC 2021 on a Mac please test the script and also confirm the path of the user preferences folder?

 

Has it changed from:

 

Users⁩/username/⁨Library⁩/⁨Preferences⁩/Adobe Photoshop CC ??? Settings⁩/

 

 

The reason that I ask is that the path has apparently changed on Windows:

 

C:\Users\username\AppData\Roaming\Adobe\Photoshop\???\Adobe Photoshop ??? Settings\

C:\Users\username\appData\Roaming\Adobe\Adobe Photoshop ???\Adobe Photoshop ??? Settings\

 

Thank you!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2020 0
Advocate ,
Oct 27, 2020

Copy link to clipboard

Copied

Using a Win10 system with PS2021, but the script opens only the presets folder...

 

I have to use the complete path like: /C/Users/USERNAME/appdata/roaming...

 

Neither "~/appdata/roaming" nor "%appdata%" works...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2020 0
Most Valuable Participant ,
Oct 27, 2020

Copy link to clipboard

Copied

If you run Windows  I posted a script that you can use to backup dated version of your photoshop versions preferences.  The script save these version in a folder on your desktop named "PsPreferences". The script is for windows only the last time I used a mac was around 25 years ago an expensive G5 with Apple OS7 or OS9 I believe.  That was an Apple OS before Steve abandoned Apples OS and switch to a Unix type OS. I do not know Photoshop layout in Apples file system or remember Unix commands from my use of IBM's AIX Unix system.

image.png

BackupPhotoshopPreferences.jsx

 

var makeFolder =  new Folder('~/Desktop/PsPreferences');
makeFolder.create(); // make sure the folder 
var makeFolder = new Folder(makeFolder + "/" + app.version);					
makeFolder.create(); // make sure the folder 
var now = timeStamp();
var makeFolder = new Folder(makeFolder + "/" + now );					
makeFolder.create(); // make sure the folder 

var Preferences =  new Folder(app.preferencesFolder);

var current = convertPath(Preferences);
var backup = convertPath(makeFolder);
//alert('Copy "' + current + '" "'  + backup + '"'); 
var batch_file = new File(Folder.temp + "/CpyPsPref.bat");
batch_file.open("w");
batch_file.write('Copy "' + current + '" "'  + backup + '"'); 
batch_file.close;
batch_file.execute();
alert("PS " + app.version + " Preferences " + now);

function  convertPath(location) {
	str = String(location);
	if (str.indexOf("~") != -1 ) str = str.substr(str.indexOf("~") + 1 ,);
	while (str.indexOf("%20") != -1 ) {	
		before = str.substr(0, str.indexOf("%20")) + " ";
		after = str.substr(str.indexOf("%20") + 3 ,);
		str = before + after;
	}
 	var path = "c:\\Users\\" +$.getenv("username");
	while (str.indexOf("/") != -1 ) {	
		path = path + str.substr(0, str.indexOf("/")) + "\\";
		str = str.substr(str.indexOf("/") + 1 ,);
	}
	return path + str;
}

function timeStamp(){

	// Get the time and format it
	var digital = new Date();
	var hours = digital.getHours();
	var minutes = digital.getMinutes();
	var seconds = digital.getSeconds();
	var amOrPm = "AM";
	if (hours > 11) amOrPm = "PM";
	if (hours > 12) hours = hours - 12;
	if (hours == 0) hours = 12;
	if (minutes <= 9) minutes = "0" + minutes;
	if (seconds <= 9) seconds = "0" + seconds;

	// Get the date and format it
	var date = new Date();
	var d  = date.getDate();
	var day = (d < 10) ? '0' + d : d;
	var m = date.getMonth() + 1;
	var month = (m < 10) ? '0' + m : m;
	var yy = date.getYear();
	var year = (yy < 1000) ? yy + 1900 : yy;
	
	// create a variable with the fully formatted the time and date
	// todaysDate = hours + ":" + minutes + ":" + seconds + " " + amOrPm + " - " + day + "/" + month + "/" + year;
	// todaysDate = hours + ":" + minutes + ":" + seconds + " " + amOrPm + " - " + month + "/" + day + "/" + year;

	MonthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

	todaysDate = hours + "-" + minutes + "-" + seconds + " " + amOrPm + " " + MonthNames[date.getMonth()] + " " + date.getDate() + ", " + year;

        return todaysDate;
}

 

 

JJMack

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2020 1
Adobe Community Professional ,
Oct 27, 2020

Copy link to clipboard

Copied

I have tested in CC 2021 on Win 10 Pro 64-bit and all three folders open up fine at the correct location. Strange, perhaps user account related? Thank you for the feedback!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2020 0
Adobe Community Professional ,
Oct 27, 2020

Copy link to clipboard

Copied

Thank you for sharing JJMack!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 27, 2020 0