Skip to main content
Topic: Examine clipboard (Read 3822 times) previous topic - next topic

Examine clipboard

When working on a script for a NWC tool, it can be helpful to see what is being passed to the script, especially the Fake and Context lines. This reads the clipboard and copies it to StdErr where a return code of 1 will display it. I called it seeClip.js:
Code: [Select · Download]
WScript.StdErr.Write(WScript.StdIn.ReadAll());
WScript.quit(1);

Create the file in your usual Scripts folder (must end in .js). When installing it as a new script, browse for the name of it, then add "wscript " (note trailing space) to the beginning of the line. No prompts.

Since 1998

Re: Examine clipboard

Reply #1
It's already visible in the stdin tab of the tool result dialog.
There is also the stdout tab.
The only problem is that, as far as I know, it's visible only if there is something in the stderr.

Re: Examine clipboard

Reply #2
N.B. of course you can always change the return code of the tool.
Quote
The following return codes are recognized:
  • 0 Text in STDOUT is processed and anything found in STDERR is presented as a warning to the user
  • 1 Anything found in STDERR is shown to the user, and nothing else is done
  • 99 Anything found in STDOUT is shown to the user, and nothing else is done

Re: Examine clipboard

Reply #3
It's already visible in the stdin tab of the tool result dialog.
The only other time I worked on a script without going through a webpage was for Audit Barlines and I opened that tab many times. I'll be giving the 99 rc and StdOut a try soon.
Since 1998

Re: Examine clipboard

Reply #4
This is the newest version--I also tested the Wscript.Echo statement
Code: [Select · Download]
WScript.StdOut.Write(WScript.StdIn.ReadAll());
WScript.Echo("Testing");   // This line may be taken out.
WScript.quit(99);
/*
WScript.StdErr.Write(WScript.StdIn.ReadAll());
WScript.quit(1);
 */
Same information, just in a different tab.

This might be helpful when working on scripts that change the staff (Return Code == zero).
Since 1998