11@ Echo Off
2- set version = RandomFilePicker - v1.4.3
2+ set version = RandomFilePicker - v1.4.4
33Title %version%
44
55
@@ -8,28 +8,27 @@ Title %version%
88 :: CAN MANUALLY SET DIRECTORY HERE- Comment the other and vice versa
99
1010 :: Option 1 - Viewing away from directory.
11- :: Set directory="C:\Users\Echox\OneDrive\Pictures\All_Wallpapers"
11+ :: Set directory="C:\Users\Echox\OneDrive\Pictures\All_Wallpapers"
1212
1313 :: Option 2 - Viewing within same folder/subfolders.
14- mkdir " %~dp0 " > NUL 2 >& 1
14+ mkdir " %~dp0 " > NUL 2 >& 1
1515
1616 :: KEY BINDS - The script can recognize if you type part of a word so caution with mistyping.
17- set bind_delete = d del delete
18- set bind_review = v review
19- set bind_reload = r reload
20- set bind_randomizer =
17+ set bind_delete = d del delete
18+ set bind_open = v review
19+ set bind_reload = r reload
2120
2221 :: Toggles question on what Search Mode you want set. Default = 0-disabled, 1-enabled.
23- set manual_mode = 0
22+ set manual_mode = 0
2423
2524 :: SET YOUR PREFERRED COLOR - List is on the documentation file on home page.
26- set color_code = 3
25+ set color_code = 3
2726
2827 :: Determines how many times you want the Randomizer to shuffle. Default = 250
29- Set timeout_max = 250
28+ Set timeout_max = 250
3029
3130 :: SET YOUR SEARCH CRITERIA
32- set search_mode = 1
31+ set search_mode = 2
3332 :: 1 = Images
3433 :: 2 = Videos
3534 :: 3 = Music
@@ -38,21 +37,23 @@ Title %version%
3837
3938 :: FILTER - Add any file extensions you may find useful.
4039 :: Image file types
41- set file_image = .png .jpg .jpeg .webp .gif .bmp .tiff
40+ set file_image = .png .jpg .jpeg .webp .gif .bmp .tiff
4241 :: Video file types
43- set file_video = .mp4 .mkv .mov .webm .avi .wmv .mpeg
42+ set file_video = .mp4 .mkv .mov .webm .avi .wmv .mpeg
4443 :: Music file types
45- set file_music = .mp3 .m4a .wav .wma .flac .aac .ogg
46- :: Allowed file types or keywords. CASE SENSITIVE
47- set allowed_filter =
44+ set file_music = .mp3 .m4a .wav .wma .flac .aac .ogg
45+ :: Allowed file types or keywords.
46+ set allowed_filter =
4847 :: Blocked file types or keywords.
49- set blocked_filter = .exe
48+ set blocked_filter = .exe
5049
5150:: #### END OF CONFIG ####
5251
5352
5453
5554:: #### START OF SCRIPT ####
55+
56+ :: file_all prevents folders from being opened as a result. Directory is forced to contain a '.'
5657set file_all = .
5758set file_media = %file_image% %file_video% %file_music%
5859Color %color_code%
@@ -68,10 +69,13 @@ Echo %manual_mode% | findstr "1" >nul && (goto ManualQuestion) || (goto Start)
6869
6970:: Step 1
7071:Start
72+ if %search_mode% LSS 1 (goto Error-IncorrectNum)
73+ if %search_mode% GTR 5 (goto Error-IncorrectNum)
74+
7175Echo %manual_mode% | findstr " 1" > nul && (CLS)
7276Color %color_code%
7377Echo .
74- Echo (Step 1/3) - Directory set, checking ... Please wait a moment.
78+ Echo (Step 1/3) - Directory set, creating index ... Please wait a moment.
7579Set count = 0
7680Set timeout = 0
7781For /f %%f in ('dir " %directory% " /b /s') do set /a count += 1
@@ -81,16 +85,23 @@ For /f %%f in ('dir "%directory%" /b /s') do set /a count+=1
8185Color %color_code%
8286CLS
8387Echo .
88+ Echo Pool Total: %count%
89+ Echo .
8490Echo (Step 2/3) - Randomizer searching... Please wait a moment.
8591Echo %timeout% | findstr %timeout_max% > nul && (goto Error-TimedOut) || (Echo Attempt %timeout% /%timeout_max% till Timeout...)
92+ Echo .
93+ Echo %search_mode% | findstr " 1" > nul && (Echo File Type: Images & set opp_filter = %file_video% %file_music% )
94+ Echo %search_mode% | findstr " 2" > nul && (Echo File Type: Videos & set opp_filter = %file_image% %file_music% )
95+ Echo %search_mode% | findstr " 3" > nul && (Echo File Type: Music & set opp_filter = %file_image% %file_video% )
96+ Echo %search_mode% | findstr " 4" > nul && (Echo File Type: Images, Videos, Music)
97+ Echo %search_mode% | findstr " 5" > nul && (Echo File Type: Any, literally anything.)
98+ Echo Allowed Words: %allowed_filter%
99+ Echo Blocked Words: %blocked_filter%
86100:: timeout 1 >nul
87101Set /a timeout += 1
88102Set /a randN = %random% %% %count% + 1
89- Set listN = 0
90103For /f " tokens=1* delims=:" %%I in ('dir " %directory% " /b /s^ | findstr /n /r . ^ | findstr /b " %randN% " ') do set filename = %%J
91104
92- if %search_mode% LSS 1 (goto Error-IncorrectNum)
93- if %search_mode% GTR 5 (goto Error-IncorrectNum)
94105Echo %search_mode% | findstr " %search_mode% " > nul && (goto Search_Mode%search_mode% ) || (goto Error-IncorrectNum)
95106
96107:Search_Mode1
@@ -107,10 +118,13 @@ goto Review
107118
108119:: Step 3
109120:Review
110- Echo %filename% | findstr /v " %allowed_filter% " > nul && (goto Randomizer)
111- Echo %filename% | find /v " %file_all% " > nul && (goto Randomizer)
112- Echo %filename% | findstr /i " %blocked_filter% " > nul && (goto Error-InvalidFile)
121+ Echo %filename% | findstr /i " %blocked_filter% " > nul && (goto Randomizer)
122+ Echo %filename% | findstr /i " %opp_filter% " > nul && (goto Randomizer)
123+ Echo %filename% | findstr /i " %allowed_filter% " > nul && (goto Present) || (goto Randomizer)
124+ Echo %filename% | find /v " %file_all% " > nul && (goto Present) || (goto Randomizer)
113125:: For /f %%A in ("%filename%") do set filesize=%%~zA
126+
127+ :Present
114128CLS
115129Start " " " %filename% "
116130Echo (Step 3/3) - File selected and presented.
@@ -122,22 +136,25 @@ Echo Location: %filename%
122136Echo .
123137
124138:: Choices
139+ Echo .
140+ Echo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
141+ Echo .
125142Echo How do you want to continue? Deletion is FINAL and PERMANENT.
126143Echo .
127144Echo OPTIONS:
128145Echo .
129- Echo %bind_randomizer% = Reroll for new file.
146+ Echo ENTER KEY = Reroll for new file.
130147Echo %bind_delete% = Permanently delete.
131148Echo %bind_reload% = Update directory if you added new files.
132- Echo %bind_review % = Open file again.
149+ Echo %bind_open % = Open file again.
133150Echo .
134151Set timeout = 0
135152Set choice =
136153Set /p choice = Choice:
137154Echo %bind_randomizer% | find /i " %choice% " > nul && goto Randomizer
138155Echo %bind_delete% | find /i " %choice% " > nul && goto Deletion
139156Echo %bind_reload% | find /i " %choice% " > nul && goto Start
140- Echo %bind_review % | find /i " %choice% " > nul && goto Review
157+ Echo %bind_open % | find /i " %choice% " > nul && goto Open
141158goto Randomizer
142159
143160:Deletion
@@ -173,6 +190,8 @@ Set search_mode=%choice%
173190Goto Start
174191
175192
193+
194+
176195:: #### Error Codes ####
177196
178197:Error-IncorrectNum
@@ -181,7 +200,8 @@ Color C
181200Echo ### ERROR ###
182201Echo Code: 400
183202Echo .
184- Echo Search Criteria is not Mode 1-5. CHECK CONFIG.
203+ Echo Search Mode is not Mode 1-5. CHECK CONFIG.
204+ Echo Current: %search_mode%
185205Echo .
186206Echo Program will close upon continuing
187207Pause
@@ -199,18 +219,3 @@ Echo.
199219Echo Program will close upon continuing
200220Pause
201221exit
202-
203- :Error-InvalidFile
204- CLS
205- Color C
206- Echo ### ERROR ###
207- Echo Code: 403
208- Echo .
209- Echo Location: %filename%
210- Echo .
211- Echo File is an invalid type.
212- Echo Check config for invalid file types.
213- Echo .
214- Echo Program will close upon continuing
215- Pause
216- exit
0 commit comments