diff -r 1b55a5510213 -r 091708199d17 toggle_if.vbs --- a/toggle_if.vbs Thu Jan 21 14:04:22 2010 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -if WScript.Arguments.Count <> 2 then - wscript.quit -end if - -Dim sConnectionName -if WScript.Arguments.Item(0) = "lan" then - sConnectionName = "ローカル エリア接続" -else - sConnectionName = "ワイヤレス ネットワーク接続" -end if - -Dim sVerb -if WScript.Arguments.Item(1) = "enable" then - sVerb = "有効にする(&A)" -else - sVerb = "無効にする(&B)" -end if - - -Const ssfCONTROLS = 3 -Const sConPaneName = "ネットワーク接続" - -set shellApp = createobject("shell.application") -set oControlPanel = shellApp.Namespace(ssfCONTROLS) -set oNetConnections = nothing - -for each folderitem in oControlPanel.items - if folderitem.name = sConPaneName then - set oNetConnections = folderitem.getfolder: exit for - end if -next - -if oNetConnections is nothing then - wscript.quit -end if - -set oLanConnection = nothing -for each folderitem in oNetConnections.items - if lcase(folderitem.name) = lcase(sConnectionName) then - set oLanConnection = folderitem: exit for - end if -next - -if oLanConnection is nothing then - wscript.quit -end if - -for each verb in oLanConnection.verbs - if verb.name = sVerb then - verb.Doit - WScript.Sleep 2000 - end if -next