mirror of
https://github.com/cemu-project/idapython.git
synced 2025-01-27 08:55:35 +01:00
hotkey.py: Added hotkey example script
This commit is contained in:
parent
5cc1192d08
commit
62bddd5e04
24
examples/hotkey.py
Normal file
24
examples/hotkey.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#---------------------------------------------------------------------
|
||||||
|
# This script demonstrates the usage of hotkeys.
|
||||||
|
#
|
||||||
|
# Note: Hotkeys only work with the GUI version of IDA and not in
|
||||||
|
# text mode.
|
||||||
|
#
|
||||||
|
# Author: Gergely Erdelyi <dyce@d-dome.net>
|
||||||
|
#---------------------------------------------------------------------
|
||||||
|
import idaapi
|
||||||
|
|
||||||
|
def foo():
|
||||||
|
print "Hotkey activated!"
|
||||||
|
|
||||||
|
# IDA binds hotkeys to IDC functions so a trampoline IDC function
|
||||||
|
# must be created
|
||||||
|
idaapi.CompileLine('static key_2() { RunPythonStatement("foo()"); }')
|
||||||
|
# Add the hotkey
|
||||||
|
AddHotkey("2", 'key_2')
|
||||||
|
|
||||||
|
# Press 2 to activate foo()
|
||||||
|
|
||||||
|
# The hotkey can be removed with
|
||||||
|
# DelHotkey('2')
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user