PySh - Getting Started

The first time you start Visual Studio after installing PySh, you'll be presented with something like the following dialog:

Click on the Don't show this dialog at startup checkbox to prevent this dialog from being shown every time Visual Studio starts.

Registering Scripts

To add a new script file to PySh, change to the Scripts tab, and click the Add... button:

PySh will present you with a standard Open dialog that you can use to locate the script file. PySh won't attempt to load the script until you click on either OK or Apply.

When PySh does load the file, it will enumerate each class in the script file. If the class:

  1. Doesn't begin with an underscore (e.g. _Example) - PySh ignores these classes so they can be used as base or utility classes
  2. Has a description attribute, and
  3. Has an Exec method

Assigning Shortcuts

To assign a keyboard shortcut to a PySh command, change to the Commands page, and double click on the appropriate command (alternatively, click on the Edit... button).

Once in the Command Editor dialog, enter the appropriate shortcut in the edit window, then assign that shortcut to the command.

Alternatively, you can edit Visual Studios keyboard mapping to associate a shortcut with a PySh command (Tools->Options->Environment->Keyboard). Note that in this context, all PySh commands are prefixed with Drowse.PySh - this is the name of the Visual Studio Add-In that implements PySh:

The Output Window

The final piece of PySh is the Output Window. PySh registers an output pane with the Visual Studio Output Window. This pane, called Python Shell, shows status messages from the PySh Add-In as well as redirecting any output from commands executed by PySh.

To view the Output Window, select View->Output then, from the Show output from: drop-down, select Python Shell.

See also

Python Shell for Visual Studio is completely free, but if you want to contribute towards the running costs of this website, then please click on the button on the right and donate via PayPal