Umlaute DosInAnIcon

Antworten
zylex
Beiträge: 75
Registriert: 23 Jan 2013, 08:55

Umlaute DosInAnIcon

Beitrag von zylex »

Hallo Forum.

Der Titel sagt nur einen Teil aus, evtl. lässt sich das Problem auch ganz anders lösen?

Mein Vorhaben ist es alle Add-ons aus den Firefox-Profilen zu löschen. Im Grunde funktioniert meine Lösung auch, aber nicht wenn User Umlaute im Namen haben. Der Grundgedanke ist folgender:

- Zuerst lese ich die User aus,
- bastle daraus den Pfad zum Firefox Profilordner für jeden User,
- liste dort jeweils alle Profile auf,
- erweitere die Pfade (wenn vorhanden) bis zum "extensions" Ordner der einzelnen Profile und lösche darin alle .xpi Dateien.

Das Script sieht folgendermaßen aus und funktioniert auch:

Code: Alles auswählen

; delete extentions in all userprofiles

DefVar $tmpdir$
DefVar $subvar$
DefVar $userlist$
DefVar $profilelist$

DefStringList $list0$
DefStringList $list1$
DefStringList $list2$
DefStringList $list3$

set $tmpdir$ = "%SystemDrive%\tmp"
set $userlist$ = "ff_userlist.txt"
set $profilelist$ = "ff_profilelist.txt"

set $list0$ = getProfilesDirList
for $x$ in $list0$ do DOSInAnIcon_userdir

set $list1$ =  loadTextFile ("%SystemDrive%\tmp\ff_userlist.txt")
for $y$ in $list1$ do sub_extentions_path

set $list3$ =  loadTextFile ("%SystemDrive%\tmp\ff_profilelist.txt")
for $w$ in $list3$ do files_delete_xpi

files_delete_tmp

[DOSInAnIcon_userdir]
@echo off
echo $x$\AppData\Roaming\Mozilla\Firefox\Profiles>> $tmpdir$\$userlist$

[sub_extentions_path]
Set $subvar$ = "$y$"
if FileExists($subvar$)
Set $list2$ = getOutStreamFromSection ("DOSInAnIcon_def_profile")
for $z$ in $list2$ do DOSInAnIcon_extentions_path
endif

[DOSInAnIcon_def_profile]
@echo off
dir "$subvar$" /b

[DOSInAnIcon_extentions_path]
@echo off
echo $subvar$\$z$\extensions>> $tmpdir$\$profilelist$

[files_delete_xpi]
delete $w$\*.xpi

[files_delete_tmp]
delete $tmpdir$\$userlist$
delete $tmpdir$\$profilelist$
Das Problem sind nun Umlaute in den Usernamen. Heißt ein User zb "Jörg Müller" liefert die Funktion "getOutStreamFromSection ("DOSInAnIcon_def_profile")" die Fehlermeldung "Das System kann den angegebenen Pfad nicht finden", da der Umlaut in der CMD falsch ausgegeben wird.

Habe schon alles Mögliche versucht (Codepages, selbst eine .bat zu erstellen, encodings im Script usw). Leider hat nichts funktioniert. Ich muss aber irgendwie an eine Liste der Firefox Profilordner innerhalb der verschiedenen Userverzeichnisse kommen um dort die .xpi Dateien löschen zu können.

Für jeglichen Input bin ich dankbar :-)
panisch
Beiträge: 47
Registriert: 02 Okt 2014, 15:22

Re: Umlaute DosInAnIcon

Beitrag von panisch »

Guten Morgen

Wieso nicht

Code: Alles auswählen

Files_Delete_Extensions /allNtUserProfiles

[Files_Delete_Extensions]
del %UserProfileDir%\AppData\Roaming\Mozilla\Firefox\Profiles\extensions\*.xpi -f

?

Dürfte zum selben Ergebnis führen, du sparst dir das ganze rumkopiere mit Temp-Dateien und hast das alles schön in einem Befehl..
Getestet habe ich es nicht, das müsstest du noch selbst machen. :D
zylex
Beiträge: 75
Registriert: 23 Jan 2013, 08:55

