0% found this document useful (0 votes)
137 views

Script Editor

The document discusses the script editor in PCSWMM which allows users to create, run, and manage Python scripts. The script editor has three sections - a script manager to create and organize scripts, a code editor to write scripts, and an output window to display results. Scripts are saved as .py files and can be used across projects.

Uploaded by

mazzam75
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views

Script Editor

The document discusses the script editor in PCSWMM which allows users to create, run, and manage Python scripts. The script editor has three sections - a script manager to create and organize scripts, a code editor to write scripts, and an output window to display results. Scripts are saved as .py files and can be used across projects.

Uploaded by

mazzam75
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Script Editor

PCSWMM Support

Articles

Back

Script Editor

As part of PCSWMM's scripting capability, the Script Editor supports the creation,
execution and management of Python scripts.

The Script Editor comprises three sections: the script manager, the code editor and the
output window. The script manager is used to create, duplicate, order, rename, save,
delete, and filter the displayed scripts. The code editor provides intellisense, auto-
completion, syntax highlighting, as well as multi-line commenting, search/replace
functionality and tagging scripts (for filtering in the script manager). The resizable
output window provides an option for scripts to print text (for debugging or outputting

https://support.chiwater.com/122534/script-editor[8/2/2020 12:27:13 PM]


Script Editor

results).
Scripts are stored as separate files with the " .py " file extension in the App Data folder
(i.e. C:\Users\<username>\AppData\Roaming\PCSWMM\Scripts) and are available in all
projects.

New

Creates a new script. A New Script dialog will open requiring a unique script name.

Duplicate

Duplicates the current script. A Duplicate Script dialog will open prompting for a unique
script name.

Arrange

Displays a pop-up menu for moving the selected script up or down.

Move Top
Moves the selected script to the top.

Move Up
Moves the selected script up one.

Move Down

https://support.chiwater.com/122534/script-editor[8/2/2020 12:27:13 PM]


Script Editor

Moves the selected script down one.

Move Bottom
Moves the selected script to the bottom.

Rename

Renames the current script. A Rename Script dialog will appear for the user to input a
new script name.

Save

Saves the changes to the current script.

Delete

Deletes the current script.

Filter

Project
Filters the list of scripts to only show those used previously with the currently open
project.

All
Displays all the scripts which are saved to the App Data folder (C:\Users\<user
name>\AppData\Roaming\PCSWMM) on the user's computer.

Tags
Filters the list of scripts to only show those with the selected tag. Tags are optionally
defined in the script itself to classify or group scripts in the script manager. A script can
have multiple tags defined. Tags are defined in a comment (either a separate comment
line or an inline comment) anywhere in a script file. The tag definition has the format:

https://support.chiwater.com/122534/script-editor[8/2/2020 12:27:13 PM]


Script Editor

# tags: tag1, tag2


Tags are delimited by commas (,). Spaces are not required but allowed. Multiple
instances of this definition are supported in the same script.

Comment/Uncomment (Ctrl + Q)

Comment or uncomment selected code line(s). If a selected line does not have the
pound sign (#) as its first character, a pound sign will be inserted at the line start. If a
selected line has a pound sign as its first character, the pound sign will be removed.

Find/Replace (Ctrl + F, Ctrl + H)

Open the Find/Replace dialog to find certain text and optionally replace it with new text,
within the current script file.

Clear Output
Clear the content in the Output Window.

Copy Output
Copy the content in the Output Window to the Microsoft Windows clipboard for pasting
to other programs (e.g. Excel file) for further data analysis. If the content contains time
series in a delimited tabular format, it can be directly pasted in the Graph panel.

Run Script (F6)


Run the current script.

Close
Close the script editor.

https://support.chiwater.com/122534/script-editor[8/2/2020 12:27:13 PM]


Script Editor

Shortcut Keys
Additional to the buttons, several keyboard shortcut keys are supported to work with
the Script Editor:
F6: run the current script.

Esc: close the Script Editor when the code editor is not focused.

Ctrl + Q: comment or uncomment one or more selected code lines.

Ctrl + F: open the Find/Replace window, with the Find tab activated. Note when the
Map panel or the Graph panel is focused this key combination will open the Select
by Query window or Find time series window, respectively.

Ctrl + H: open the Find/Replace window, with the Replace tab activated.

Ctrl + S: save the current script if the Script Editor is focused. Note when the Map
panel is focused this key combination will save the current project.
Ctrl + N: open the New Script window to create a new script.

Ctrl + C: copy the selected text in the Script Editor.

Ctrl + V: paste the selected text at the current cursor position in the Script Editor.

Can this article be improved?

Computational Hydraulics Int.


147 Wyndham St. N., Ste. 202
Guelph, Ontario, Canada, N1H 4E9

Copyright 2020 by CHI

https://support.chiwater.com/122534/script-editor[8/2/2020 12:27:13 PM]

You might also like