mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-25 02:26:55 +01:00
26 lines
668 B
Python
26 lines
668 B
Python
|
#---------------------------------------------------------------------
|
||
|
# This script demonstrates the usage of hotkeys.
|
||
|
#
|
||
|
#
|
||
|
# Author: IDAPython team
|
||
|
#---------------------------------------------------------------------
|
||
|
import idaapi
|
||
|
|
||
|
def hotkey_pressed():
|
||
|
print("hotkey pressed!")
|
||
|
|
||
|
try:
|
||
|
hotkey_ctx
|
||
|
if idaapi.del_hotkey(hotkey_ctx):
|
||
|
print("Hotkey unregistered!")
|
||
|
del hotkey_ctx
|
||
|
else:
|
||
|
print("Failed to delete hotkey!")
|
||
|
except:
|
||
|
hotkey_ctx = idaapi.add_hotkey("Shift-A", hotkey_pressed)
|
||
|
if hotkey_ctx is None:
|
||
|
print("Failed to register hotkey!")
|
||
|
del hotkey_ctx
|
||
|
else:
|
||
|
print("Hotkey registered!")
|