Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SetBatchLines, -1
- global filesPath := "D:\Downloads"
- , clients := []
- , clientID := ""
- , clientActive := ""
- , clientNames := ""
- , doctors := []
- , doctorID := ""
- , doctorActive := ""
- , witnesses := []
- , witnessID := ""
- , witnessActive := ""
- loop, read, % filesPath "\clients.csv"
- {
- if (A_Index = 1)
- {
- continue
- }
- loop, parse, A_LoopReadLine, CSV
- {
- if (A_Index = 1)
- {
- doctors[A_LoopField] := []
- , witnesses[A_LoopField] := []
- , last := clients[A_LoopField] := []
- }
- else
- {
- if (A_Index = 2)
- {
- clientNames .= A_LoopField "|"
- }
- last.Push(A_LoopField)
- }
- }
- }
- slave("doctors.csv", doctors)
- slave("witnesses.csv", witnesses)
- ^!c::chooseClient()
- ^1::info(clientActive, 1) ; Client
- ^2::info(clientActive, 2) ; Phone
- ^3::info(clientActive, 3) ; Address
- ^4::info(clientActive, 4) ; Case
- ^+1::info(doctorActive, 1) ; Doctor
- ^+2::info(doctorActive, 2) ; Phone
- ^+3::info(doctorActive, 3) ; Address
- +!1::info(witnessActive, 1) ; Witness
- +!2::info(witnessActive, 2) ; Phone
- +!3::info(witnessActive, 3) ; Address
- ButtonOK:
- Gui, Submit
- clientActive := clients[clientID]
- doctorActive := doctors[clientID][doctorID]
- witnessActive := witnesses[clientID][witnessID]
- GuiEscape:
- Gui, Destroy
- return
- chooseClient()
- {
- Gui, New, -Caption
- Gui, Add, Text,, Client
- Gui, Add, ComboBox, AltSubmit GclientSelected VclientID, % clientNames
- Gui, Add, Text,, Doctor
- Gui, Add, ComboBox, AltSubmit VdoctorID
- Gui, Add, Text,, Witness
- Gui, Add, ComboBox, AltSubmit VwitnessID
- Gui, Add, Button, Default, OK
- Gui, Show
- ; Send, !{Down}
- }
- clientSelected()
- {
- Gui, Submit, NoHide
- doctorNames := ""
- for k,doc in doctors[clientID]
- {
- doctorNames .= "|" doc[1]
- }
- GuiControl,, doctorID, % doctorNames
- witnessNames := ""
- for k,witness in witnesses[clientID]
- {
- witnessNames .= "|" witness[1]
- }
- GuiControl,, witnessID, % witnessNames
- }
- info(from, field)
- {
- if (!clientActive || !doctorActive || !witnessActive)
- {
- return chooseClient()
- }
- SendInput, % from[field]
- }
- slave(file, ByRef slave)
- {
- loop, read, % filesPath "\" file
- {
- if (A_Index = 1)
- {
- continue
- }
- loop, parse, A_LoopReadLine, CSV
- {
- if (A_Index = 1)
- {
- last := []
- , clientID := A_LoopField
- }
- else
- {
- last.Push(A_LoopField)
- }
- }
- slave[clientID].Push(last)
- }
- return slave
- }
Add Comment
Please, Sign In to add comment