cemu-idapython/examples/ex_add_menu_item.py
elias.bachaalany 109158fabb - IDA Pro 6.1 support
- Added AskUsingForm() with embedded forms support (check ex_askusingform.py example and formchooser.py in the SDK)
- Added idautils.DecodePreviousInstruction() / DecodePrecedingInstruction()
- Added idc.BeginTypeUpdating() / EndTypeUpdating() for fast batch type update operations
- Added more IDP callbacks
- Added UI_Hooks with a few notification events
- Added idaapi.process_ui_action() / idc.ProcessUiAction()
- Added netnode.index() to get netnode number
- Better handling of ea_t values with bitwise negation
- Execute statement hotkey (Ctrl-F3), script timeout, and other options are now configurable with Python.cfg
- bugfix: idaapi.msg() / error() and warning() so they don't accept vararg
- bugfix: processor_t.id constants were incorrect
- bugfix: get_debug_names() was broken with IDA64
- Various bugfixes
2011-04-18 16:07:00 +00:00

18 lines
407 B
Python

import idaapi
def cb(*args):
print("Callback called!")
return 1
try:
ctx
idaapi.del_menu_item(ctx)
print("Menu removed")
del ctx
except:
ctx = idaapi.add_menu_item("Search/", "X", "", 0, cb, tuple("hello world"))
if ctx is None:
print("Failed to add menu!")
del ctx
else:
print("Menu added successfully. Run the script again to delete the menu")