Skip to content

Instantly share code, notes, and snippets.

@AaronMcHale
Last active May 14, 2016 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AaronMcHale/8dbf01a43f87e7a92803 to your computer and use it in GitHub Desktop.
Save AaronMcHale/8dbf01a43f87e7a92803 to your computer and use it in GitHub Desktop.
Script to toggle on and off the Keyboard Visualizer application for Razer Chroma devices
' VBScript that toggles starting and stopping the Keyboard Visualizer application
' Script written by AaronMcHale (https://github.com/AaronMcHale)
' Helper code to get the path of your Desktop (you can modify this to use other folders
' like Documents), I use this because I have Keyboard Visualiser stored on my desktop
set WshShell = WScript.CreateObject("WScript.Shell")
strSpecialPath = WshShell.SpecialFolders("Desktop")
' CONFIGURATION SECTION
' Set this to the file path where Keyboard Visualiser is stored
strPath = ""
' To use the above helper code in the path uncomment the following line
' Optional: you can then put any extra path information after the backslash
'strPath = strSpecialPath & "\"
' Set this to the name of the Keyboard Visualizer file
strAppName = "KeyboardVisualizerVC.exe"
' Set the arguments that you want Keyboard Visualiser to start with, for information about
' arguments go here https://insider.razerzone.com/index.php?threads/rock-your-razer-chroma-devices-with-the-audio-visualizer.8796/page-27#post-171216
strArgs = "startminimized amplitude=100 bkgd_bright=20 avg_size=8 nrml_ofst=0.3 nrml_scl=4 bkgd_mode=2 frgd_mode=0"
' END OF CONFIGURATION SECTION
' Your done configuring, yay!
' don't change any of the following unless you know what your doing
' Check to see if Keyboard Visualizer is already open, if so close it
set service = GetObject ("winmgmts:")
boolEnded = false
for each Process in Service.InstancesOf ("Win32_Process")
If Process.Name = strAppName then
Process.Terminate
boolEnded = true
End If
next
' Check to see if any instance Keyboard Visualiser were closed,
' if so terminate the script as that is all we need to do on this run
If boolEnded = true then
wscript.quit
End IF
' Use the Windows Shell to start Keyboard Visualiser with our pre-set arguments
Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
strFile = chr(34) & strPath & strAppName & chr(34)
objShell.Run(strFile & " " & strArgs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment