Patchworks script library

Table of Contents

00_startup — Patchworks system initialization script.
adjustWeightsRelative — This script will adjust the weight values so that the accounts will compete against each other in an equitable manner.
analyze — These methods can be used to control the duration of a simulation.
analyze_safe — This method is similar the the analyze method, but it will periodically save out the scenario files in order to protect against power failures or other interuptions.
changeToScriptDirectory — This script will change the working directory into the directory of the active calling script.
clearTargets — This method will turn all targets to inactive.
confirm — This method will present a dialog box and query for an 'Ok' or 'Cancel' answer.
copyTable — Copy a table to a text file, in simple CSV format.
filterCSV — This routine will read a CSV file and create a copy that contains only the selected records.
findInFeaturesFile — This script will search through a 'features.
guiControl — This code in this method assists in controlling and customizing the Patchworks user interface.
loadScripts — This method will load all of the BeanShell scripts from a specified folder.
loadSrnvTargets — This script will assist in defining reports and setting targets for the Ontario Landscape Guide prescriptive indicators.
lockExclusives — Set the locking status for an exclusive account for all selected blocks in the block table.
makeAnimation — The methods in this file will create simple GIF animations from a series of images.
makeZip — These methods will create a Zip archive containing the contents of a specified folder.
maximizeSustainableYield — This method implements a binary-search sustainable harvest level calculator, written by Greg Paradis.
objective — The methods in this file are useful for setting up scenario automation using ScenarioSets.
pause — These methods will present a dialog box and pause until clicked.
reloadExclusiveLocks — Reload the all of exclusive account locks from a previously saved scenario.
reloadExclusives — Reload the all of exclusive account options from a previously saved scenario.
reloadRoutes — Reload the all of route files from a previously saved scenario.
reloadScenario — Reload the all of scenario data from a previously saved scenario.
reloadSchedule — Reload the schedule data from a previously saved scenario.
reloadTargets — Reload the target data from a previously saved scenario.
reloadTimingConstraints — Reload the timing constraint data from a previously saved scenario.
resaveReports — These methods are used to load up and save out scenarios.
safelyRenameFile — Rename a file to a backup, and then rename the replacement.
select — This script will present a dialog box and query for a list selection .
selectivelyCancelTreatments — This script will cancel treatments based on a selection criteria and a range of periods.
setActive — Toggle target activation status for target with label "label" @param label The target to set @param active The activation status to be set.
setInitialAnnual — These methods will set the initial target values of the specified target.
setInitialPeriodic — These methods will set the initial target values of the specified target.
setMaxWeight — These methods will set the maximum weight values of the specified target.
setMaximum — These methods will set the maximum target values of the specified target.
setMaximumAnnual — These methods will set the maximum target values of the specified target.
setMaximumPeriodic — These methods will set the maximum target values of the specified target.
setMinWeight — These methods will set the minimum weight values of the specified target.
setMinimum — These methods will set the minimum target values of the specified target.
setMinimumAnnual — These methods will set the minimum target values of the specified target.
setMinimumPeriodic — These methods will set the minimum target values of the specified target.
setOptions — This script will display a menu listing the BeanShell variables that were specified in the input list.
setTarget — This method will set the minimum and maximum target values of the specified target.
setTargetAnnual — This method will set the minimum and maximum target values of the specified target.
setTargetPeriodic — This method will set the minimum and maximum target values of the specified target.
showTargetMenu — Apply a list of targets.
simulate — Simple sequential simultion model.
sourceGlobal — Source a Beanshell script into the global context.
tempFile — These methods create unique, not previously used file names.

This appendix describes the scripts that are provided in the Patchworks script library. These scripts can be used at the console prompt or from within the PIN file. As well, you can make your own scripts that invoke these helper scripts.

These scripts are a resource to be used for automating analysis at the Patchworks console prompt or within your own automation scripts. You are encouraged to look at the source code to these scripts for hints and ideas on how to work with the BeanShell language and the Patchworks API.

You will find the source code to these scripts located in the Patchworks installation directory, in a folder named 'scripts'.

Each of the following sections is listed by the name of the script. Some scripts contain multiple methods of the name. The first part of each section will provide a general description of the purpose of the script. Subsequent sections will show the form of the method call including the types of the arguments and the type of value that is return. Following the method prototype is a description of the method and a list of the parameters to the method.