Here is what my code looks like. I have shortened it to the first 4 people to make it easier to read. If there is anything else I can provide to make it easier to understand, please let me know.
I would appreciate the help, thank you!
Code: Select all
;Excel Data Initial data grab starts here (Only grabs the client names that will be displayed in the GUI checklist)
WinActivate, ProgramBillingWorkbook.xlsm - Excel
Xl := ComObjActive("Excel.Application") ;creates a handle to your currently active excel sheet
P2 := Xl.Range("E2").Value
P3 := Xl.Range("E3").Value
P4 := Xl.Range("E4").Value
P5 := Xl.Range("E5").Value
Gui, Add, Checkbox, vClient2 gSubmitGUI, %P2% ;P2 - P5 is a name grabbed from an Excel list using COM. There is no P1 as Excel uses row 1 for labels.
Gui, Add, Checkbox, vClient3 gSubmitGUI, %P3%
Gui, Add, Checkbox, vClient4 gSubmitGUI, %P4%
Gui, Add, Checkbox, vClient5 gSubmitGUI, %P5%
Startbilling: ;Runs through the client# variables and checks if they were checked and then bills for them if they were. Otherwise moves on to the next one. NEED TO REDO because code is inneficient.
if(Client2 = 1) ;Checks to see if first person on list was checked or not (1 = Checked, 0 = Unchecked)
{
Client2 = 0 ;Sets checkmark to 0, (unchecked) and then proceeds to billing.
Num = 2 ;Sets Variable equal to Client # that is Checked for GrabData sub.
Gosub, GrabData
}
if(Client3 = 1)
{
Client3 = 0
Num = 3
Gosub, GrabData
}
if(Client4 = 1)
{
Client4 = 0
Num = 4
Gosub, GrabData
}
if(Client5 = 1)
{
Client2 = 0
Num = 5
Gosub, GrabData
}
;Code repeats in the same matter until Client20
else ;If Client2 - Client20 are all equal to 0, then do this.
{
msgbox, that's all of them. Click OK to exit script.
ExitApp
}
GrabData: ;Grabs data from Excel sheet and saves them as variables based on the number stored in variable NUM ;{
WinActivate, ProgramBillingWorkbook.xlsm - Excel
Xl := ComObjActive("Excel.Application") ;creates a handle to your currently active excel sheet
CliendID := Xl.Range("D" Num).Value ;Grabs ClientID
AuthNumber := Xl.Range("A" Num).Value
ServCode := Xl.Range("G" Num).Value
;etc. etc. Code grabs a bunch of lines, all in the same fashion as the above examples.
SeleniumAutomation: ;Inputs data into Chromium and then clicks the submit button. Removed the code as it's not really necessary for the example.
gosub, StartBilling ;Loops back to StartBilling sub after Selenium automation is complete.