2

I'm writing an IDC script which accepts a structure and does some processing. Currently, I have to call it by typing structure names. What I want is to make it use the structure under cursor in "Structures" window so I can save a lot of typing. Is there any way to do this?

Tried ScreenEA(). It returns the address in "Disassembly" window instead of a structure id.

IDAPython code is also acceptable.

1 Answer 1

2

May be bit of an odd question - but how do you run the script? Hotkeys don't work while the structure view is open, and if you run a script via Alt+F7 for example the cursor position changes.

That said, one solution that may be good enough:

import ida_kernwin

ret = ida_kernwin.get_highlight(ida_kernwin.get_current_widget())
if ret and ret[1]:
    print "Current highlight: %s" % ret[0]

Basically, you need to click the structure name so it's highlighted (yellow), then the above code will print the struct name.

1
  • I use IDA 6.8 and IDAPython v1.7.2. In my case the spell is idaapi.get_highlighted_identifier(). Commented May 8, 2018 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.