Skip to main content
Topic: User Tool for "digital whiteout" - rg_color.vbs (Read 11723 times) previous topic - next topic

User Tool for "digital whiteout" - rg_color.vbs

Simple tool to toggle Highlight n between "white" and its default color.
Download the attachment to your Scripts folder and remove ".txt" From the end of the file name.

The Command can be any one of:
  • WScript Scripts\rg_color.vbs
This will toggle 'Highlight 2'
  • WScript Scripts\rg_color.vbs /c:7
This will toggle 'Highlight 7'
  • Wscript Scripts\rg_color.vbs  /c:<PROMPT:Which Highlight?=#[1,7]>
This will prompt for the Highlight to use.


The program uses SendKeys() to dump keystrokes into NWC. MicroSoft makes continual changes to the way Windows handles SendKeys, so it may not work for you.

It is best to do some tests when there is not unsaved work in any application.
It is possible that rg_color.vbs may cause WScript.exe to hang. (It never hangs with WinXP). It can be stopped with the Task Manager, logging out and back on, or rebooting.

Comments welcome (please include Windows version). If this SendKey method works for a number of "power users", there are more powerful tools that I can post.
Registered user since 1996

Re: User Tool for "digital whiteout" - rg_color.vbs

Reply #1
G'day Rick,
just had a quick look.  First run didn't work, instead the MIDI tab appeard on the screen.  So I manually opened the options dialogue and went to the Color tab, closed the dialogue and ran it again - this time OK.

Tried a couple of times and toggle worked fine.  Subsequent runs with the MIDI tab open as the last used in the Options dialogue appeared to be OK regardless.

Next I specified the colour to change and it worked fine in the change from default to highlight, and back but then I had an odd occasion when it would inexplicably fail.  A re-run would then be OK...  Not sure why.

When it works (most of the time) it's fine, but I've had a couple of times when it would fail (with beeps) and a subsequent run would be OK.
I plays 'Bones, crumpets, coronets, floosgals 'n youfonymums - 'n I'm lernin' tubies now too

Re: User Tool for "digital whiteout" - rg_color.vbs

Reply #2
Thanks Lawrie.

I assume you are using XP Pro. The problem is the tabbed dialogs. It is difficult to tell when they are ready to accept Alt+Home and move to the first tab. Increasing the sleep time just masks the problem. I have a more stable method but it involves writing to the Registry, something I'd hoped to avoid.

I'm glad that reading the clipboard seems to be reliable (at least on XP).

More reports welcome. If I can crack this problem, User tools can be made to work on more than one staff.
Registered user since 1996

Re: User Tool for "digital whiteout" - rg_color.vbs

Reply #3
Vista Home Premium - Service Pack 2
3 GB memory

On first launch, I got the colour tab presented and then a Windows Script Host error
This says Line 30 Char 3 Type mismatch: '[string: "Wscripts\rg_c"]'
Code 800A000D
Source Microsoft VBScript runtime error.

This appeared after each invocation but - once I had switched off the security warning that preceeded the script running, all seemed ok . However multiple invocations seems to interfere with the keyboard rate and also caused the file open dialog box to be presented once ALt F8 was hit.

Had to re-boot to clear all of the problems.

Following the re-boot - all seems to work as expected except that ocasionally, the colour toggle doesn't happen and occasionally there is a windows "ding"

After a while, ALT-F8 again caused the file open dialog box to appear (after the script had selected all on the staff). Also caused right and left arrows to act as if they were CTRL right and CTRL left arrows. (ie a right arrow would jump to the next measure).

So another re-boot and that's it for me for the moment.
Rich.

Re: User Tool for "digital whiteout" - rg_color.vbs

Reply #4
On first launch, I got the colour tab presented and then a Windows Script Host error
This says Line 30 Char 3 Type mismatch: '[string: "Wscripts\rg_c"]'
Code 800A000D
Source Microsoft VBScript runtime error.
I'm clearly comparing a string to an integer there, but this is a stange complaint from BASIC. Wrap double quotes around 255 in line 30 and it should go away. I'll try not to do that anymore. Bad habit gained over 40 years...

multiple invocations seems to interfere with the keyboard rate and also caused the file open dialog box to be presented once ALt F8 was hit.
That sounds like an earlier try "hung" and is interfering with the new invocation. I guess I need to put the code back in that checks for that.

Following the re-boot - all seems to work as expected except that ocasionally, the colour toggle doesn't happen and occasionally there is a windows "ding"
I got that on XP in earlier versions. Thought I solved it. Version 1.0 works every time on my box.

Thanks for testing.
Registered user since 1996

Re: User Tool for "digital whiteout" - rg_color.vbs

Reply #5
Attached is a more "belt and braces" approach. It allows 2 seconds to get the dialog open to the color tab or errs with "Can't perform requested operation". It won't "hang", so this should eliminate the need to manually kill it.
It should not raise the warning about 'Type mismatch'.

Edit: this version withdrawn (found some bugs). New version to follow ...
Registered user since 1996

Re: User Tool for "digital whiteout" - rg_color.vbs

Reply #6
New version (1.02) attached to top of page.
If it doesn't move to the Color tab, remove "rem" from line 22. If you need to do this, please let me know what version of Windows you are using.
Registered user since 1996

 

Re: User Tool for "digital whiteout" - rg_color.vbs

Reply #7
All seemed to work Ok.

Windows Vista - Home premium, Service pack 2

Rich.