Skip to main content
Topic: User tools in other languages (Semware)? (Read 8927 times) previous topic - next topic

User tools in other languages (Semware)?

Thus far I have seen user tools in php and vbs.  Can other programs also manipulate the clipboard after being started by a user tool?  I am thinking specifically of The Semware Editor (TSE) but other programs might be used as well.
Since 1998

Re: User tools in other languages (Semware)?

Reply #1
User tools do not use the Windows clipboard. They are executed by NWC2, and passed the notation clip text via Standard Input. A user tool can be created in any programming/scripting language, as long as it can read and process text on Standard Input and write text to Standard Output.

As for the clipboard, you can copy and paste a NWC2 selection into any text editor, change it, and then paste it back into NWC2. The results that you paste back must be valid NWC2 clip text. If the editor supports its own scripting techniques, you can make use of those as well, prior to pasting back into NWC2.

Re: User tools in other languages (Semware)?

Reply #2
G'day Warren,
RickG has created a tool called "ToNotepad" that at least allows you to put the clip into Notepad.  But I don't see that he has implemented a way to re-import the edited text automagically.

The script doesn't seem too difficult to modify to use TSE to open the file...

I can't remember WHERE he posted it originally, but if he gives the OK I will happily upload it here unless he does it himself first.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.


Re: User tools in other languages (Semware)?

Reply #4
I moved this topic into general NWC2 discussion, since this is clearly about using a text editor to process NWC2 clip text.

Just to be clear, you do not need anything special when editing NWC2 clip text in an external editor. Select the notation in NWC2, press Ctrl+C, then paste it into your favorite text editor. After you change the text as needed, simply copy it and paste it back into NWC2 (Ctrl+V).

Re: User tools in other languages (Semware)?

Reply #5
G'day Eric,
I think what Warren was seeking was a mechanism to export the clip text, process it in his preferred environment and then reimport the clip WITHOUT the manual requirement of copy and paste.

IIRC, TSE can be loaded with paramaters to automatically run specified macros thus the resultant behaviour would be identical to any other script but in an environment that he is familiar with.

Perhaps a short script similar to Rick's "ToNotepad" that can save the clip to a temp file and also pass parameters so that the required macro could be run when TSE was loaded.  Then TSE could be exited with a save to the temp file and from which the script could then place the clip back into the work...

It would need to be able to shell out to TSE and pause until TSE was exited...
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: User tools in other languages (Semware)?

Reply #6
From my perspective, in the current scheme, the effort required to invoke a User Tool would be as significant as a simple copy and paste into a text editor.

I suppose that a "Edit as Text" command (or similar) could be added, where the selection would be automatically passed to some external program that has been previously configured. However, I suspect that this mechanism could be error prone, and is essentially unnecessary.

Re: User tools in other languages (Semware)?

Reply #7
G'day Eric,
From my perspective, in the current scheme, the effort required to invoke a User Tool would be as significant as a simple copy and paste into a text editor.

Actually, I agree.  My previous reply was simply my interpretation of what Warren seemed to be asking.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: User tools in other languages (Semware)?

Reply #8
I use Semware (TSE, The Semware Editor) a lot.
Yesterday, I exported a Noteworthy file to .nwctxt, wrote a small TSE macro to change the whole Tempo Track to 80 % for rehearsing, and read the .nwctxt file back. It's a breeze, but it's still a matter of starting TSE, opening the .nwctxt file, firing a macro, saving the .nwctxt file and re-opening it in Noteworthy.

Never tried TSE with stdin - I don't think it's supported.

Re: User tools in other languages (Semware)?

Reply #9
Hi, Rob -

Do you have the TSE manual?  I have one from when I bought it a long time ago, but not with updates along the way.  TSE has long been my text editor of choice, and I usually just do simple macros.  But I remember reading through the user's manual and it really is a full fledged programming language.  You can do an awful lot with it.  I'd be surprised if it didn't support stdin.

Just a thought.  If I remember I'll try to take a look at it this evening when I get home from work, although my thoughts right now are on my dad who I just found out was just admitted to the hospital with a heart blockage, so it might be awhile to get back to you.

John

Re: User tools in other languages (Semware)?

Reply #10
G'day Rob,
I use Semware (TSE, The Semware Editor) a lot.

I still have an ancient copy of QEdit which is, I believe, TSE's earlier incarnation.  It's VERY good but I haven't used it in years.


Quote
Yesterday, I exported a Noteworthy file to .nwctxt, wrote a small TSE macro to change the whole Tempo Track to 80 % for rehearsing, and read the .nwctxt file back.

Mate, that seems a lot of work...  You already have "Global_Mod", a simple:
Tempo Tempo*=.8
would have done the trick a lot easier...


Quote
Never tried TSE with stdin - I don't think it's supported.

I can't help you there...  QEdit couldn't that I'm aware of and I haven't kept up to date with TSE.
I plays 'Bones, crumpets, coronets, floosgals, youfonymums 'n tubies.

Re: User tools in other languages (Semware)?

Reply #11
John,

I would be surprised if TSE could use stdin... What's the use? With all the ctrl, alt and shift key combinations, not to mention function keys that do TSE's job, what could you possibly accomplish?

I do have a manual from an earlier version. Copyright 1991-1994. Nearly all of it still holds, but no mention of stdin or stdout therein.

Lawrie, I tried the user tools once but did not have much use for it. Rather than learning something I hardly ever use, I use TSE. I can do that blindfolded. I intend to write more combined goodies to work on complete scores using nwctxt. I wrote my own "tripletize" in TSE, but I combined it with other actions that I need to do on Midi-imports. Now that we can work on whole scores, the workaround using TSE starts to pay off.

Re: User tools in other languages (Semware)?

Reply #12
Many thanks for the feedback.  Right now I have to
  • Cut the objects I want to the clipboard.
  • Invoke a shortcut key to bring up TSE doing my nwc macro
  • Choose what I want to do
  • Paste the clipboard back into my NWC score at the current insertion point
I used the "Wedge" a lot recently (Swingdings is user font 2), but since nwctxt has been introduced, I don't think I need the triplet option on the menu since it can work on the entire score.

My source code is here.  To use it download to \tse\mac and rename to strip off the ".txt". My shortcut runs the following code:
Code: [Select · Download]
C:\tse32\e32.exe -enwc
I wrote my own "tripletize" in TSE, but I combined it with other actions that I need to do on Midi-imports. Now that we can work on whole scores, the workaround using TSE starts to pay off.
I would be interested in seeing it.
Since 1998

Re: User tools in other languages (Semware)?

Reply #13
I put a User Tool <here>
It may get you a bit further in you quest.
Registered user since 1996

Re: User tools in other languages (Semware)?

Reply #14
Thanks Rick.  That looks like what I need to get started.  Just getting in the editor without a lot of extra steps is a big help, with or without macros.  Again, thanks.
Since 1998

Re: User tools in other languages (Semware)?

Reply #15
You're welcome. Saving a few keystrokes doesn't sound like much to the casual user, but it is a big deal to some of us. If you are having trouble auto-invoking macros, post a couple examples of the Command:'s that aren't working as planned. I have some experience with how VBScript can mangle them. I maybe able to suggest how to trick it into unmangling them or make some program enhancements.

Might also help to know your OS. '98 and XP are quite different as to timing.
Registered user since 1996

Re: User tools in other languages (Semware)?

Reply #16
Warren: My source is here: http://rdenheijer.nl/Zamiko/Tripletize.s

It takes care of all triplets I found in a certain score. Maybe I should generalise a bit and add more.
Examples are included at the end.