Przeglądaj źródła

updates to prefsCleaner + updater.bat

Daily round of tweaks
earthlng 7 lat temu
rodzic
commit
d7ab2f83e4
2 zmienionych plików z 20 dodań i 19 usunięć
  1. 15 15
      prefsCleaner.bat
  2. 5 4
      updater.bat

+ 15 - 15
prefsCleaner.bat

@@ -3,7 +3,7 @@ TITLE prefs.js cleaner
 
 
 REM ### prefs.js cleaner for Windows
 REM ### prefs.js cleaner for Windows
 REM ## author: @claustromaniac
 REM ## author: @claustromaniac
-REM ## version: 1.0
+REM ## version: 1.1
 
 
 SETLOCAL EnableDelayedExpansion
 SETLOCAL EnableDelayedExpansion
 :begin
 :begin
@@ -12,7 +12,7 @@ ECHO:
 ECHO                 ########################################
 ECHO                 ########################################
 ECHO                 ####  prefs.js cleaner for Windows  ####
 ECHO                 ####  prefs.js cleaner for Windows  ####
 ECHO                 ####    author: @claustromaniac     ####
 ECHO                 ####    author: @claustromaniac     ####
-ECHO                 ####          version: 1.0          ####
+ECHO                 ####          version: 1.1          ####
 ECHO                 ########################################
 ECHO                 ########################################
 ECHO:
 ECHO:
 CALL :message "This script should be run from your Firefox profile directory."
 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."
 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.
 ECHO   This Firefox profile shouldn't be in use during the process.
 CALL :message ""
 CALL :message ""
+TIMEOUT 1 /nobreak >nul
 CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]"
 CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]"
 CLS
 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 :FFcheck
 CALL :message "Backing up prefs.js..."
 CALL :message "Backing up prefs.js..."
 COPY /B /V /Y prefs.js "prefs-backup-!date:/=-!_!time::=.!.js"
 COPY /B /V /Y prefs.js "prefs-backup-!date:/=-!_!time::=.!.js"
-CALL :message "Cleaning prefs.js...
+CALL :message "Cleaning prefs.js..."
 CALL :cleanup
 CALL :cleanup
 CLS
 CLS
-CALL :message "All done."
+CALL :message "All done^!"
 TIMEOUT 5 >nul
 TIMEOUT 5 >nul
 EXIT /B
 EXIT /B
 
 
@@ -43,9 +44,11 @@ TIMEOUT %~2 >nul
 EXIT
 EXIT
 REM ########## Message Function #########
 REM ########## Message Function #########
 :message
 :message
+SETLOCAL DisableDelayedExpansion
 ECHO:
 ECHO:
 ECHO:  %~1
 ECHO:  %~1
 ECHO:
 ECHO:
+ENDLOCAL
 GOTO :EOF
 GOTO :EOF
 REM ####### Firefox Check Function ######
 REM ####### Firefox Check Function ######
 :FFcheck
 :FFcheck
@@ -54,9 +57,7 @@ IF NOT ERRORLEVEL 1 (
 	CLS
 	CLS
 	CALL :message "Firefox is still running."
 	CALL :message "Firefox is still running."
 	ECHO   If you're not currently using this profile you can continue, otherwise
 	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:
 	ECHO:
 	PAUSE
 	PAUSE
 	CLS
 	CLS
@@ -68,12 +69,11 @@ REM ######### Cleanup Function ##########
 :cleanup
 :cleanup
 SETLOCAL DisableDelayedExpansion
 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"
 		SET "_line=%%H"
 		SETLOCAL EnableDelayedExpansion
 		SETLOCAL EnableDelayedExpansion
-		SET "_pref=!_line: =!"
-		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:"=""!
 			SET _pref=!_pref:"=""!
 			FIND /I "!_pref!" user.js >nul
 			FIND /I "!_pref!" user.js >nul
 			IF ERRORLEVEL 1 (
 			IF ERRORLEVEL 1 (

+ 5 - 4
updater.bat

@@ -3,7 +3,7 @@ TITLE ghacks user.js updater
 
 
 REM ## ghacks-user.js updater for Windows
 REM ## ghacks-user.js updater for Windows
 REM ## author: @claustromaniac
 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
 REM ## instructions: https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.3-Updater-Scripts
 
 
 SET _myname=%~n0
 SET _myname=%~n0
@@ -76,7 +76,7 @@ ECHO:
 ECHO:                ########################################
 ECHO:                ########################################
 ECHO:                ####  user.js Updater for Windows   ####
 ECHO:                ####  user.js Updater for Windows   ####
 ECHO:                ####       by claustromaniac        ####
 ECHO:                ####       by claustromaniac        ####
-ECHO:                ####             v4.1               ####
+ECHO:                ####             v4.2               ####
 ECHO:                ########################################
 ECHO:                ########################################
 ECHO:
 ECHO:
 SET /A "_line=0"
 SET /A "_line=0"
@@ -119,6 +119,7 @@ IF DEFINED _log (
 	IF DEFINED _logp (START user.js-update-log.txt)
 	IF DEFINED _logp (START user.js-update-log.txt)
 	EXIT /B
 	EXIT /B
 	:log
 	:log
+	SET _log=2
 	ECHO:##################################################################
 	ECHO:##################################################################
 	CALL :message "%date%, %time%"
 	CALL :message "%date%, %time%"
 )
 )
@@ -190,9 +191,9 @@ EXIT /B
 REM ########### Message Function ###########
 REM ########### Message Function ###########
 :message
 :message
 SETLOCAL DisableDelayedExpansion
 SETLOCAL DisableDelayedExpansion
-IF NOT DEFINED _log (ECHO:)
+IF NOT "2"=="%_log%" (ECHO:)
 ECHO:  %~1
 ECHO:  %~1
-IF NOT DEFINED _log (ECHO:)
+IF NOT "2"=="%_log%" (ECHO:)
 ENDLOCAL
 ENDLOCAL
 GOTO :EOF
 GOTO :EOF
 REM ############ Merge function ############
 REM ############ Merge function ############