Jump to content

Script to disable offline files


mbailey
 Share

Recommended Posts

Option Explicit

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'' File: wxp_disableOfflineFiles.vbs

'' Created: Wed 12/14/2005 17:32:44.36

'' Author: mikeb

''

'' Modification history:

'' Date Author Desc

'' ---- ------ ----

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Const C_s_WINDOWTITLE = "Folder Options"

Const C_s_TAB_CONTROL = "12320"

Const C_s_CTRL_SHIFT_TAB = "+^{TAB}"

Const C_s_ID_ENABLE_OFFLINE_FILES_CHECKBOX = "2033"

Const C_s_UNCHECK_COMMAND = "UnCheck"

Const C_s_ID_OK = "1"

Call WScript.Quit( Main() )

Function Main()

Dim oShell

Dim oAutoIt

Set oShell = WScript.CreateObject("WScript.Shell")

Set oAutoIt = WScript.CreateObject("AutoItX3.Control")

Call WScript.Echo("Running folder control panel")

Call oShell.Run("control.exe folders", 1, False)

Call WScript.Echo("Waiting for " & C_s_WINDOWTITLE & " dialog")

Call oAutoIt.WinWaitActive(C_s_WINDOWTITLE, "")

Call WScript.Echo("Sending CTRL+SHIFT+TAB to tab control (Offline Files tab)")

Call oAutoIt.ControlSend(C_s_WINDOWTITLE, "", C_s_TAB_CONTROL, C_s_CTRL_SHIFT_TAB, 0)

Call WScript.Echo("Unchecking 'Enable Offline Files' checkbox")

Call oAutoIt.ControlCommand(C_s_WINDOWTITLE, "", C_s_ID_ENABLE_OFFLINE_FILES_CHECKBOX, C_s_UNCHECK_COMMAND, "")

Call WScript.Echo("Clicking OK")

Call oAutoIt.ControlClick(C_s_WINDOWTITLE, "", C_s_ID_OK)

Call WScript.Echo("Waiting for " & C_s_WINDOWTITLE & " dialog to close")

Call oAutoIt.WinWaitClose(C_s_WINDOWTITLE, "")

Call WScript.Echo("Done.")

Set oAutoIt = Nothing

Set oShell = Nothing

Main = 0

End Function

Link to comment
Share on other sites

@mbailey

Why do you keep making your scripts in VBScript using the AutoItX control? Why not just code in AutoIt? What exactly are you gaining, or think you're gaining, by doing it this way? What I mean is that AutoIt is at least as easy to learn as VBScript, so if you have a grasp on VBScript (which it appears you do) then you should have no trouble at all learning AutoIt.

Please don't read this as an attack. I'm just curious.

Edited by c0deWorm

My UDFs: ExitCodes

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...