From 68a44bcbb42fca7f2d6b00d3783abd2c9ecffeb4 Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Tue, 26 Dec 2017 17:29:11 +0000 Subject: [PATCH 1/6] cosmetic fix for calls to :message before the script begins logging (with -log) --- updater.bat | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/updater.bat b/updater.bat index 1307958..760d17d 100644 --- a/updater.bat +++ b/updater.bat @@ -119,6 +119,7 @@ IF DEFINED _log ( IF DEFINED _logp (START user.js-update-log.txt) EXIT /B :log + SET _log=2 ECHO:################################################################## CALL :message "%date%, %time%" ) @@ -190,9 +191,9 @@ EXIT /B REM ########### Message Function ########### :message SETLOCAL DisableDelayedExpansion -IF NOT DEFINED _log (ECHO:) +IF NOT "2"=="%_log%" (ECHO:) ECHO: %~1 -IF NOT DEFINED _log (ECHO:) +IF NOT "2"=="%_log%" (ECHO:) ENDLOCAL GOTO :EOF REM ############ Merge function ############ From 2ad3fbdbd31fe0d0eec3c610ea7c17042bce96db Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Tue, 26 Dec 2017 19:37:39 +0000 Subject: [PATCH 2/6] Update updater.bat --- updater.bat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/updater.bat b/updater.bat index 760d17d..b9c0c68 100644 --- a/updater.bat +++ b/updater.bat @@ -3,7 +3,7 @@ TITLE ghacks user.js updater REM ## ghacks-user.js updater for Windows REM ## author: @claustromaniac -REM ## version: 4.1 +REM ## version: 4.2 REM ## instructions: https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.3-Updater-Scripts SET _myname=%~n0 @@ -76,7 +76,7 @@ ECHO: ECHO: ######################################## ECHO: #### user.js Updater for Windows #### ECHO: #### by claustromaniac #### -ECHO: #### v4.1 #### +ECHO: #### v4.2 #### ECHO: ######################################## ECHO: SET /A "_line=0" From 74f18db85a0ced38df16fed52d306674065aa45e Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Tue, 26 Dec 2017 20:04:57 +0000 Subject: [PATCH 3/6] 1.1 --- prefsCleaner.bat | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/prefsCleaner.bat b/prefsCleaner.bat index fd40ac4..2bf7e9d 100644 --- a/prefsCleaner.bat +++ b/prefsCleaner.bat @@ -3,7 +3,7 @@ TITLE prefs.js cleaner REM ### prefs.js cleaner for Windows REM ## author: @claustromaniac -REM ## version: 1.0 +REM ## version: 1.1 SETLOCAL EnableDelayedExpansion :begin @@ -12,7 +12,7 @@ ECHO: ECHO ######################################## ECHO #### prefs.js cleaner for Windows #### ECHO #### author: @claustromaniac #### -ECHO #### version: 1.0 #### +ECHO #### version: 1.1 #### ECHO ######################################## ECHO: CALL :message "This script should be run from your Firefox profile directory." @@ -20,19 +20,20 @@ ECHO It will remove any entries from prefs.js that also exist in user.js. CALL :message "This will allow inactive preferences to be reset to their default values." ECHO This Firefox profile shouldn't be in use during the process. CALL :message "" +TIMEOUT 1 /nobreak >nul CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]" CLS -IF ERRORLEVEL 3 ( EXIT /B ) -IF ERRORLEVEL 2 ( GOTO :showhelp ) -IF NOT EXIST "user.js" ( CALL :abort "user.js not found in the current directory." 30 ) -IF NOT EXIST "prefs.js" ( CALL :abort "prefs.js not found in the current directory." 30 ) +IF ERRORLEVEL 3 (EXIT /B) +IF ERRORLEVEL 2 (GOTO :showhelp) +IF NOT EXIST "user.js" (CALL :abort "user.js not found in the current directory." 30) +IF NOT EXIST "prefs.js" (CALL :abort "prefs.js not found in the current directory." 30) CALL :FFcheck CALL :message "Backing up prefs.js..." COPY /B /V /Y prefs.js "prefs-backup-!date:/=-!_!time::=.!.js" CALL :message "Cleaning prefs.js... CALL :cleanup CLS -CALL :message "All done." +CALL :message "All done^!" TIMEOUT 5 >nul EXIT /B @@ -43,9 +44,11 @@ TIMEOUT %~2 >nul EXIT REM ########## Message Function ######### :message +SETLOCAL DisableDelayedExpansion ECHO: ECHO: %~1 ECHO: +ENDLOCAL GOTO :EOF REM ####### Firefox Check Function ###### :FFcheck @@ -54,9 +57,7 @@ IF NOT ERRORLEVEL 1 ( CLS CALL :message "Firefox is still running." ECHO If you're not currently using this profile you can continue, otherwise - ECHO: - ECHO close Firefox first^^! - ECHO: + CALL :message "close Firefox first^!" ECHO: PAUSE CLS @@ -68,12 +69,13 @@ REM ######### Cleanup Function ########## :cleanup SETLOCAL DisableDelayedExpansion ( - FOR /F "tokens=1,* delims=:" %%G IN ( 'FINDSTR /N "^" prefs.js' ) DO ( + FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO ( SET "_line=%%H" SETLOCAL EnableDelayedExpansion SET "_pref=!_line: =!" + SET "_pref=!_line: =!" IF /I "user_pref"=="!_pref:~0,9!" ( - FOR /F "delims=," %%X IN ("!_pref!") DO ( SET "_pref=%%X" ) + FOR /F "delims=," %%X IN ("!_pref!") DO (SET "_pref=%%X") SET _pref=!_pref:"=""! FIND /I "!_pref!" user.js >nul IF ERRORLEVEL 1 ( From a1f10513eadf483f20b85e0a3c34afe2d265f56a Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Tue, 26 Dec 2017 20:06:41 +0000 Subject: [PATCH 4/6] 1.2 --- prefsCleaner.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prefsCleaner.bat b/prefsCleaner.bat index 2bf7e9d..8768f05 100644 --- a/prefsCleaner.bat +++ b/prefsCleaner.bat @@ -3,7 +3,7 @@ TITLE prefs.js cleaner REM ### prefs.js cleaner for Windows REM ## author: @claustromaniac -REM ## version: 1.1 +REM ## version: 1.2 SETLOCAL EnableDelayedExpansion :begin @@ -12,7 +12,7 @@ ECHO: ECHO ######################################## ECHO #### prefs.js cleaner for Windows #### ECHO #### author: @claustromaniac #### -ECHO #### version: 1.1 #### +ECHO #### version: 1.2 #### ECHO ######################################## ECHO: CALL :message "This script should be run from your Firefox profile directory." @@ -30,7 +30,7 @@ IF NOT EXIST "prefs.js" (CALL :abort "prefs.js not found in the current director CALL :FFcheck CALL :message "Backing up prefs.js..." COPY /B /V /Y prefs.js "prefs-backup-!date:/=-!_!time::=.!.js" -CALL :message "Cleaning prefs.js... +CALL :message "Cleaning prefs.js..." CALL :cleanup CLS CALL :message "All done^!" From 7cd2c650cbeaacba42fedd5962fdf6e3b4d86095 Mon Sep 17 00:00:00 2001 From: claustromaniac <20734810+claustromaniac@users.noreply.github.com> Date: Wed, 27 Dec 2017 03:32:58 +0000 Subject: [PATCH 5/6] fix for previous commit Take it or leave it. Up to you, as always. --- prefsCleaner.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prefsCleaner.bat b/prefsCleaner.bat index 8768f05..c424628 100644 --- a/prefsCleaner.bat +++ b/prefsCleaner.bat @@ -73,7 +73,7 @@ SETLOCAL DisableDelayedExpansion SET "_line=%%H" SETLOCAL EnableDelayedExpansion SET "_pref=!_line: =!" - SET "_pref=!_line: =!" + SET "_pref=!_pref: =!" IF /I "user_pref"=="!_pref:~0,9!" ( FOR /F "delims=," %%X IN ("!_pref!") DO (SET "_pref=%%X") SET _pref=!_pref:"=""! From c0f9e6ab2b7bce4751542eedc0e71a0977721f56 Mon Sep 17 00:00:00 2001 From: earthlng Date: Wed, 27 Dec 2017 04:59:24 +0100 Subject: [PATCH 6/6] Update prefsCleaner.bat --- prefsCleaner.bat | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/prefsCleaner.bat b/prefsCleaner.bat index c424628..b478e54 100644 --- a/prefsCleaner.bat +++ b/prefsCleaner.bat @@ -3,7 +3,7 @@ TITLE prefs.js cleaner REM ### prefs.js cleaner for Windows REM ## author: @claustromaniac -REM ## version: 1.2 +REM ## version: 1.1 SETLOCAL EnableDelayedExpansion :begin @@ -12,7 +12,7 @@ ECHO: ECHO ######################################## ECHO #### prefs.js cleaner for Windows #### ECHO #### author: @claustromaniac #### -ECHO #### version: 1.2 #### +ECHO #### version: 1.1 #### ECHO ######################################## ECHO: CALL :message "This script should be run from your Firefox profile directory." @@ -72,10 +72,8 @@ SETLOCAL DisableDelayedExpansion FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO ( SET "_line=%%H" SETLOCAL EnableDelayedExpansion - SET "_pref=!_line: =!" - SET "_pref=!_pref: =!" - IF /I "user_pref"=="!_pref:~0,9!" ( - FOR /F "delims=," %%X IN ("!_pref!") DO (SET "_pref=%%X") + IF /I "user_pref"=="!_line:~0,9!" ( + FOR /F "delims=," %%X IN ("!_line!") DO (SET "_pref=%%X") SET _pref=!_pref:"=""! FIND /I "!_pref!" user.js >nul IF ERRORLEVEL 1 (