Skip to content

Commit 38c57b0

Browse files
authored
Updated source to v1.4.4
Check changelog.
1 parent fcf4481 commit 38c57b0

1 file changed

Lines changed: 48 additions & 43 deletions

File tree

source-latest.bat

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@Echo Off
2-
set version=RandomFilePicker - v1.4.3
2+
set version=RandomFilePicker - v1.4.4
33
Title %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 '.'
5657
set file_all=.
5758
set file_media=%file_image% %file_video% %file_music%
5859
Color %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+
7175
Echo %manual_mode% | findstr "1" >nul && (CLS)
7276
Color %color_code%
7377
Echo.
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.
7579
Set count=0
7680
Set timeout=0
7781
For /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
8185
Color %color_code%
8286
CLS
8387
Echo.
88+
Echo Pool Total: %count%
89+
Echo.
8490
Echo (Step 2/3) - Randomizer searching... Please wait a moment.
8591
Echo %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
87101
Set /a timeout+=1
88102
Set /a randN=%random% %% %count% +1
89-
Set listN=0
90103
For /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)
94105
Echo %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
114128
CLS
115129
Start "" "%filename%"
116130
Echo (Step 3/3) - File selected and presented.
@@ -122,22 +136,25 @@ Echo Location: %filename%
122136
Echo.
123137

124138
::Choices
139+
Echo.
140+
Echo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
141+
Echo.
125142
Echo How do you want to continue? Deletion is FINAL and PERMANENT.
126143
Echo.
127144
Echo OPTIONS:
128145
Echo.
129-
Echo %bind_randomizer% = Reroll for new file.
146+
Echo ENTER KEY = Reroll for new file.
130147
Echo %bind_delete% = Permanently delete.
131148
Echo %bind_reload% = Update directory if you added new files.
132-
Echo %bind_review% = Open file again.
149+
Echo %bind_open% = Open file again.
133150
Echo.
134151
Set timeout=0
135152
Set choice=
136153
Set /p choice= Choice:
137154
Echo %bind_randomizer% | find /i "%choice%" >nul && goto Randomizer
138155
Echo %bind_delete% | find /i "%choice%" >nul && goto Deletion
139156
Echo %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
141158
goto Randomizer
142159

143160
:Deletion
@@ -173,6 +190,8 @@ Set search_mode=%choice%
173190
Goto Start
174191

175192

193+
194+
176195
::#### Error Codes ####
177196

178197
:Error-IncorrectNum
@@ -181,7 +200,8 @@ Color C
181200
Echo ### ERROR ###
182201
Echo Code: 400
183202
Echo.
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%
185205
Echo.
186206
Echo Program will close upon continuing
187207
Pause
@@ -199,18 +219,3 @@ Echo.
199219
Echo Program will close upon continuing
200220
Pause
201221
exit
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

Comments
 (0)