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.

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.

  • I use IDA 6.8 and IDAPython v1.7.2. In my case the spell is idaapi.get_highlighted_identifier(). – brk May 8 '18 at 16:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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