The python API is in the N10X.Editor python module. For example:
For example python scripts see %appdata%\10X\PythonScripts\
Execute a 10x command : ExecuteCommand(command_name)
return a list of all commands : string GetCommandList()
Send an undo event to the currently focused file : Undo()
Send a redo event to the currently focused file : Redo()
Send an key up/down press event to 10x : SendKey(string, (shift, control, alt))
Send an key down event to 10x : SendKeyDown(string, (shift, control, alt))
Send an key up event to 10x : SendKeyUp(string, (shift, control, alt))
Send a char key event to 10x : SendCharKey(string)
Add a function that will be called on the main thread : CallOnMainThread(function)
Shut down 10x - Exit(force)
Control whether 10x writes changes to the state file (for testing only) : SetWriteStateEnabled(bool)
Get the position of the currently focused file in the panel grid : (x, y) GetCurrentPanelGridPos()
Show a message on the status bar : SetStatusBarText(text)
Log a message to the 10x output panel : LogTo10XOutput(string)
Show a message box : ShowMessageBox(string, string)
Show a message box with yes and no buttons: ShowYesNoMessageBox(title, message, yes_function, no_function)
Show a message box with yes and no buttons and a dropdown selection : ShowYesNoWithDropdownMessageBox(title, message, yes_function(selection), no_function(selection), options)
Show the output panel : ShowOutput()
Clear the 10x output panel : Clear10xOutput()
Make 10x check all open files to see if any of them need to be reloaded : CheckForModifiedFiles()
Select the specified project in the workspace tree : ShowProjectInWorkspaceTree(filename)
Set the status bar colour : SetStatusBarColour((r, g, b))
Clear the status bar colour : ClearStatusBarColour()
Set the cursor colour override : SetCursorColourOverride((r, g, b))
Remove the cursor colour override : ClearCursorColourOverride()
Reset the cursor blink : ResetCursorBlink()
Find and return all occurances in the current file. list(x, y, line) : FindInFile(text, | match_case, is_regex)
Use Workspace Search to find a matching file. finished_function is a function that takes a list of files. FindFiles(text, finished_function, | match_case)
Use Workspace Search to find all occurances in the workpace. finished_function is a function that takes a list of (filename, char_index, line_index, line) tuples and a truncated bool. FindTextInFiles(text, finished_function, | match_case, use_wildcards, is_regex)
Replace text in the current file. Returns the number of instances replaced. num_replaced ReplaceText(filename, old_text, new_text, | replace_all)
set the text for the find panel. If start_pos is (-1,-1) it uses the current cursor pos : SetFindText(text, case=False, word=False, regex=False, reverse=False, start_pos=(-1,-1))
set the text for the Worksapce Search panel : SetSearchText(text)
set the text for the find-replace panel : SetReplaceText(text)
Get the Case setting in the find panel : bool GetFindByCase()
Set the Case setting in the find panel : SetFindByCase(bool)
Get the Word setting in the find panel : bool GetFindByWord()
Set the Word setting in the find panel : SetFindByWord(bool)
Get the regex setting in the find panel : bool GetFindByRegex()
Set the regex setting in the find panel : SetFindByRegex(bool)
return true if SetFindText is set to find in reverse : bool GetReverseFind()
Make SetFindText find in reverse : SetReverseFind(bool)
Return true if the find text in file panel is open : bool IsFindPanelOpen()
Return true if the find/replace text in file panel is open : bool IsFindReplacePanelOpen()
Return True if the output panel is open : bool IsOutputPanelOpen()
Return True if the find file panel is open : bool IsFindFilePanelOpen()
Return True if the command panel is open : bool IsCommandPanelOpen()
Return True if the command line arg selector panel is open : bool IsCommandLineArgSelectorPanelOpen()
Return True if the Control key is currently held down: bool ControlKeyHeld()
Return the number of columns in the panel grid : int GetColumnCount()
Set the number of columns in the panel grid : SetColumnCount(int)
Close all panels in the specified column : CloseAllPanelsInColumn(column_index)
Return the width of the specified column : int GetColumnWidth(column_index)
Set the width of the specified column : SetColumnCount(column_index, width)
Set the text in the command panel : SetCommandPanelText(string)
Add a menu to the main menu : AddMenu(name, | index)
Remove a menu from the main menu : RemoveMenuItem(name)
Add an item to the main menu : AddMenuItem(menu_name, name, command, | index)
Remove an item from the main menu : RemoveMenuItem(menu_name, name)
Add an item to the context menu : AddContextMenuItem(name, command, | index)
Remove an item from the context menu : RemoveContextMenuItem(name)
Set the cursor mode. Valid values: "Line", "Block", "Underscore", "HalfBlock" : SetCursorMode(string)
Reset the cursor mode to the value in the settings file : ResetCursorMode()
Return true if a text editor has focus : bool TextEditorHasFocus()
Execute a command in Visual Studio. For more info see the EnvDTE.ExecuteCommand on MSDN : ExecuteVSCommand(command, args)
Set the main app window size : SetWindowSize(int, int)
Bring the 10x window to the front : SetForegroundWindow()
return the window rect : (x,y,w,h) GetwindowRect()
Set the window rect : SetwindowRect((x,y,w,h))
return the current version of 10x
Set the currently focused tab : SetFocusedTab(tab_index)
Execute a build command : ExecuteBuildCommand(command, working_dir)
Get the error and warnings for the current file. finished_function is a function that takes a (type, line_index, char_index, description) tuple list : GetErrorsAndWarnings(finished_function)
Get the current build config : string GetBuildConfig()
Set the current build config : SetBuildConfig(string)
Get the current build platform : string GetBuildPlatform()
Set the current build platform : SetBuildPlatform(string)
Get the build output text : string GetBuildOutput()
Get the build results for the last build. finished_function is a function that takes a (type, line_index, char_index, description) tuple list : GetBuildResults()
Get the build status. statis is one of "not started", "in progress", "finished" : (status, error_count) GetBuildStatus()
Get the current build config for the active workspace : string GetWorkspaceBuildConfig()
Get the current build platform for the active workspace : string GetWorkspaceBuildPlatform()
Log a message to the build output : LogToBuildOutput(string)
Parse the build output for errors : ParseBuildOutput()
Show the build output panel : ShowBuildOutput()
Clear the build output panel : ClearBuildOutput()
Return True if the build panel is open : bool IsBuildPanelOpen()
If you have overridden the build command call this when the build has finished : void OnBuildFinished(bool build_succeeded)
Send text to the text to speech player : TextToSpeech(string)
Send braille to the accessibility app : SendBraille(string)
Open a file : OpenFile(filename, | panel_grid_pos, cursor_pos)
Close the current file
Save the specified file or the current file if no file specified : SaveFile(|filenmae)
Save all files : bool SaveAll()
Get the filename of the currently focused file. Empty string if no file focused
Get the filename of the currently focused file or the last focused file if it's still showing.
Discard unsaved changes for the current file : DiscardUnsavedChanges()
Discard all unsaved changes : DiscardAllUnsavedChanges()
Return true if the current file has been modified : bool IsModified()
Return true if the specified file is read only : bool IsFileReadOnly(filename)
If the file is open give it focus : Focusfile(filename)
Get all currently open files : list GetOpenFiles()
Open a workspace : OpenWorkspace(filename)
Close the current workspace : CloseWorkspace()
Add an additional include path to the current workspace : AddWorkspaceAdditionalInclude(path)
Get the current workspace filename : filename GetWorkspaceFilename()
Enable or disable the workspace settings file (used for testing only) : SetWorkspaceSettingsEnabled(bool)
Get all files in the current worksapce : list GetWorkspaceFiles()
Get the project files in the current workspace : list GetWorkspaceProjectFiles()
Get the path to the executable that the workspace builds : string GetWorkspaceExePath()
Return True if the workspace tree is open : bool IsWorkspaceTreeOpen()
Return the path of the local workspace settings path in appdata : string GetAppDataWorkspacePath()
Returns true if the current workspace has finished opening : bool GetWorkspaceOpenComplete()
Return the filename of the currently active project : string GetActiveProject()
Set the current active project. Filename is the full path to the project : SetActiveProject(filename)
Add a force include to the current workspace : AddForceInclude(filename)
Get the value for the specified workspace setting : string GetWorkspaceSetting(string) Settings: BuildCommand RebuildCommand BuildFileCommand CleanCommand BuildWorkingDirectory CancelBuild RunCommand RunWorkingDirectory DebugCommand ExePath DebugSln UseVisualStudioEnvBat Configurations (comma separated array) Platforms (comma separated array)
Set the value for the specified workspace setting : SetWorkspaceSetting(string, string) Settings: BuildCommand RebuildCommand BuildFileCommand CleanCommand BuildWorkingDirectory CancelBuild RunCommand RunWorkingDirectory DebugCommand ExePath DebugSln UseVisualStudioEnvBat Configurations (comma separated array) Platforms (comma separated array)
Add a breakpoint and return its id : id AddBreakpoint(filename, line_index)
Remove a breakpoint : RemoveBreakpoint(filename, line_index)
Remove a breakpoint : RemoveBreakpointById(id)
Update a breakpoint line : UpdateBreakpoint(id, line_index)
Remove all breakpoints
Get the command to run when starting debugging : string GetDebugCommand()
Get the arguments to pass into the debug command : string GetDebugCommandArgs()
Get the current working directory to use for the debug command : string GetDebugCommandCwd()
Return a list of breakpoints (id, filename, line) : list GetBreakpoints()
Set the current debugger step line : SetDebuggerStepLine(filename, line_index)
Remove the current debugger step line : ClearDebuggerStepLine()
If you are overriding the debugger call this when the debugger has started : OnDebuggerStarted()
If you are overriding the debugger call this when the debugger has stopped : OnDebuggerStopped()
If you are overriding the debugger call this when the debugger has paused : OnDebuggerPaused()
Return a list of bookmarks (filename, line) : list GetBookmarks()
Push an undo group onto the undo stack : PushUndoGroup()
Pop an undo group from the undo stack : PopUndoGroup()
For code that does lots of text updates wrap it in BeginTextUpdate/EndTextUpdate to make it go fast. It disables much of the internal updating until EndTextUpdate is called : BeginTextUpdate()
For code that does lots of text updates wrap it in BeginTextUpdate/EndTextUpdate to make it go fast. It disables much of the internal updating until EndTextUpdate is called : EndTextUpdate()
Get the entire text for the specified file, or the current file if filename is empty : string GetFileText(filename)
Set the entire text for the currently focused file : SetFileText(text)
Set the text in the currently focused file : SetTextRange(start_line, end_line, text)
Get the line count for the currently focused file : number GetLineCount()
Get the number of lines that are currently visible : number GetVisibleLineCount()
Insert text in the currently focused file at the cursor position : InsertText(text)
Get the cursor position for the currently focused file : (x, y) GetCursorPos(index)
Get the number of cursors : int GetCursorCount()
Set the cursor position for the current focused file : SetCursorPos((x, y), | index)
add a new cursor at the specified pos : AddCursor((x, y))
Set the cursor X position in the current line : SetCursorX(x)
Move the cursor to the specified line : SetCursorY(y)
Get the current selection start position for the currently focused file : (x, y) GetSelectionStart()
Get the current selection end position for the currently focused file : (x, y) GetSelectionEnd()
Set the cursor selection end position for the current focused file : SetCursorPosSelect((x, y))
Set the cursor rectangular selection : SetCursorRectSelect((start_x, start_y), (end_x, end_y))
Get the current line text for the currntly focused file : string GetCurrentLine()
Get the currently selected text : string GetSelection()
Set the cursor selection : SetSelection((start_x, start_y), (end_x, end_y), cursor_index=0)
Get the cursor selection : (x,y), (x,y) GetCursorSelection(cursor_index=0)
Remove the cursor : RemoveCursor(cursor_index)
Remove all other cursors : ClearMultiCursor()
Show or hide the specified cursor : SetCursorVisible(cursor_index, bool)
Get the line text for the currently focused file : text GetLine(line_index)
Set the line text for the currently focused file : SetLine(line_index, text)
Clears any multi-cursors : ClearMultiCursors()
Clear the current text selection : ClearSelection()
Scroll so that the current line is centered vertically : CenterViewAtLinePos(line_index)
Scroll the cursor so that it is in view : ScrollCursorIntoView()
Get the current scroll line index : GetScrollLine()
Set the current scroll line index : SetScrollLine(line_index)
Hide the mouse cursor until it's moved
If you are overriding the debugger call this when the debugger has resumed : OnDebuggerResumed()
Return true if autocomplete has completed (even if it's not showing : bool IsAutocompleteComplete()
Temporarily override a setting (doesn't change the settings file) : OverrideSetting(name, value)
Remove a setting override : RemoveSettingOverride(name)
return the preprocessed line for the current line : string GetPreprocessedLine()
return the symbol type for the symbol at the specified position in the current file : string GetSymbolType(pos)
return the symbol type for the curent symbol : string GetCurrentSymbolType()
return the symbol definition string for the symbol at the specified position in the current file : string GetSymbolDefinition(pos)
return the filename for the symbol definition for the symbol at the specified position in the current file : string GetSymbolDefinitionFilename(pos)
return the name of the current scope : string GetCurrentScopeName()
Return true if the autocomplete dropdown is currently showing : bool IsSHowingAutocomplete()
Show the autocomplete list box ShowAutocomplete(items, | pos)
Show the autocomplete list box ShowSymbolReferences(items) where items is a list of (filename, line, index, length) tuples
Show a info hover box ShowHoverBox(pos, text)
Set the parser verbose logging mode : SetParserVerboseLoggingMode(mode)
Get the path to the settings folder : filename GetSettingsFolderPath()
Set the name of the settings file to use (for testing only) : SetSettingsFileName(file_name)
Reset all settings to the defaults : ResetSettingsToDefault()
Reset all key mappings to the defaults : ResetKeyMappingsToDefault()
Get the value for the specified setting : string GetSetting(string)
Set the value for the specified setting : SetSetting(string, string)
Get the name of the current key mappings file : string GetKeyMappingsFilename()
Set the name of the key mappings file to use : SetKeyMappingsFilename(filename)
return True if running in Notepad mode : bool GetNotepadMode()
Checkout a file in Perforce : PerforceOpenForEdit(filename)
Add a function that will be called every frame : AddUpdateFunction(function)
Remove an update function : RemoveUpdateFunction(function)
Add a function that will be called when 10x is about to close : AddExitingFunction(function)
Remove an exiting function : RemoveExitingFunction(function)
Add a function to be called when a char key is pressed : AddOnCharKeyFunction(function) : function(string)
Remove a function to be called when a char key is pressed : RemoveOnCharKeyFunction(function) : function(string)
Add a function to be called before a char key is handled : AddOnInterceptCharKeyFunction(function) : bool function(string)
Remove a function to be called before a char key is handled : RemoveOnInterceptCharKeyFunction(function) : bool function(string)
Add a function to be called when an unmapped key is pressed before it is handled by 10x : AddOnKeyFunction(function) : function(string, shift, control, alt)
Remove a function to be called when an unmapped key is pressed before it is handled by 10x : AddOnKeyFunction(function) : function(string, shift, control, alt)
Add a function to be called when after a key has been handled by 10x : AddOnPostKeyFunction(function) : function(string, shift, control, alt)
Remove a function added by AddOnPostKeyFunction : RemoveOnPostKeyFunction(function) : function(string, shift, control, alt)
Add a function to be called before a key press is handled. Return true if handled : AddOnInterceptKeyFunction(function) : bool function(string, shift, control, alt)
Add a function to be called before a key press is handled. Return true if handled : RemoveOnInterceptKeyFunction(function) : bool function(string, shift, control, alt)
Add a function to be called when a read only file is about to be modified : AddOnReadOnlyFileModifiedFunction(function) : function(filename)
Add a function to be called when a workspace is opened : AddOnWorkspaceCreatedFunction(function)
Remove an OnWorkspaceCreatedFunction function : RemoveOnWorkspaceCreatedFunction(function)
Add a function to be called when a workspace is opened : AddOnWorkspaceOpenedFunction(function)
Remove an OnWorkspaceOpenedFunction function : RemoveOnWorkspaceOpenedFunction(function)
Add a function to be called when a file is opened : AddOnFileOpenedFunction(function)
Remove an OnFileOpenedFunction function : RemoveOnFileOpenedFunction(function)
Add a function to be called when the settings file has been saved : AddOnSettingsChanged(function)
Add a function to be called when the a file is about to lose focus : AddOnFileLosingFocusFunction(function)
Remove an AddOnFileLosingFocusFunction function : RemoveOnFileLosingFocusFunction(function)
Add a function that handles commands entered in the command panel. Function takes a string and returns true if command is handled : AddCommandPanelHandlerFunction(function)
Add a function that's called when the cursor moves : AddCursorMovedfunction(function)
Remove a function that was added by AddCursorMovedFunction : RemoveCursorMovedFunction(function)
Add a function to be called when the parser has finished its main parse : AddParsersFinishedFunction(function)
remove a parser finished function : RemoveParsersFinishedFunction(function)
Add a function to be called when the debug command line changes : AddDebugCommandLineChangedFunction(function)
remove a parser finished function : RemoveDebugCommandLineChangedFunction(function)
Add a function to be called to start the debugger : AddStartDebuggingFunction(function) : bool function() - return True if the debugging process has been overridden
Add a function to be called to stop the debugger : AddStopDebuggingFunction(function) : bool function() - return True if the debugging process has been overridden
Add a function to be called when the debugger is started : AddOnDebuggingStartedFunction(function) : function()
Add a function to be called when the debugger is stopped : AddOnDebuggingStoppedFunction(function) : function()
Add a function to be called when the debugger is Restartped : AddRestartDebuggingFunction(function) : bool function() - return True if the debugging process has been overridden
Add a function to be called when the debug step over command is called : AddDebugStepOverFunction(function) : function()
Add a function to be called when the debug step into command is called : AddDebugStepIntoFunction(function) : function()
Add a function to be called when the debug step out command is called : AddDebugStepOutFunction(function) : function()
Add a function to be called when the OpenCurrentFileInDebugger command is called : AddOpenCurrentFileInDebuggerFunction(function) : bool function(filename, (x,y))
Add a function to be called when the project is about to be built. If returning true you must call ExecuteBuildCommand or OnBuildFinished : AddProjectBuildFunction(function) : bool function(filename) - return True to override the build
Add a function to be called when the project is about to be rebuilt. If returning true you must call ExecuteBuildCommand or OnBuildFinished : AddProjectRebuildFunction(function) : bool function(filename) - return True to override build
Add a function to be called when a build has finished : AddBuildFinishedFunction(function) : function(build_result)
Add a function to be called before a file is saved : AddPreFileSaveFunction(function) : function(filename)
Add a function to be called after a file has been saved : AddPostFileSaveFunction(function) : function(filename)
Add a function to be called when a breakpoint is added : AddBreakpointAddedFunction(function) where function is function(id, filename, line)
Add a function to be called when a breakpoint is removed : AddBreakpointRemovedFunction(function) where function is function(id, filename, line)
Add a function to be called when a breakpoint is updated : AddBreakpointUpdatedFunction(function) where function is function(id, filename, line)
Add a function to be called when starting to select text with the mouse : AddMouseSelectStartedFunction(function) where function is function((i,i))
Add a function to be called when finishing selecting text with the mouse : AddMouseSelectFinishedFunction(function) where function is function((i,i))
Called when the autocomplete is shown : AddAutocompleteShownFunction(function) where function is function()
Remove function added by AddAutocompleteShownFunction() : RemoveAutocompleteShownFunction(function)
Called before a command is run. Return True if the command is handled : AddInterceptCommandFunction(function) where function is bool function(command_name)
Remove function added by AddInterceptCommandFunction() : RemoveInterceptCommandFunction(function)
Called when the mouse hovers over a symbol. Return True if the command is handled : AddSymbolMouseHoverFunction(function) where function is bool function(pos)
Remove function added by AddSymbolMouseHoverFunction() : RemoveSymbolMouseHoverFunction(function)
Log to the attached debugger output : DebugLog(string)
Initialise the test environment. Reset settings and disable settings write. Name can be anything : InitialiseTestEnvironment(name)
Enable or disable the parser cache (used for testing only) : SetParserCacheEnabled(bool)
Use a local clipboard instead of the OS clipboard (used for testing only) : SetUseLocalClipboard(bool)
Log UE PCH file paths for this file : SetUEPCHLogFilename(filename)