This appears to be a workable replacement:<?php
require_once('lib/nwc2clips.inc');
$clip = new NWC2Clip('php://stdin');
foreach ($clip->Items as $item) {
$o = new NWC2ClipItem($item);
//
$bits = isset($o->Opts['Pos']) | isset($o->Opts['Pos2']) << 1;
if ($bits == 3) $bits |= ($o->Opts['Opts']['Stem'] == "Up") << 2;
switch ($bits) {
case 1: $pos = $o->Opts['Pos']; break;
case 2: $pos = $o->Opts['Pos2']; break;
case 3: $pos = array_merge($o->Opts['Pos'], $o->Opts['Pos2']); break;
case 7: $pos = array_merge($o->Opts['Pos2'], $o->Opts['Pos']); break;
default: $pos = '';
}
//
echo substr($o->ReconstructClipText(), 0, 68), PHP_EOL, ' ';
if (is_array($pos)) echo join(',', $pos), PHP_EOL; else var_dump($pos);
}
exit(NWC2RC_REPORT);
?>
Try running it on this gauntlet:!NoteWorthyComposerClip(2.5,Single)
|Clef|Type:Treble
|Tempo|Tempo:120|Pos:10
|Rest|Dur:Half
|Note|Dur:Half|Pos:1
|Chord|Dur:Half|Pos:-2,-1,0,1,2
|RestChord|Dur:Half|Opts:Stem=Down|Dur2:Half|Pos2:-2,-1,0,1,2
|RestChord|Dur:Half|Opts:Stem=Up|Dur2:Half|Pos2:-2,-1,0,1,2
|Chord|Dur:Half|Pos:1,2,3,4,5|Opts:Stem=Up|Dur2:Whole|Pos2:-4,-3,-2,-1,0
|Chord|Dur:Half|Pos:-4,-3,-2,-1,0|Opts:Stem=Down|Dur2:Whole|Pos2:1,2,3,4,5
|TimeSig|Signature:Common
!NoteWorthyComposerClip-End
The code does not attempt to sort out 'Fake' items. If that were needed, I would use a function so that multiple returns could be used.