Sub UCC_INSURANCE_DATA_LOOP()
Dim hostSettleTimeout As Integer
Dim hostSettleTime As Integer
Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim returnValue As Integer
Dim hiddenTextEntry As String
hostSettleTimeout = 5000
hostSettleTime = 300
Set osCurrentTerminal = ThisFrame.SelectedView.control
Set osCurrentScreen = osCurrentTerminal.Screen
Dim myUser As String
myUser = Environ("username")
'S:\FinAdj\Master_Files\INFORMATION\MyInformation.csv
MyFile = "S:\FinAdj\Master_Files\INFORMATION\MyInformation.csv"
Open MyFile For Input As #1 ' Open file for input.
Do While Not EOF(1) ' Loop until end of file.
Input #1, Last, First, CompleteName, EVar, phone, CodeVar, initials ' Read into variables.
If CompleteName = myUser Then
PersonalNumber = CodeVar
End If
Loop
Close #1
' ********************************
MyFile = "S:\KEA\UCC\INS_FILE.csv"
Open MyFile For Input As #1 ' Open file for input.
Dim ContractVar As String
Dim ExpDateVar As String
Input #1, ContractVar, ExpDateVar ' Read into variables.
If ContractVar Like "*contract_id*" Then
Close #1 ' Close file.
GoTo DeleteFirstLine
Else
Close #1 ' Close file.
GoTo ContinueProcess
End If
'Close #1 ' Close file.
DeleteFirstLine:
Dim iFile As Integer
Dim sData As String
iFile = FreeFile
Open "S:\KEA\UCC\INS_FILE.csv" For Binary Access Read As iFile
sData = Space(LOF(iFile))
Get #iFile, , sData
Close iFile
sData = Mid(sData, InStr(sData, vbCrLf) + 2)
Kill "S:\KEA\UCC\INS_FILE.csv"
iFile = FreeFile
Open "S:\KEA\UCC\INS_FILE.csv" For Binary Access Write As iFile
Put #iFile, , sData
Close iFile
ContinueProcess:
Open MyFile For Input As #1 ' Open file for input.
Do While Not EOF(1) ' Loop until end of file.
Comments = "BLANK EXPIRATION DATE. INSURENCE UPLOAD"
Input #1, ContractVar, ExpDateVar ' Read into variables.
'Format Contract
Lessor = Mid(ContractVar, 1, 3)
Contract = Mid(ContractVar, 5, 7)
Schedule = Mid(ContractVar, 13, 3)
'Format ExpDateVar
ExpDateVar = Format(ExpDateVar, "mmddyyyy")
ExpDateVarMM = Mid(ExpDateVar, 1, 2)
ExpDateVarDD = Mid(ExpDateVar, 3, 2)
ExpDateVarYY = Mid(ExpDateVar, 7, 2)
ExpDateVarYYYY = Mid(ExpDateVar, 5, 4)
Call MAINT_Contract_Maintenance
Call osCurrentScreen.SendKeys(Lessor) ' Lessor
Call Enter_50
Call osCurrentScreen.SendKeys(Contract) ' Contract Number
Call Wait_50
osCurrentScreen.SendKeys "."
Call Wait_50
Call osCurrentScreen.SendKeys(Schedule) ' Contract Number
Call Wait_50
Call Enter_50
Call Wait_50
ByPass_Message_Box
Call Wait_50
osCurrentScreen.SendKeys "2"
Call Wait_50
Call Enter_50
Call Wait_50
osCurrentScreen.SendKeys "26"
Call Wait_50
Call Enter_50
Call Wait_50
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(300)
Call GrabScreen
'Wait for host to 'be quiet' before continuing
returnValue = osCurrentScreen.WaitForHostSettle(300)
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fs, f, ts, Line1
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile("C:\Users\" & myUser & "\Documents\AHK\Batch_Manipulator\GrabScreenFile.txt")
Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)
Line1 = ts.ReadLine ' First Line on File
Line2 = ts.ReadLine ' Second Line on File
Line3 = ts.ReadLine ' Third Line on File
Line4 = ts.ReadLine ' Fourth Line on File
Line5 = ts.ReadLine ' Fifth Line on File
Line6 = ts.ReadLine ' Sixth Line on File
Line7 = ts.ReadLine ' Seventh Line on File
Line8 = ts.ReadLine ' Eight Line on File
Line9 = ts.ReadLine ' Nineth Line on File
Line10 = ts.ReadLine ' Tenth Line on File
Line11 = ts.ReadLine ' Eleventh Line on File
Line12 = ts.ReadLine ' Twelveth Line on File
Line13 = ts.ReadLine ' Thirteenth Line on File
Line14 = ts.ReadLine ' Fourteenth Line on File
Line15 = ts.ReadLine ' Fifteenth Line on File
Line16 = ts.ReadLine ' Sixteenth Line on File
Line17 = ts.ReadLine ' Seventeenth Line on File
Line18 = ts.ReadLine ' Eighteenth Line on File
Line19 = ts.ReadLine ' Nineteenth Line on File
Line20 = ts.ReadLine ' Twentyth Line on File
Line21 = ts.ReadLine ' Twenty-First Line on File
Line22 = ts.ReadLine ' Twentyth Line on File
Line23 = ts.ReadLine ' Twenty-First Line on File
Line24 = ts.ReadLine ' Twentyth Line on File
ts.Close
If Line1 Like "*INSUR.SCR*" Then
osCurrentScreen.SendKeys "A"
Call Wait_50
Call Enter_50
End If
Call Wait_50
osCurrentScreen.SendKeys "Y"
Call Wait_50
Call Enter_50
osCurrentScreen.SendKeys "NA"
Call Wait_50
Call Enter_50
osCurrentScreen.SendKeys "Y"
Call Wait_50
Call Enter_50
For x = 1 To 4
Call Wait_50
Call Enter_50
Call Wait_50
Next x
Call osCurrentScreen.SendKeys(ExpDateVar) ' 05) Expiration Date
For x = 1 To 2
Call Wait_50
Call Enter_50
Call Wait_50
Next x
osCurrentScreen.SendKeys "NA"
For x = 1 To 6
Call Wait_50
Call Enter_50
Call Wait_50
Next x
osCurrentScreen.SendKeys "001"
Call Wait_50
Call Enter_50
Call Wait_50
osCurrentScreen.SendKeys "00000"
For x = 1 To 5
Call Wait_50
Call Enter_50
Call Wait_50
Next x
osCurrentScreen.SendKeys "03"
For x = 1 To 7
Call Wait_50
Call Enter_50
Call Wait_50
Next x
osCurrentScreen.SendKeys "16"
Call Wait_50
Call Enter_50
Call Wait_50
Call osCurrentScreen.SendKeys(Comments) ' Comments
Call Wait_50
Call Enter_50
For x = 1 To 2
Call Wait_50
Call Enter_50
Call Wait_50
Next x
Call osCurrentScreen.SendKeys(PersonalNumber) ' PersonalNumber
For x = 1 To 10
Call Wait_50
Call Enter_50
Call Wait_50
Next x
Loop
Close #1 ' Close file.
End Sub