Option Explicit
Dim FSO, TCS, F1, F2, Str1, Str2, Str3, Str4, Text1, Text2
Set FSO = CreateObject("Scripting.FileSystemObject")
Set TCS = CreateObject("TCScript.Helper")
F1 = "%COMMANDER_PATH%\Bars\1.bar"
Str1 = "button19=wcmicons.dll,80"
Str2 = "button19=wcmicons.dll,81"
F2 = "%COMMANDER_PATH%\WinCmd.ini"
Str3 = "[Associations]"
Str4 = "[-Associations]"
F1 = FSO.GetAbsolutePathName(CreateObject("WScript.Shell").ExpandEnvironmentStrings(F1))
F2 = FSO.GetAbsolutePathName(CreateObject("WScript.Shell").ExpandEnvironmentStrings(F2))
Text1 = FSO.OpenTextFile(F1, 1).ReadAll
Text2 = FSO.OpenTextFile(F2, 1).ReadAll
If bCheck Then
Text1 = Replace(Text1, Str2, Str1, 1, -1, 1)
Text2 = Replace(Text2, Str4, Str3, 1, -1, 1)
Else
Text1 = Replace(Text1, Str1, Str2, 1, -1, 1)
Text2 = Replace(Text2, Str3, Str4, 1, -1, 1)
End If
FSO.OpenTextFile(F1, 2).Write Text1
FSO.OpenTextFile(F2, 2).Write Text2
With TCS
.LockTC True
.Pause = 100
.SendCommand "cm_ButtonConfig"
.SendKeystroke "{Tab}"
.SendKeystroke "{Enter}"
.SendCommand "cm_InternalAssociate"
.SendKeystroke "{Enter}"
End With
Set TCS = Nothing
Set FSO = Nothing
WScript.Quit
Function bCheck()
Dim sFile
sFile=WScript.ScriptFullName
bCheck=TCS.INIRead(sFile, "Ass", "Line", 0)
TCS.INIWrite sFile, "Ass", "Line", Not bCheck
End Function
[Ass]
Line =-1 |