I am looking to speed up my workflow by parsing a resource string to auto create my variable paths. Not only can it get confusing to look at large scale UI's, it's even worse getting the paths written out to access each element. ExtendScript ha s a lot of "quirks" we'll call it. So for sake of simplicity the sample below is cut way down.
var res = "group{,\
itemsToRenameGrp: Group{,\
itemsToRenameDD: DropDownList{},\
help: Button{},\
},\
listTabPnl: Panel{,\
listOfItemsTab: Panel{,\
listOfItemsPnl: Panel{,\
listOfItemsLB: ListBox{},\
},\
confirmChanges: Button{},\
},\
badItemsTab: Panel{,\
errorLogET: EditText{},\
},\
},\
}";
I need to create paths like this for variable assignment:
itemsToRenameGrp.itemsToRenameDD
itemsToRenameGrp.help
listTabPnl.listOfItemsTab.listOfItemsPnl
listTabPnl.listOfItemsTab.listOfItemsPnl.listOfItemsLB
listTabPnl.listOfItemsTab.confirmChanges
listTabPnl.badItemsTab
listTabPnl.badItemsTab.errorLogET
I know there has to be a way via RegExp to parse the tab spaces, or "},\" section endings to make this work, I just can't figure out the solution myself. Any help is appreciated. Thanks.
Those backslashes should not be needed, there is a special multi-line mode when you start a string with three double-quotes.
Rather than parsing the source I'd leave that to ExtendScript and iterate the resulting UI objects.