Здравствуйте Уважаемые программисты!
Помогите пожалуйста оптимизировать код vbs для исключения повторов задания свойств (Set):
Код:
Dim nanoPRFL, nanoADVR
nanoPRFL = ThisDrawing.GetVariable("cprofile")
nanoADVR = ThisDrawing.GetVariable("acadver")
Const HKCU = &H80000001
strKeyPath1 = "SOFTWARE\Nanosoft\nanoCAD x64\" & nanoADVR & "\Profiles\" & nanoPRFL & "\IO\SaveProjects"
strKeyPath2 = "SOFTWARE\Nanosoft\nanoCAD x64\" & nanoADVR & "\Profiles\" & nanoPRFL & "\TemplateDoc"
strKeyPath3P1 = "SOFTWARE\Nanosoft\nanoCAD x64\" & nanoADVR & "\Profiles\" & nanoPRFL & "\Papers\Paper00000001"
strKeyPath3P2 = "SOFTWARE\Nanosoft\nanoCAD x64\" & nanoADVR & "\Profiles\" & nanoPRFL & "\Papers\Paper00000002"
strKeyPath3P3 = "SOFTWARE\Nanosoft\nanoCAD x64\" & nanoADVR & "\Profiles\" & nanoPRFL & "\Papers\Paper00000003"
strComputer = "."
iValues1 = Array(5, 0, 0, 0, 3, 0, 0, 0)
iValues2 = Array(5, 0, 0, 0, 1, 0, 0, 0)
iValues3 = Array(1, 0, 0, 0, 0, 0, 0, 0)
Set oReg1 = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
oReg1.CreateKey HKEY_CURRENT_USER, strKeyPath1
strKeyPath1 = "SOFTWARE\Nanosoft\nanoCAD x64\" & nanoADVR & "\Profiles\" & nanoPRFL & "\IO\SaveProjects"
BinaryValueNameDFFS = "DefaultFormatForSave"
BinaryValueNameUSAF = "UseSaveAsFormat"
oReg1.SetBinaryValue HKCU, strKeyPath1, BinaryValueNameDFFS, iValues1
oReg1.SetBinaryValue HKCU, strKeyPath1, BinaryValueNameUSAF, iValues1
Set oReg2 = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
oReg2.CreateKey HKEY_CURRENT_USER, strKeyPath2
strKeyPath2 = "SOFTWARE\Nanosoft\nanoCAD x64\" & nanoADVR & "\Profiles\" & nanoPRFL & "\TemplateDoc"
BinaryValueNameUTF = "UseTemplateFile"
oReg2.SetBinaryValue HKCU, strKeyPath2, BinaryValueNameUTF, iValues2
Set oReg3 = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
oReg3.CreateKey HKEY_CURRENT_USER, strKeyPath3P1
strKeyPath3P1 = "SOFTWARE\Nanosoft\nanoCAD x64\" & nanoADVR & "\Profiles\" & nanoPRFL & "\Papers\Paper00000001"
BinaryValueNameU1 = "Used"
oReg3.SetBinaryValue HKCU, strKeyPath3P1, BinaryValueNameU1, iValues3
Set oReg4 = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
oReg4.CreateKey HKEY_CURRENT_USER, strKeyPath3P2
strKeyPath3P2 = "SOFTWARE\Nanosoft\nanoCAD x64\" & nanoADVR & "\Profiles\" & nanoPRFL & "\Papers\Paper00000002"
BinaryValueNameU2 = "Used"
oReg4.SetBinaryValue HKCU, strKeyPath3P2, BinaryValueNameU2, iValues3
Set oReg5 = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
oReg5.CreateKey HKEY_CURRENT_USER, strKeyPath3P3
strKeyPath3P3 = "SOFTWARE\Nanosoft\nanoCAD x64\" & nanoADVR & "\Profiles\" & nanoPRFL & "\Papers\Paper00000003"
BinaryValueNameU3 = "Used"
oReg5.SetBinaryValue HKCU, strKeyPath3P3, BinaryValueNameU3, iValues3
Заранее спасибо!