Dear NWC Forum,
Thanks for being a great place to share info. I am trying to write my first User Tool. It will be in Python. It is very simple. It copies a clip to a file.
I am using NWC 2.5.5 & have installed version 2.5 of the NWC2 User Tool Starter Kit.
Here's some system info from About Starter Kit:
System => Windows NT cmptrName 5.1 build 2600 (Windows XP Professional Service Pack 3) i586
Build Date => Sep 17 2009 19:13:11
Compiler => MSVC9 (Visual C++ 2008)
Architecture => x86
Configure Command => cscript /nologo configure.js "--disable-all" "--enable-cli" "--enable-zlib"
Server API => Command Line Interface
Here is my simple Python program to copy a clip to a file:
import sys
instr = sys.stdin.read()
f = open('joesFirstTestOut.txt', 'w'); f.write(instr); f.close()
When I run it from a windows prompt, it works :
C:\...Scripts>python joesFirst.py<joesFirstTestIn.txt
When I run it from a NWC User Tool, there is NO CHANGE in joesFirstTestOut.txt.
My User Tool Description Dialog has been set with 2 alternatives with the same results as above:
Alt-1group: joe
name: joesFirst.py
command: python scripts\joesFirst.py
input type: clip text
options:
compress input: [ ]
returns file text: [ ]
long task handling: [ ]
prompts for user input: [ ]
Alt-2group: joe
name: joesFirst.py
command: python scripts\joesFirst.py
input type: clip text
options:
compress input: [ ]
returns file text: [ ]
long task handling: [X]
prompts for user input: [ ]
Does anyone have any suggestions?
Thanks in advance.
Love and peace,
Joe
OK here's the answer. It DID work from a NWC User Tool.
When I run it from a NWC User Tool,
apparently the Current Working Directory:
IS NOT <path>\NoteWorthy Composer 2\Scripts\
BUT IS <path>\NoteWorthy Composer 2\
Mystery Solved.
I have published a small description of how to do this on my blog under:
How 2 Create a Python NWC User Tool (http://joecodeswell.wordpress.com/2014/01/20/how-2-create-a-python-nwc-user-tool/)
Thanks for being a GREAT Forum.
Love and peace,
Joe
For the instance of NWC that runs it, this tool will report the current working directory for all tools:
<?php
# rg_HomePath.php ver 1.00;
# Ref: http://my.noteworthysoftware.com/?topic=8709.0
require_once ('lib/nwc2clips.inc');
echo getcwd();
exit(NWC2RC_REPORT);
?>