MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / get_open_filename_input

Function get_open_filename_input

python/interaction.py:1262–1293  ·  view source on GitHub ↗

``get_open_filename_input`` prompts the user for a file name to open .. note:: This API functions differently on the command-line vs the UI. In the UI a pop-up is used. On the command-line \ a simple text prompt is used. The UI uses the native window pop-up for file selection. Multiple file s

(prompt: str, ext: str = "")

Source from the content-addressed store, hash-verified

1260
1261
1262def get_open_filename_input(prompt: str, ext: str = "") -> Optional[str]:
1263 """
1264 ``get_open_filename_input`` prompts the user for a file name to open
1265
1266 .. note:: This API functions differently on the command-line vs the UI. In the UI a pop-up is used. On the command-line \
1267 a simple text prompt is used. The UI uses the native window pop-up for file selection.
1268
1269 Multiple file selection groups can be included if separated by two semicolons. Multiple file wildcards may be specified by using a space within the parenthesis.
1270
1271 Also, a simple selector of `*.extension` by itself may also be used instead of specifying the description.
1272
1273 :param str prompt: Prompt to display.
1274 :param str ext: Optional, file extension
1275 :Example:
1276 >>> get_open_filename_input("filename:", "*.py")
1277 'test.py'
1278 >>> get_open_filename_input("filename:", "All Files (*)")
1279 'test.py'
1280 >>> get_open_filename_input("filename:", "Executables (*.exe)")
1281 'foo.exe'
1282 >>> get_open_filename_input("filename:", "Executables (*.exe *.com)")
1283 'foo.exe'
1284 >>> get_open_filename_input("filename:", "Executables (*.exe *.com);;Python Files (*.py);;All Files (*)")
1285 'foo.exe'
1286 """
1287 value = ctypes.c_char_p()
1288 if not core.BNGetOpenFileNameInput(value, prompt, ext):
1289 return None
1290 result = value.value
1291 assert result is not None
1292 core.free_string(value)
1293 return result.decode("utf-8")
1294
1295
1296def get_save_filename_input(prompt: str, ext: str = "", default_name: str = "") -> Optional[str]:

Callers 1

actionMethod · 0.50

Calls 1

decodeMethod · 0.45

Tested by

no test coverage detected