Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Echo off & CD "%~dp0"
- TITLE %~n0 & Setlocal
- %= Remark. Script for use on Windows 10 OS =%
- %= Script for validation and stroing Urls, with a loop to cycle through an array containing the Saved Urls =%
- %= Any time you can save a New url, you can type Load to selectively Cycle through the Array =%
- (Set LF=^
- %= NewLine variable to split set /p input line =%)
- %= create blank batch file to store and Selectively retieve variables with =%
- If not Exist "inputURLlog.log" (Break>inputURLlog.log & Goto :main)
- For %%A in ( "[36m[[34mN[36m]ew" , "[[34mL[36m]oad[0m")Do Echo.%%~A
- Choice /N /C nl >nul
- If errorlevel 2 (Goto :load)
- Goto :Main
- :Input <VarName>
- Set "variable=%~1"
- Setlocal EnableDelayedExpansion
- :Validate
- %= allow safe input of variable, test input, store for reuse. =%
- Echo([35m
- Set /P "input=!variable!!LF![36m{> [33m"
- IF "!input!"=="" (
- Echo([31m!variable! required.
- Goto :Validate
- )
- If "!input!"=="" (Echo([31m!variable! required. & Goto :Validate)
- IF /I "!input!"=="load" (Goto :load)
- %= Url Validation - Optional =%
- (ping !input!)>nul || (Echo Invalid url & Endlocal & Goto :main)
- ECHO(!input!>>inputURLlog.log
- Endlocal
- Exit /B
- :main
- Call :Input Url
- Goto :main
- :load
- Setlocal EnableDelayedExpansion
- Set lines=0
- For /f "Tokens=* Delims=" %%A in (inputURLlog.log) do (
- Set /A lines+=1
- Set "line[!lines!]=%%A"
- )
- Set "#=!lines!"
- Echo %#%
- :extract
- For %%A in (!#!) do (
- Cls
- Echo(Url: !line[%%A]!
- For %%B in ("[36m[[34mS[36m]elect" , "[[34mN[36m]ext" "[[34mL[36m]ast[0m")Do Echo.%%~B
- Choice /N /C LNS /M ""
- If "!errorlevel!"=="3" (Set "Url=!line[%%A]!" & Goto :Selected)
- If "!errorlevel!"=="2" (IF not !#! GEQ !lines! (Set /A #+=1))
- If "!errorlevel!"=="1" (IF not !#! LEQ 1 (Set /A #-=1))
- )
- Goto :extract
- %= Demonstrate that variable has been reloaded =%
- :Selected
- Echo( Selected Url = !Url!
- Pause >nul
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement