Jump to content
Sign in to follow this  

Script to disable offline files

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_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 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

Share this post

Link to post
Share on other sites

maybe this can help get you started

Local $RUNDLL32 = @SystemDir & "\rundll32.exe"
 Run($RUNDLL32 & " shell32.dll,Options_RunDLL 0")
 WinWait("Folder Options")

i would use control send if possible



Share this post

Link to post
Share on other sites


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

Share this post

Link to post
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
Sign in to follow this