You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've spend some time tinkering with the project settings, and I don't want to do that on every new release of PhoenixPE, I didn't find any config file or .ini file to do that, I think the settings is stored in the .script files it-selves , which ofc will be changed/reset on any new update.
You are correct. The script settings are stored in the script itself. This is due to how PEBakery, the script engine that powers PhoenixPE (and its predecessor Winbuilder) are designed. There are plans to enhance PEBakery in the future so that settings can be retained when there is an update, however there is no timeline for this enhancement.
You can minimize the impact by only updating the individual scripts that have changed between releases. I get it though. It can be a pain to tweak everything just the way you like it and have to re-do everything the next time you want to update.
I've written a Powershell script that you may use:
# peselsetter.ps1
# Peter Siering, c't, 11/2022
#
# this script helps to read and write script variables
# within a PhoenixPE project; it avoids commiting those
# variable settings within a git project
#
# should run on every platform with pwsh (even CI/CD)
#
# if called without parameter it prints the selected
# variable for all script files in project, call in
# Windows with:
#
# powershell -ExecutionPolicy Unrestricted -f .\peselsetter.ps1 | sc default.sel
#
# piping through sc avoids utf8-bom-codings, so generated
# files are recognized as text in GitLab & Co.
#
# if called with a filename as parameter it writes
# the selected variables for all scripts mentioned in file
#
# powershell -ExecutionPolicy Unrestricted -f .\peselsetter.ps1 .\default.sel
#
# (edited) output should be used as input; script writes
# and expects a signature in file; if missing, nothing gets
# written
#
$PSDefaultParameterValues['Out-File:Encoding'] = 'oem'
# check if in valid project directory
if (!((Test-Path( "MyApps")) -and (Test-Path( "PhoenixPE")))) {
Write-Error "Working directory has be root of PhoenixPE project"
Exit
}
# check if specified settings file exists
$settingsfile= $args[0]
if (($settingsfile) -and !(Test-Path( $settingsfile))) {
Write-Error "Must specify existing settings file"
Exit
}
# if no file specify output selected variable for all scripts
if (!($settingsfile)) {
# write signature
"CTMZ"
Get-ChildItem "." -Recurse -Filter *.script |
Foreach-Object {
foreach ($line in Get-Content $_.FullName) {
if ( $line -imatch "^selected=(\w+)") {
$output=$matches[1]
}
}
$output= $_.FullName.replace( $PWD,'').SubString(1)+ ":Selected="+ $output
$output
}
Exit
}
# cycle through all scripts and set selected variable
# todo: count replacements
foreach ( $setting in Get-Content $settingsfile) {
# check signature
if ( $setting -eq "CTMZ") {
$signaturefound="true"
continue
}
$filecount++
($path,$var)=$setting.Split(':', 2)
# be sure to use right path seperator for platform running on by Join-Path
$path=Join-Path -Path "." -ChildPath $path
if ( $signaturefound) {
($varname,$varval)=$var.Split('=', 2)
(Get-Content -Raw $path) | ForEach-Object { $_ -replace "$varname=(.+)","$varname=$varval"} | Set-Content -NoNewLine $path
}
}
" $filecount files processed"
Adding this for reference, paraglider also created a couple of utilities for saving/restoring the state of a script. keep in mind that these were built for Winbuilder scrips, so they may or may not work flawlessly with PEBakery enhancements. Obviously I provide no support whatsoever if you choose to play with them. :) If you don't have any knowledge about pebakery scripting internals, stick with psct's powershell script above, which was designed for PEBakery.
Based on @psct script, I wrote my own script to work differently. Here is my script to backup and restore selected state of each script.
With this version, since the script and the backup it creates are outside the Projects folder, there is less chance that it will be inadvertently deleted.
Create a backup folder or any other named folder at the same level of Projects and put the script in there.
Read the top comments in the script to learn how to use it. You can save and restore multiple scenarios if you give your settings a custom file name with -name parameter.
Activity
homes32 commentedon Jan 4, 2023
You are correct. The script settings are stored in the script itself. This is due to how PEBakery, the script engine that powers PhoenixPE (and its predecessor Winbuilder) are designed. There are plans to enhance PEBakery in the future so that settings can be retained when there is an update, however there is no timeline for this enhancement.
You can minimize the impact by only updating the individual scripts that have changed between releases. I get it though. It can be a pain to tweak everything just the way you like it and have to re-do everything the next time you want to update.
psct commentedon Jan 4, 2023
I've written a Powershell script that you may use:
captain-majid commentedon Jan 6, 2023
Might need it later, thanks for sharing !
homes32 commentedon Sep 28, 2024
Adding this for reference, paraglider also created a couple of utilities for saving/restoring the state of a script. keep in mind that these were built for Winbuilder scrips, so they may or may not work flawlessly with PEBakery enhancements. Obviously I provide no support whatsoever if you choose to play with them. :) If you don't have any knowledge about pebakery scripting internals, stick with psct's powershell script above, which was designed for PEBakery.
SaveScriptState
RestoreScriptState
http://wb.paraglidernc.com/Utilities/utilities.htm
Fred-Vatin commentedon Aug 7, 2025
Based on @psct script, I wrote my own script to work differently. Here is my script to backup and restore selected state of each script.
With this version, since the script and the backup it creates are outside the
Projectsfolder, there is less chance that it will be inadvertently deleted.Create a backup folder or any other named folder at the same level of
Projectsand put the script in there.Read the top comments in the script to learn how to use it. You can save and restore multiple scenarios if you give your settings a custom file name with
-nameparameter.