Jump to content

- Appendix B

- # Persistent Variables - B.2 - Usage outside call routing - Simple VBS/WSF script

  Followers 0

  VBScript 1.1.0

  This example demonstrates how to make use of Persistent Variables in a WSF (Windows Scripting Host File) file, i.e. a VBScript file.

  You will find it in the download package in the following folder

  - \examples\External\vbs

  This little script is meant to be connected with a shortcut SwyxIt! skin element. By clicking on that shortcut the .wsf file will be started.

  By starting this .wsf file the current status of the installed Night Switch will be toggled.

  Toggle.wsf

      <package>
      <job id="Toggle_Example">
      <script language="VBScript" src="PersistentVariables.vbs"/>
      <script language="VBScript">

      ' configure the complete db connect string
      g_sPersistentVariableConnectString = _
      	"Provider=sqloledb;" & _
      	"Data Source=WS-WELLIGE04;" & _
      	"Initial Catalog=" & PERSISTENT_VARIABLE_DATABASE & ";" & _
      	"User Id=PersistentVariables;" & _
      	"Password=PersistentVariables"

      ' initialize persistent variable
      Dim NightSwitch
      Set NightSwitch     = new PersistentVariable
      NightSwitch.Name    = "NightSwitch"
      NightSwitch.Default = 0

      if NightSwitch.Value = 0 then
      	NightSwitch.Value = 1
      else
      	NightSwitch.Value = 0
      end if

      Set NightSwitch = Nothing

      WScript.Quit
      </script>

      </job>
      </package>

  You can call this .wsf file directly from a command prompt:

      C:\PersistentVariables> Toggle

  You have to make sure, that the PersistenVariables.vbs file is in the same folder as the Toggle.wsf file.

  Please find a complete explanation of the usage of persistent variables outside of call routing scripts here:

  - 6.6 - Usage of Persistent Variables outside of a call routing script

  By Tom Wellige

  - May 14, 2022
  Share
  Share
  Followers 0
  Previous Page B.1 - Usage outside call routing - Simple ASP webpage
  Next Page B.3 - Version History

## Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.