I would like to automate calling the DeepScanVariable function from the HexRaysPyTools right-click menu (that serves to reconstruct structures).
I have changed the arguments types for a list of functions, based on data gathered at run-time. Now, I would like to go over that list of functions, and for each argument of a given type, select that argument, right-click, and select Deep Scan Variable.
What that HexRaysPyTools function does is roughly:
def activate(self, ctx):
hx_view = idaapi.get_widget_vdui(ctx.widget)
obj = api.ScanObject.create(hx_view.cfunc, hx_view.item)
(...)
I already found the action name by calling idaapi.get_registered_actions()
.
Then I give focus to the decompilation view, to make get_widget_vdui
happy and fire the action:
widget = idaapi.find_widget('Pseudocode-A')
idaapi.activate_widget(widget, 1)
idaapi.process_ui_action('HexRaysPyTools:DeepScanVariable')
What's missing is that I'm supposed to select the item, so that hx_view.item
has the correct value and I cannot find any way to do that. I can iterate over arguments of a decompiled function just fine, I just cannot find a way to actually mark an item as selected.