When the selected Python script is a code-only script (like the example below), the right-hand panel of the Python Script Editor is used to enter and edit the code for that script.
The majority of your Python code will be standard Python 2.7x, but several specialized GainSeeker Python commands are also available.
Contents [Hide] |
To quickly find the list of GainSeeker Python commands, right-click the code window and then choose GainSeeker Python Commands.
For some GainSeeker Python commands, you can first use a simple Action interface to insert a block of basic code, and then modify that code as desired.
To do so, right-click the line of code where you wish to insert the basic code block, and then choose Add Action.
For information on choosing and customizing Actions, see Adding and Editing Actions.
Code Completion provides in-line assistance while you are entering a GainSeeker Python command.
While entering a GainSeeker Python
command, typing the period (.)
will trigger the display a list of the properties () and methods ()
associated with the command you have entered so far.
Characters typed after the period will narrow the list to items
that contain that character string:
Select a property or method by clicking or scrolling, and then
press TAB or ENTER to insert the selected item into your code.
While entering a GainSeeker Python
command, typing the left parenthesis (
will trigger the display of arguments needed. The arguments continue
to be displayed until you type the right parenthesis )
.
You can use toolbar buttons, the right-click menu, and more built-in tools to work with Python code.
To run a basic syntax checker, right-click the code window and then choose Check Syntax.
This detects simple mistakes like mismatched quotes or parentheses; some incorrect commands, keywords, or function calls; etc.
You can use Ctrl+scrollwheel to change the size of the font in the code window.
Use the buttons on the toolbar to undo changes or to put them back (Redo).
To find a string, press Ctrl+F or right-click the code window and then choose Find. This will display a Find box in the code window.
Type the text you want to find. Any matching text will be highlighted. Use the arrow buttons or press F3 (or Shift+F3) to select the next (or previous) instance of the matching text.
Use the drop-down arrow for more specialized searches.
To automatically replace all instances of the text you specify with a new text string, press Ctrl+H or right-click the code window and then choose Replace. This will display a Replace window.
To comment the current line of code when no code is selected, press Ctrl+Shift+3. Or right-click the desired line of code and then choose Comment Line(s).
To comment all lines with code selected, select those lines and then press Ctrl+Shift+3. Or select those lines, right-click the code window and then choose Comment Line(s).
While editing and/or debugging GainSeeker Python scripts, you can flag one or more lines in one or more scripts with bookmarks, and then as needed cycle through these bookmarked lines. This can be especially useful when working with a large script or multiple related scripts.
To add or remove a bookmark for the current line of code, press Ctrl+K. Or right-click the desired line of code and then choose Toggle Bookmark. This will add (or remove) a bookmark symbol to (or from) the left margin of the editor window.
When you want to jump to another bookmark, you can use the right-click menu or a keyboard shortcut to jump to the next (Ctrl+N) or previous (Ctrl+P) bookmark. This tool will cycle through bookmarks in the current script sequentially from top to bottom, and through other scripts in alphabetical order. (While debugging a script, this will only cycle through the bookmarks in the currently running script.)
These bookmarks are maintained until you close the Python Script Editor window.
To move the current line of code when no code is selected, press Alt + Up Arrow or Alt + Down Arrow.
To move all lines with code selected, press Alt + Up Arrow or Alt + Down Arrow.
To delete the current line of code when no code is selected, press Ctrl+Shift+L.
To delete all lines with code selected, press Ctrl+Shift+L.
Some parts of the code are automatically colored as follows:
Red |
string values |
Orange |
numeric values |
Fuschia |
boolean values (True and False) |
Green |
Comments |
Blue |
Python keywords |
Brown |
None |
Navy |
import |
Teal |
try and except |
After you indent a line in a code block (such as if, while, for, etc.), pressing Enter to create new lines will automatically indent those lines as well.
You can save your script at any time by pressing Ctrl+S or by clicking the button on the toolbar. If you select another script or close the Python Script Editor before all changes have been saved, you will be prompted with the option to save changes.
To cancel unsaved changes, select another script or close the Python Script Editor and then click No when prompted.