How 2 Create a Python NWC User Tool

Preamble

Read Introduction to User Tool Development. Summary:

  • NWC Staff Clip input to your tool is from STDIN.
  • Main Output back to NWC Staff is to STDOUT.
  • User Interaction via “PROMPT” command line arguments used when calling your tool.

Create your Python Module

Make a Python script to do something to a NoteWorthy Composer clip. Here is a simple example. It copies the NWC clip into a file.

import sys
instr = sys.stdin.read()
f = open('joesFirstTestOut.txt', 'w'); f.write(instr); f.close()

Hook Up your Python Module with NWC

1. Copy your module to:
<path>\Program Files\NoteWorthy Composer 2\Scripts\
2. Hook up NWC to your module
2.1 In NWC Click Menu >> Tools >> User Tools
2.2 In User Tools dialog click "New" button
2.3 In User Tool Description dialog enter:

Group: joe                               <or whatever>
Name: joesFirst.py                       <or whatever>
Command: python scripts\joesFirst.py     <or python scripts\whatever>
Input Type: clip text
Options: 
    compress input:         [ ]
    returns file text:      [ ]
    long task handling:     [ ]
    prompts for user input: [ ]
2.4 In User Tool Description dialog click "OK" button
2.5 In User Tools dialog click "Close" button

Run your Python Module

2.1 In NWC select the staff for which you want the clip
2.2 In NWC Click Menu >> Tools >> User Tools
2.3 In User Tools dialog select your group & command
2.4 In User Tools dialog click "Run" button

N.B. For the example module, the file named 'joesFirstTestOut.txt' 
will appear:
    NOT IN <path>\Program Files\NoteWorthy Composer 2\Scripts\
    BUT IN <path>\Program Files\NoteWorthy Composer 2\Scripts\

For More Information about NWC2 Scripting

Read also Getting started with NWC2 User Tools

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s