Jump to content

StringRegExpReplace and StringReplace for ThunderbirdPortable


Hyflex
 Share

Recommended Posts

Hey,

I used a Portable ThunderBird setup about a year ago, set it up with a bunch of pre-configured settings including logins for several accounts and made myself a little tool to re-configure based on what computer it is on.

The code I originally had I can't work out how/what it was doing what it was doing...

 

$SZFILE = @ScriptDir & "\ThunderbirdPortable\Data\settings\ThunderbirdPortableSettings.ini"
$SZTEXT = FileRead($SZFILE, FileGetSize($SZFILE))
$SZTEXT = StringReplace($SZTEXT, "C:\Users\USERNAME\Downloads\DEFAULT FOLDER\", @ScriptDir & "\", 0, 1)
FileDelete($SZFILE)
FileWrite($SZFILE, $SZTEXT)
 
$SZFILE = @ScriptDir & "\ThunderbirdPortable\Data\profile\compatibility.ini"
$SZTEXT = FileRead($SZFILE, FileGetSize($SZFILE))
$SZTEXT = StringReplace($SZTEXT, "C:\Users\USERNAME\Downloads\DEFAULT FOLDER\", @ScriptDir & "\", 0, 1)
FileDelete($SZFILE)
FileWrite($SZFILE, $SZTEXT)
 
$SZFILE = @ScriptDir & "\ThunderbirdPortable\Data\profile\extensions.ini"
$SZTEXT = FileRead($SZFILE, FileGetSize($SZFILE))
$SZTEXT = StringReplace($SZTEXT, "C:\Users\USERNAME\Downloads\DEFAULT FOLDER\", @ScriptDir & "\", 0, 1)
FileDelete($SZFILE)
FileWrite($SZFILE, $SZTEXT)
 
$SZFILE = @ScriptDir & "\ThunderbirdPortable\Data\profile\prefs.js"
$SZTEXT = FileRead($SZFILE, FileGetSize($SZFILE))
$SZTEXT1 = StringRegExpReplace(@ScriptDir & "\", "\\", "\\\\")
$SZTEXT = StringReplace($SZTEXT, "C:\\Users\\USERNAME\\Downloads\\DEFAULT FOLDER\\", $SZTEXT1, 0, 1)
FileDelete($SZFILE)
FileWrite($SZFILE, $SZTEXT)
 
$SZFILE = @ScriptDir & "\ThunderbirdPortable\Data\profile\prefs.js"
$SZTEXT = FileRead($SZFILE, FileGetSize($SZFILE))
$SZTEXT1 = StringRegExpReplace(@ScriptDir & "\", "\\", "\\\\\\\\")
$SZTEXT = StringReplace($SZTEXT, "C:\\\\Users\\\\USERNAME\\\\Downloads\\\\DEFAULT FOLDER\\\\", $SZTEXT1, 0, 1)
FileDelete($SZFILE)
FileWrite($SZFILE, $SZTEXT)

I just found out that I missed a bunch of files that need to have some changes made...

File: \ThunderbirdPortable\Data\profile\panacea.dat
Change: C:\\Users\\USERNAME\\Downloads\\DEFAULT FOLDER\\
File: \ThunderbirdPortable\Data\profile\search.json
Change: C:\\Users\\USERNAME\\Downloads\\DEFAULT FOLDER\\
File: \ThunderbirdPortable\Data\profile\secmod.db
Change: C:\\Users\\USERNAME\\DOWNLO~1\\
File: \ThunderbirdPortable\Data\profile\startupCache\startupCache.4.little
Change: C:/Users/USERNAME/Downloads/DEFAULT%20FOLDERl/
File: \ThunderbirdPortable\Data\profile\pluginreg.dat
Change: C:\Users\Anon\AppData\Roaming\ 
It needs to be updated to the new AppData folder
Basically I installed thunderbird to the current folder:

C:UsersUSERNAMEDownloadsDEFAULT FOLDER

It needs to be changed the scriptdir's folder with the appropriate formatting (startupcache.4.little for example has %20 for the space and some locations have a single slash, some have two, some three and some four...

Any ideas how I am supposed to fix the changes above?

Edited by Hyflex
Link to comment
Share on other sites

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...