; Autohotkey using string to access nested objects
; see: https://autohotkey.com/boards/viewtopic.php?f=5&t=15921&p=80794#p80794
#SingleInstance force
#NoEnv
m := "Master.child.SubChild"
if(m ~= "[.]+")
{
MsgBox, Found a dot or so
}
StringSplit, outArray, m, .
parent := ""
if(outArray0)
{
parent := %outArray1%
}
Loop, %outArray0%
{
if(a_index > 1)
{
partname := outArray%a_index%
if(parent.HasKey(partname))
{
parent := parent[partname]
}
else
{
break
}
}
}
if(IsObject(parent))
{
MsgBox, % parent.Name
}
ExitApp
class Master
{
Class child
{
Class SubChild
{
static Name := "SubChild --> Child --> master"
}
}
}
Comments
0 B
|👍
/👎