Edit Window

KosmicTask Help

Edit Window

The task edit window is used to edit and test a task's properties and script. Multiple edit windows may be open simultaneously.

Edit window

The edit window supports three different views as selected by the Edit View control in the toolbar.

Define the task properties and any required input parameters. The task view contains a Task Info pane on the left and a Task Inputs pane on the right.
Edit and build the task script.
Run and test the task. The run button will be disabled if the task script requires to be built before it can be run.

Task Info Pane

The Task Info pane defines the task properties. The properties are grouped as follows:

  • Name. The task name as displayed in the task browser.
  • Script. The task's script type.
  • Default. Sets the current script type as the default for all new tasks.
  • Group. The task's container group. Select an existing group or enter a new group name.
  • Short Description. Short description of the task. This will also appear in the task browser.
  • Long Description. A longer description of the task that that can be displayed when running the task. This field supports attributed text. Images may be dragged and dropped. This is useful for more complex tasks where comprehensive instructions need to be provided to the user.
  • Author. The task author name. Defaults to the current user name.
  • Note. Author notes to be associated with this task.
  • Created. The task creation date. The adjacent button selects the current date and time.
  • Modified. The task modification date. The adjacent button selects the current date and time. The Auto checkbox can be selected to cause the Modified date to automatically update whenever the task is edited and saved.
  • Version. The task version. The three numbers represent Major, Minor and Bugfix version digits. The Auto checkbox can be selected to cause the Version to automatically update whenever the task is edited and saved.
  • Allow user interaction. Some scripting languages are able to display interactive user dialogs. This may cause problems when executing scripts on shared instances of KosmicTask as user interaction on the remote machine may not be desirable. This options limits the level of user interaction allowed. This option is only effective for the following scripting languages: AppleScript.
    • Local access only. Allow dialogs to be displayed only when running the task on the local machine.
    • Local and remote access. Allow dialogs to be displayed on local and remote machines.
    • Never. Never allow dialogs to be displayed.
  • Task must complete in specified time. Set the task timeout value in seconds. If the task does not complete in the specified time it is automatically terminated.

Task Inputs Pane

The task inputs pane defines the number, type and order of inputs to the task. Inputs are passed to the task script as arguments in the order that they appear.

Task Inputs
  • + Add a new task input. By default a text type input will be initially created. This can be modified by changing the displayed input Type field.
  • - Remove the last input.

Edit View

The edit view displays the task script. The script may be edited and, if applicable, built. A template browser allows access to a wide range of script templates for each of the supported scripting languages.

Edit window edit view


In addition to the Edit View control the toolbar contains the following controls:

Build the script. A dialog sheet is displayed while a build is in progress and the build can be cancelled if required. Not all script types support building and in such cases the build control will remain disabled as the script is edited. If building is supported then the build control will be enabled whenever the script text is edited. All of the supported scripting languages are implemented as separate plug-ins which define the features and capabilities of each language. These features, which also detail the language build behaviour, are accessible via the script Settings tab.
For some languages, such a AppleScript, building is compulsory, in others it is optional or disallowed. In general it is advantageous to build a script prior to running it in order to highlight any issues. In cases where building is compulsory the action of building will generally equate to compilation to an executable form. In the remainder of cases the build action will usually result in a syntax check. This syntax check may be carried out by the scripting language component itself or by an auxiliary tool.
If a task is being edited on a remote instance of KosmicTask then the script is dispatched to the remote machine for building. This is an important consideration when developing tasks in languages such as AppleScript as applications targeted for automation have to be present in order to correctly resolve their terminology.
If the build generates errors or warnings these will be reported and displayed in the Build tab of the lower status pane. Languages which do not specifically require building will normally allow running even in the presence of build warning or errors.
Alternately use menu Task - Build or key command-B.
The run control switches the Edit View control to Run and attempts to run the task.
Alternately use menu Task - Run or key command-R. To build and run the task in one operation use menu Task - Build and Run or key command-Enter.
The template button displays the template browser in a drop down sheet. The selected template will replace the current task script. The effect of this can be undone using menu Edit - Undo Typing or key command-Z.
If a template is selected with a different script type then the task's script type will be updated to match the template.
Alternately use menu Edit - Insert Template or key command-I.
The resources button displays the Resource Browser in a separate window. This window contains the same content as the drop-down template sheet.
Alternately use menu Window - Resource Browser.

Window Controls

The Edit Window controls perform as follows:

Script Type
The script type popup control selects the language plug-in to be used to configure and run the task script. Normally the script type is set when a script template is selected but it can be set independently here.
Script Settings
The Settings tab displays the language plug-in settings for the selected script type. Most of the script settings are read only and cannot be modified. In general a task created from a template will run without any change to the script settings. However, if a script is edited so that the way in which the script has to be called is modified (for example, by adding a run function) then the script settings will have to be updated accordingly.
Build Result Tab
The build result tab displays the results of a build in the status pane. If warnings or errors are generated as the result of a build they will be listed here. Each scripting language formats its error and warning messages in its own fashion but line numbers are generally provided and can be used to track down problematic code sections. The drag thumb to the far right of the control can be used to resize the status pane.
Standard Error Tab
Some language plug-ins may also send additional build information to the standard Unix error stream stderr. This information can be displayed in the status pane using the stderr tab.


The editor displays the task script and employs syntax highlighting to differentiate between language keywords, variables and comments. The scope of the syntax highlighting varies according to the nature of the scripting language and the properties of the language plug-in.

In addition to standard text editing operations such as Cut, Copy, Paste, Select and Delete the script editor supports the following commands which can be accessed from the Edit menu:

  • Undo. Undo the last edit.
  • Redo. Redo the last edit
  • Shift Left. Shift the selected line or lines left by one tab. An alternate key combination is Shift - Tab.
  • Shift Right. Shift the selected line or lines right by one tab. An alternate key combination is Tab.
  • Format. The Format submenu. Many items are only enabled when a selection has been made.
    • Comment or Uncomment. Toggle commenting of the selected text.
    • Remove Needless Whitespace. Remove excess whitespace at end of selected lines.
    • Remove Line Endings. Remove line endings from selected lines.
    • Spaces to Tabs. Convert spaces to tabs for selected lines.
    • Tabs to Spaces. Convert tabs to spaces for selected lines.
    • Capitalise First Letter of Every Word. Capitalise first letter of every word in the selection.
    • To Uppercase. Convert selection to uppercase.
    • To Lowercase. Convert selection to lowercase.
    • Switch Characters. Interchanges the two characters on either side of the insertion point.
  • Go To Line.... Go to a line in the script.
  • Insert Template. Insert a task template. The template code will replace the existing script.
  • Find/ Displays the Find submenu.
  • Special Characters.... Displays the Characters panel to enable selection of special characters.

Run View

Selecting the Run button in the Edit View displays the run view. This view can be used to test the task while it is being edited and behaves exactly like the run view used in the main application window.

Edit window run view