This script is something someone made for me. I cannot get a hold of him/her anymore. Here is what the script does.
I have multiple clients. Each has their own folder. x:dropboxlawcases [client name]
Within their folder, they each have an excel document named info. the excel document has multiple sheets within it. Those sheets are named opposing party, court, witnesses, family etc.
The idea behind the script is to allow the user to easily and rapidly select information the user will frequently need to insert into documents.
I also have an excel document titled clients.xls. that document is in the main case directory x:dropboxcasesclients.xls. it contains information about each client such as DOB, SSN, phone, etc.
The first part of the below script works. Hitting control plus numpad [#] inserts the correct information. but the problem occurs when I attempt to pull information from the info excel documents. For instance, hitting alt+numpad1 brings up the opposing party dialog box as it should. And I can select which opposing party I want to pull information from. I can then select the type of info I want such as address etc.
The problem is, where the code once took the selected item and pasted/sent it to whatever document I had open at the time, now it does nothing.
Nothing has changed in the script. I am too ignorant to make any changes.
Can anyone help me figure out why it is not working?
`filesPath := A_ScriptDir ; "x:dropboxlawcasescases"
; Sheet names inside info.xlsx
sheets := ["Children", "Third Parties", "Experts", "Witnesses", "Doctors", "Court", "Family", "Opposing", "Opposing Witnesses"]
init() ; Read Excel files at script load
; When Excel files change...
^f11::init() ; Read them again
; Select a Client
f12::createGui("Client", -1)
; Client info
^numpad1::clientInfo(1) ; Name
^numpad2::clientInfo(2) ; Address
^numpad3::clientInfo(3) ; Phone
^numpad4::clientInfo(4) ; Email
^numpad5::clientInfo(5) ; Fax
^numpad6::clientInfo(6) ; DoB
^numpad7::clientInfo(7) ; SSN
^numpad8::clientInfo(8) ; Date of Injury
^numpad9::clientInfo(9) ; Wedding Date
^numpad0::clientInfo(9) ; Matter Link
; second part where i assume the problem is
; Relational info
!numpad1::createGui("Opposing", 1)
!numpad2::createGui("Court" , 1)
!numpad3::createGui("Doctors", 1)
!numpad4::createGui("Children", 1)
!numpad5::createGui("Family", 1)
!numpad6::createGui("Third Parties", 1)
!numpad7::createGui("Opposing Witnesses", 1)
!numpad8::createGui("Witnesses", 1)
!numpad9::createGui("Experts", 1)
; End of configuration
action()
{
global
Gui Submit
RegExMatch(A_GuiControl, "(w+)_(d)_(d+)", match)
; match1 = rootName
; match2 = 0=fields, 1=data
; match3 = button#
if match2
{
%match1%Id := match3
if (match1 != "Client")
createGui(match1, 0)
}
else
{
row := match1 "Id"
SendInput % "{Raw}" clientData[clientId][match1].data[row][match3]
}
}
clientInfo(field)
{
global
if !clientId
return createGui("Client", -1)
SendInput % "{Raw}" clientData[clientId][field]
}
createGui(rootName, data)
{
global
if (rootName = "Client")
branch := clientData
else if !clientId
return createGui("Client", -1)
else if data
branch := clientData[clientId][rootName].data
else ; fields
branch := clientData[clientId][rootName].fields
if !branch ; Client didn't have requested sheet
return
Gui New, +ToolWindow +AlwaysOnTop
Gui Font, s11
for i, node in branch
Gui Add, Button, % "w140 h35 gAction v" rootName "_" !!data "_" i
, % IsObject(node) ? node[1] : node
clientName := clientId ? clientData[clientId][1] : "Select a Client"
if (rootName != "Client")
clientName .= " > " rootName
Gui Show,, % clientName
}
init()
{
global
book := ComObjGet(filesPath "clients.xlsx")
sheet := book.Worksheets[1]
clientData := clientId := ""
readSheet(sheet, clientData)
book.Close(false)
for i, client in clientData
{
file := filesPath "" client[1] "info.xlsx"
if !FileExist(file)
{
MsgBox % 0x10|0x40000, Error, % "Error loading info.xlsx for " client[1]
clientData.Delete(i)
continue
}
book := ComObjGet(file)
for j, sheetName in sheets
{
try
{
sheet := book.Worksheets[sheetName]
data := fields := ""
readSheet(sheet, data, fields)
clientData[i, sheetName, "data"] := data
clientData[i, sheetName, "fields"] := fields
}
}
book.Close(false)
}
book := sheet := ""
}
readSheet(sheet, ByRef rows, ByRef headers := "")
{
headers := {}
for cell in sheet.Range("A1:Z1")
{
if cell.value
{
colNum := A_Index
colLtr := Chr(64 + A_Index)
headers[A_Index] := cell.value
}
else break
}
rows := {}
i := col := line := 0
for cell in sheet.Range("A:" colLtr)
{
if Mod(++i, colNum) = 1
col := 1
, line++
else col++
if line = 1
continue
if cell.value
rows[line - 1, col] := cell.value
else if col = 1
break
}
}
GuiClose:
GuiEscape:
Gui Destroy
return
``
1