Hello Knob,
Thank you for your assistance so far. I started on that same path, so it looks like we were thinking about the same approach. If you don't mind, I kind of need to switch gears a bit as I can't seem to get termreads working properly. When the user logs in, the program will need to read in the time/date variables to actually do the equation. However, I am definitely doing something wrong. The program does a Ctrl+T to the system to get the variables. An example is shown below:
Logon: November 17, 2006, 16:30:58
I accomplish this activity on line 42.
Here's what I came up with so far today. I'm still a rookie with aspect, so please forgive me for any newb errors.
;***global vars***
integer check_msg
;***************************************************************
;* *
;* PROCEDURE Main *
;* *
;***************************************************************
proc main
call BackdoorLogin
endproc
;***************************************************************
;* *
;* PROCEDURE BackdoorLogin *
;* *
;***************************************************************
proc BackdoorLogin
integer uiMonth;
integer uiDay;
integer uiYear;
integer uiHour;
float TelPassword;
integer done = 0;
string sMonth;
string sDate;
string sYear;
string sHour;
string InputStr;
string TempStr;
string UserNameStr;
string PasswordStr;
string MonthNo;
string logonmsg;
float Temp;
while done == 0
transmit "^T^M"
pause 1
locate $Row-1 0
termreads logonmsg
strsearch logonmsg "Logon" check_msg ;Check to see that the friggin user needs to login.
if check_msg == 1
strtok TempStr InputStr " " 1 ; Logon: Ignore
strtok sMonth InputStr " " 1 ; Month
MonthNo = GetMonthInt(sMonth) ; Convert month to string No.
strtok sDate InputStr ", " 1 ; Date
strtok TempStr InputStr " " 1 ; ',' Ignor
strtok sYear InputStr " " 1 ; Year
strtok TempStr InputStr " " 1 ; ',' Ignor
strtok sHour InputStr " :" 1 ; Hour
strtonum sMonth uiMonth
strtonum sYear uiYear
strtonum sDate uiDay
strtonum sHour uiHour
Temp = ( uiYear / 7.0 ) / (uiMonth + uiDay + uiHour);
TelPassword = ( Temp * 10000.0 );
strfmt UserNameStr "BlahBlahBlah^M"
strfmt PassWordStr "%s^M" TelPassWord
transmit UserNameStr
waitfor "Password: " 4
transmit PassWordStr
waitfor "Main Menu" 1
if strfind TempStr ">"
statmsg "Login Successful"
done = 1
elseif strfind TempStr "R>"
statmsg "Login Successful"
done = 1
else
statmsg "Login Failed, please retry"
endif
pause 1
statmsg ""
else
termmsg "`r`nYou are already logged in. There's no point in running this script!`r`n"
done = 1
endif
endwhile
endproc
;***************************************************************
;* *
;* FUNCTION GetMonthInt *
;* *
;***************************************************************
func GetMonthInt:string
param string MonthInput
string MonthString = "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,"
string TempStr
integer j
j = 0
while j < 13
j++
strtok TempStr MonthString "," 1
if strnicmp TempStr MonthInput 3
itoa j TempStr
return TempStr ; Return the No. of month in string
endif
endwhile
return 0
endfunc