Migrating wiki contents from Google Code

This commit is contained in:
Google Code Exporter
2015-03-14 16:01:41 -04:00
commit daa40bb0da
10 changed files with 352 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
# Introduction #
This is a small example on how to run Python statement from IDC and catch the errors
# Code #
```
def function():
print "Hello...."
print z # !!! Cause runtime errors.... !!!
err = idaapi.CompileLine(r"""
static key_ALTN()
{
auto s = RunPythonStatement("function()");
if (IsString(s))
{
Message("Error in the python statement: %s\n", s);
return;
}
}
""")
if err:
print "Error compiling IDC code: %s" % err
else:
AddHotkey("ALT-N", 'key_ALTN')
```