Skip to main content
Topic: Clip to Text File (Read 28100 times) previous topic - next topic

Clip to Text File

Is there some simple way to convert the clip text to a normal text file which can be saved?

Re: Clip to Text File

Reply #1
Grab your clip in NWC (using Ctrl-C); open Notepad (or any text editor) and press Ctrl-V.  Save the file as text.

- John
John

Re: Clip to Text File

Reply #2
Works slick!

Many thanks.
Robert

 

Re: Clip to Text File

Reply #3
Since you asked in the Tool Forum, here's a tool.
I named this: To NotePad.vbs
Use the command: wscript "Scripts\To NotePad.vbs"

Code: [Select · Download]
Option Explicit
Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")
Dim f: f = fso.GetBaseName(fso.GetTempName) & ".txt"
f = fso.BuildPath(fso.GetSpecialFolder(2), f) ' 2 = %TEMP%
fso.CreateTextFile(f).Write(WScript.StdIn.Read(46080))
CreateObject("WScript.Shell").Run(f) ' leaves %TEMP%\nwt*.TMP
WScript.Sleep 500: fso.DeleteFile(f)
On Error Resume Next
For Each f In fso.GetSpecialFolder(2).Files
If Left(f.Name, 3) & Right(f.Name, 4) = "nwt.TMP" Then f.Delete
Next
If WScript.StdIn.AtEndOfStream Then WScript.Quit
MsgBox "Truncated to 45K bytes", vbExclamation, "Warning"
Registered user since 1996

Re: Clip to Text File

Reply #4
G'day Rick,
neat little tool - as usual for your contributions it works just nicely.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: Clip to Text File

Reply #5
A slightly different take for those that want to use a specific editor:
Quote from: EditClip.vbs
Option Explicit
Dim fso, wso, e, f, s
Set wso = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

f = wso.ExpandEnvironmentStrings( _
   WScript.Arguments.Named("File"))
For Each e In WScript.Arguments.Unnamed
   s = s & Chr(34) & e & Chr(34) & " "
Next
If Not WScript.Arguments.Named.Exists("Pass2") Then
   fso.CreateTextFile(f).Write WScript.StdIn.ReadAll
   wso.Run Chr(34) & WScript.ScriptFullName & Chr(34) _
      & s & "/Pass2 /File:" & Chr(34) & f & Chr(34)
Else
   wso.Run s,, True
   fso.DeleteFile f
End If
The syntax for Command: is a bit complex. For WordPad using a file called 1.txt in the current directory, use:
Quote from:  WordPad example
WScript Scripts\Editclip.vbs write 1.txt /file:1.txt

For a different editor using the temporary directory:
Quote from:  Example 2
WScript Scripts\Editclip.vbs "C:\Program Files\SCiTE\SciTE.exe" %temp%\1.txt /file:%temp%\1.txt
Note that you must repeat the filename. Since the script knows nothing about the editor's commandline syntax, it can't know how and where to put the filename. Quotes are needed around the editor filename. Another set (of quotes) is needed around the temp filename if there are space(s) in it. Not every editor will expand environment settings so %temp% might not work for everyone.

This version also waits until you exit your editor to delete the temp file. In the earlier version, if the disk was hibernating, the script could delete the file before NotePad could load it.
Registered user since 1996

Re: Clip to Text File

Reply #6
Rick:
I installed your EditClip.vbs and for the Command part of the User Tool Description have the following:
Code: [Select · Download]
WScript Scripts\Editclip.vbs "C:\tse32\e32.exe"  %temp%\1.txt /file:%temp%\1.txt
It brings up the highlighted part of a staff in my editor, but changes I make are not reflected in the score after I save and exit from the editor.
Since 1998

Re: Clip to Text File

Reply #7
It brings up the highlighted part of a staff in my editor, but changes I make are not reflected in the score after I save and exit from the editor.
The program doesn't work that way. You have to Select All + Copy from your editor and then Paste into NWC2. Try it. If it is too cumbersome, I'll try to automate it some more. At this point I want to verify that my command line routines will let you automagically run a TSE macro on it.

To work the way you describe, the file would need to get loaded into the clipboard, then the keystrokes to paste it would need to be forced into NWC2. I can do that in about 80 lines of code, but it is dicey.
Registered user since 1996

Re: Clip to Text File

Reply #8
It might be time for me to do some experimenting now. Unfortunately, I am very busy for a few days, after which I will be out of the country. But "note to self" says that next week I must investigate - and report back. Kick me in the shins if I don't.


Re: Clip to Text File

Reply #10
yeah - and then I forgot it's time for Amnesty cards, for December performance rehearsals, for family visits and other unspecified but nice surprises. And the "Africa! Africa!" show. So it did not work - yet. Thanks anyway.