Re: Umlaute DosInAnIcon

Beitrag von zylex »

Morgen :-)

Das geht leider nicht, da innerhalb des Profipfades die einzelnen Profile liegen, die Firefox zufällig im Schema "xxxxx.default" benennt.

Die Pfade heißen also pro User immer anders:
"%UserProfileDir%\AppData\Roaming\Mozilla\Firefox\Profiles\xxxxx.default\extensions\"

Wildcards *.default funktionieren in diesem Fall leider auch nicht.
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: Umlaute DosInAnIcon

Beitrag von SisterOfMercy »

You need one more step. Try if this works with umlaute.. It's a part of my mozilla-firefox script, which also installs cacert.org certificates in the profiles of existing users. Just modify it so sub_install_cert_existing_profiles calls on a files section which uses the path obtained in the sub.

Code: Alles auswählen

Set $InstallDir32$      = "%ProgramFiles32Dir%\Mozilla Firefox"
Set $InstallDirNSS32$    = "%ProgramFiles32Dir%\Mozilla NSS"
set $profileslist$ = getProfilesDirList

for $value$ in $profileslist$ do sub_install_cert_existing_profiles

[DosInAnIcon_createdb_existing_profiles]
"$InstallDirNSS32$\certutil.exe" -N -f "%ScriptPath%\files\bookmarks.html" -d "$prefs_path$"

[DosInAnIcon_certutil_existing_profiles]
"$InstallDirNSS32$\certutil.exe" -A -f "%ScriptPath%\files\bookmarks.html" -n "CAcert.org - Class 1 PKI Key" -t "C,C,C" -i "%ScriptPath%\files\cacert.org-root.der" -d "$prefs_path$"
"$InstallDirNSS32$\certutil.exe" -A -f "%ScriptPath%\files\bookmarks.html" -n "CAcert.org - Class 3 PKI Key" -t "C,C,C" -i "%ScriptPath%\files\cacert.org-class3.der" -d "$prefs_path$"

[Files_install_32]
copy "%ScriptPath%\files\bookmarks.html" "$InstallDir32$\browser\defaults\profile"
copy "%ScriptPath%\files\localstore.rdf" "$InstallDir32$\browser\defaults\profile"
copy "%ScriptPath%\files\custom.js" "$InstallDir32$\defaults\pref"
copy "%ScriptPath%\files\override.ini" "$InstallDir32$\browser"

; Make sure directory exists, so certutil will run correctly.
CheckTargetPath = "$InstallDir32$\browser\defaults\profile"

[sub_install_cert_existing_profiles]
Set $profiles_ini$ = "$value$" + "\Application Data\Mozilla\Firefox\profiles.ini"
if FileExists($profiles_ini$)
	Set $prefs_path$ = GetValueFromInifile($profiles_ini$,"Profile0","Path","")
	Set $prefs_IsRelative$ = GetValueFromInifile($profiles_ini$,"Profile0","IsRelative","")
	if ($prefs_IsRelative$ = "1")
		comment "Path to profile is relative"
		Set $prefs_path$ = "$value$" + "\Application Data\Mozilla\Firefox\" + $prefs_path$
	else
		comment "Path to profile is absolute"
	endif
	
	if ((NOT (FileExists($prefs_path$+"\key3.db"))) OR (NOT (FileExists($prefs_path$+"\cert8.db")))) OR (NOT (FileExists($prefs_path$+"\secmod.db")))
		DosInAnIcon_createdb_existing_profiles
	endif
	DosInAnIcon_certutil_existing_profiles
endif
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
zylex
Beiträge: 75
Registriert: 23 Jan 2013, 08:55

Re: Umlaute DosInAnIcon

Beitrag von zylex »

You're the man! :-)

Macht mein ganzes kompliziertes Script mit Tempfiles und DOS abfragen überflüssig, die profiles.ini hab ich voll übersehen. Danke!
Antworten