dump_selection

summary: retrieve & dump current selection

description:

Shows how to retrieve the selection from a listing widget (“IDA View-A”, “Hex View-1”, “Pseudocode-A”, …) as two “cursors”, and from there retrieve (in fact, generate) the corresponding text.

After running this script:

  • select some text in one of the listing widgets (i.e., “IDA View-…”, “Local Types”, “Pseudocode-…”)

  • press Ctrl+Shift+S to dump the selection

level: advanced

Attributes

ACTION_NAME

ACTION_SHORTCUT

p0

p1

view

lines

Classes

dump_selection_handler_t

Functions

get_widget_lines(widget, tp0, tp1)

get lines between places tp0 and tp1 in widget

Module Contents

dump_selection.get_widget_lines(widget, tp0, tp1)

get lines between places tp0 and tp1 in widget

class dump_selection.dump_selection_handler_t

Bases: ida_kernwin.action_handler_t

activate(ctx)

Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.

Returns:

non-zero: all IDA windows will be refreshed

update(ctx)

Update an action. This is called when the context of the UI changed, and we need to let the action update some of its properties if needed (label, icon, …) In addition, this lets IDA know whether the action is enabled, and when it should be queried for availability again. Note: This callback is not meant to change anything in the application’s state, except by calling one (or many) of the “update_action_*()” functions on this very action.

dump_selection.ACTION_NAME = 'dump_selection'
dump_selection.ACTION_SHORTCUT = 'Ctrl+Shift+S'
dump_selection.p0
dump_selection.p1
dump_selection.view
dump_selection.lines = []