home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 May / PCpro_2006_05.ISO / files / free_security / msshared / Shared_Computer_Toolkit_ENU.msi / FileScripts001 < prev    next >
Encoding:
Extensible Markup Language  |  2005-09-02  |  16.0 KB  |  215 lines

  1.  ■<?xml version="1.0" ?>
  2. <package>
  3.     <comment>
  4.         ' ***
  5.         ' *** ------------------------------------------------------------------------------
  6.         ' *** Filename:        Accessibility.wsf
  7.         ' *** ------------------------------------------------------------------------------
  8.         ' *** Description:    Command-line interface to the Accessibility tool
  9.         ' ***                 This file parses command line parameters and calls functions
  10.         ' ***                 that are defined in clsUserAccess.vbs
  11.         ' *** ------------------------------------------------------------------------------
  12.         ' *** Version:        1.0
  13.         ' *** Notes:        
  14.         ' *** ------------------------------------------------------------------------------
  15.         ' *** Copyright (C) Microsoft Corporation 2005, All Rights Reserved
  16.         ' *** ------------------------------------------------------------------------------
  17.         ' *** 
  18.     </comment>
  19.     <job>
  20.         <runtime>
  21.             <description>Accessibility Tool</description>
  22.             <named name="LargePointer" required="false" many="false" helpstring="Extra Large Pointer" />
  23.             <named name="Magnifier" required="false" many="false" helpstring="Magnify" />
  24.             <named name="StickyKeys" required="false" many="false" helpstring="StickyKeys" />
  25.             <named name="FilterKeys" required="false" many="false" helpstring="Filter Keys" />
  26.             <named name="MouseKeys" required="false" many="false" helpstring="Mouse Keys" />
  27.             <named name="OSK" required="false" many="false" helpstring="On Screen Keyboard" />
  28.             <named name="Narrator" required="false" many="false" helpstring="Narrator" />
  29.             <named name="SoundSentry" required="false" many="false" helpstring="Sound Sentry" />
  30.             <named name="ShowSound" required="false" many="false" helpstring="Show Sound" />
  31.             <named name="HighContrast" required="false" many="false" helpstring="/HighContrast:theme turns on High Contrast | /HighContrast: turn off High Contrast" />
  32.             <!--named name="LargeFonts" required="false" many="false" helpstring="Extra Large Fonts" /-->
  33.             <example>Example: Accessibility.wsf /HighContrast:"theme" /LargePointer /Narrator /StickyKeys</example>
  34.         </runtime>
  35.         
  36.         <resource id="CScriptMessage">Restarting script in command-line mode. Run CmdOn.BAT to set command-line mode as the default mode.</resource>
  37.         <resource id="CScriptTitle">Shared Computer Toolkit: Windows Script Mode Detected</resource>
  38.         
  39.         <?job error="True" debug="False" ?>
  40.         <script language="VBScript" src="../include/Common.vbs"></script>
  41.         <script language="VBScript" src="../include/libWSF.vbs"></script>
  42.         <script language="VBScript" src="../include/clsLogging.vbs"></script>
  43.         <script language="VBScript" src="../include/clsAccessibility.vbs"></script>
  44.         <script language="VBScript">
  45.         <![CDATA[
  46.             ' ~~~ 
  47.             ' ~~~ Force variables to be declared 
  48.             ' ~~~ 
  49.             Option Explicit
  50.             
  51.             ' ~~~ 
  52.             ' ~~~ Declare variables and constants
  53.             ' ~~~ 
  54.             Dim oLog, args, oAccessibility, bOk, sCurrentContrast, sNewContrast
  55.             
  56.             ' ~~~ ------------------------------------------------------------------------------
  57.             ' ~~~ Logging
  58.             ' ~~~ ------------------------------------------------------------------------------
  59.                                     
  60.             ' ~~~ Create logging object
  61.             ' Set oLog = New Logging    
  62.             ' ~~~ Initiate logging
  63.             ' Call oLog.Open(GetRootFolder & "\log\Accessibility.wsf.log")
  64.             ' Call oLog.Write("Accessibility.wsf : Started")
  65.             
  66.             Call Main("Accessibility.hta")
  67.             Set oAccessibility = New accessibility
  68.             bOk = False
  69.             
  70.             sCurrentContrast = ""    ' ~~~ Stores the currently existing contrast value 
  71.             sNewContrast        = ""    ' ~~~ Stores the new contrast to be applied 
  72.             
  73.             Set args = Wscript.Arguments
  74.             
  75.             ' ~~~ Set High Contrast
  76.             If Wscript.Arguments.Named.Exists("HighContrast") Then
  77.                 bOk = True
  78.                 If Wscript.Arguments.Named("HighContrast") <> "" Then
  79.                     ' ~~~ Get the current set high contrast theme from registry
  80.                     sCurrentContrast = RegRead( "HKEY_CURRENT_USER\Control Panel\Accessibility\HighContrast\High Contrast Scheme")    
  81.                     ' ~~~ Store the new high contrast theme to be applied
  82.                     sNewContrast = Wscript.Arguments.Named("HighContrast") 
  83.                     ' ~~~ Check if the high contrast theme entered in command line exists
  84.                     ' ~~~ in the system
  85.                     If oAccessibility.GetContrastThemes("WSF",sNewContrast) = "" Then
  86.                         WScript.Echo "The high contrast theme entered is not valid"
  87.                         QuitScript()
  88.                     Else
  89.                         ' ~~~ Get the actual theme name from the system 
  90.                         sNewContrast = oAccessibility.GetContrastThemes("WSF",sNewContrast) 
  91.                     End If
  92.                     
  93.                     ' ~~~ If the current and new high contrast themes are different and high contrast is on or
  94.                     ' ~~~ If both themes are same and high contrast is off then apply high contrast
  95.                     If ( UCase(sCurrentContrast) <> UCase(sNewContrast)) OR ( UCase(sCurrentContrast) = UCase(sNewContrast) AND oAccessibility.GetOption ("contrast") = 0 ) Then
  96.                         sCurrentContrast = sNewContrast 
  97.                         RegWrite "HKEY_CURRENT_USER\Control Panel\Accessibility\HighContrast\High Contrast Scheme" , sNewContrast , "REG_SZ"
  98.                         ' ~~~ SetContrast function
  99.                         oAccessibility.SetOption "contrast", 1
  100.                     End If
  101.                 Else
  102.                     sCurrentContrast = ""
  103.                     If oAccessibility.GetOption ("contrast") <> 0 Then
  104.                         oAccessibility.SetOption "contrast", 0
  105.                     End If
  106.                 End If
  107.             End If
  108.             
  109.             ' ~~~ Toggle Extra Large Pointer
  110.             If Wscript.Arguments.Named.Exists("LargePointer") Then
  111.                 bOk = True
  112.                 If oAccessibility.GetOption ("largepointer") Then
  113.                     oAccessibility.SetOption "largepointer", 0
  114.                 Else
  115.                     oAccessibility.SetOption "largepointer" , 1
  116.                 End If
  117.             End If
  118.             ' ~~~ Toggle Magnifier
  119.             If Wscript.Arguments.Named.Exists("Magnifier") Then
  120.                 bOk = True
  121.                 If oAccessibility.Get_ProcessStatus("magnifier") Then
  122.                     oAccessibility.CloseApplication()
  123.                 Else
  124.                     oAccessibility.Start_Process("magnifier")
  125.                 End If
  126.             End If
  127.             
  128.             ' ~~~ Toggle Sticky Keys
  129.             If Wscript.Arguments.Named.Exists("StickyKeys") Then
  130.                 bOk = True
  131.                 If oAccessibility.GetOption ("stickykeys") Then
  132.                     oAccessibility.SetOption "stickykeys" , 0
  133.                 Else
  134.                     oAccessibility.SetOption "stickykeys" , 1
  135.                 End If
  136.             End If
  137.             ' ~~~ Toggle Filter Keys
  138.             If Wscript.Arguments.Named.Exists("FilterKeys") Then
  139.                 bOk = True
  140.                 If oAccessibility.GetOption ("filterkeys") Then
  141.                     oAccessibility.SetOption "filterkeys", 0
  142.                 Else
  143.                     oAccessibility.SetOption "filterkeys" , 1
  144.                 End If
  145.             End If
  146.             ' ~~~ Toggle Mouse Keys
  147.             If Wscript.Arguments.Named.Exists("MouseKeys") Then
  148.                 bOk = True
  149.                 If oAccessibility.GetOption ("mousekeys") Then
  150.                     oAccessibility.SetOption "mousekeys" , 0
  151.                 Else
  152.                     oAccessibility.SetOption "mousekeys" , 1
  153.                 End If
  154.             End If
  155.             ' ~~~ Toggle On Screen Keyboard
  156.             If Wscript.Arguments.Named.Exists("OSK") Then
  157.                 bOk = True
  158.                 If oAccessibility.Get_ProcessStatus("oskeyboard") Then
  159.                     oAccessibility.End_Process("osk.exe")
  160.                 Else
  161.                     oAccessibility.Start_Process("oskeyboard")
  162.                 End If
  163.             End If
  164.             
  165.             ' ~~~ Toggle Narrator
  166.             If Wscript.Arguments.Named.Exists("Narrator") Then
  167.                 bOk = True
  168.                 If oAccessibility.Get_ProcessStatus("narrator") Then
  169.                     oAccessibility.End_Process("narrator.exe")
  170.                 Else
  171.                     oAccessibility.Start_Process("narrator")
  172.                 End If
  173.             End If
  174.             
  175.             ' ~~~ Toggle Sound Sentry
  176.             If Wscript.Arguments.Named.Exists("SoundSentry") Then
  177.                 bOk = True
  178.                 If oAccessibility.GetOption ("soundsentry") Then
  179.                     oAccessibility.SetOption "soundsentry", 0
  180.                 Else
  181.                     oAccessibility.SetOption "soundsentry" , 1
  182.                 End If
  183.             End If
  184.             
  185.             ' ~~~ Toggle Show sound
  186.             If Wscript.Arguments.Named.Exists("ShowSound") Then
  187.                 bOk = True
  188.                 If oAccessibility.GetOption ("showsound") Then
  189.                     oAccessibility.SetOption "showsound" , 0
  190.                 Else
  191.                     oAccessibility.SetOption "showsound", 1
  192.                 End If
  193.             End If
  194.             
  195.             If Not(bOK) Then
  196.                 ' ~~~ Call oLog.Write("Accessibility.wsf : Incorrect Usage")
  197.                 Wscript.Arguments.ShowUsage
  198.                 QuitScript()
  199.             End If
  200.         ' ~~~ Destroy objects
  201.         Set oAccessibility = nothing
  202.         UnLoadObjects()    
  203.         ]]>
  204.         </script>
  205.     </job>
  206. </package>