|I think I'm beginning to be addicted to this place...|
I have a program that is constantly on.
Program below is to ask user for login and check if it exists. If it does, it will ask for a work id and check if it exists. If neither case matches, the program will print an error.
Lines in u009_users.txt go "code1 Name Here" and so on.
Lines in kp_tyot.txt go "work1 work 1 explained" and so on.
now the prompt for ID should ONLY accept what is the first string of each line in u009_users.txt but no. It also accepts just pressing enter, it always accepts user replies consisting of one character and it appears to do a complete search in u009_users.txt because it will accept any
given name found. Also if one succesful login and work log is made and after that for example "k" is given, it will result that last accepted login is %ID% which is not acceptable.
I tried to use solution given to someone by IVO earlier but an error or halt always came up at some point. If not earlier, they started coming when one log was succesfully made and another, erroneous log was made.
Here is the old thread:
set /P ID=Log in:
type u009_users.txt | find "%ID% ">NUL
if errorlevel 1 goto NoUser
call :UserID %ID%
echo Logged in: %Name%
set /P WORK=Work ID:
type kp_tyot.txt | find "%WORK%">NUL
if errorlevel 1 goto NoWork
echo log %ID% %WORK% %COMPUTERNAME% %DATE% %TIME% >> %ID%.log
call :workID %WORK%
echo Logged: %WORK%
for /f "tokens=1*" %%B in (u009_users.txt) do (
if [%1]==[%%B] (set Name=%%C & exit/b)
for /f "tokens=1*" %%B in (kp_tyot.txt) do (
if [%1]==[%%B] (set workText=%%C & exit/b)
@echo user ID not found.
@echo work ID not found.
Thank you for co-operation!