Parazitif
Newbie | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору
Код: 'VBS ' MSComDlg.CommonDialog component registration ' w7 32bit C:\Windows\System32\cmd.exe C:\Windows\System32\regsvr32.exe C:\Windows\System32\comdlg32.ocx ' w7 64bit C:\Windows\SysWOW64\cmd.exe C:\Windows\SysWOW64\regsvr32.exe C:\Windows\SysWOW64\comdlg32.ocx ' [HKEY_CLASSES_ROOT\Licenses\4D553650-6ABE-11cf-8ADB-00AA00C00905] ' @="gfjmrfkfifkmkfffrlmmgmhmnlulkmfmqkqj" ' ' run script in w7 64bit system ' w7 64bit C:\Windows\SysWOW64\wscript.exe c:\testscript.vbs Set objFile = CreateObject("DSOFile.OleDocumentProperties") Set OpenDialog = CreateObject("MSComDlg.CommonDialog") ' Microsoft Common Dialog Control FileChangedCount = 0 With OpenDialog .DialogTitle = "Откройте нужный Вам файл(ы)" .InitDir = "C:\" .Filter = "Модели Solidworks (*.sldlfp,*.sldasm)|*.sldlfp;*.sldasm" ' Расширения файлов .FilterIndex = 1 .Flags = 2621952 .MaxFileSize =32000 .ShowOpen Filename = .Filename End With If (Len(OpenDialog.FileName)= 0) Then msgbox "Файлы не выбраны!" End If files = Split(OpenDialog.Filename, vbNullChar) count_files = UBound(files) If count_files = 0 Then ' only one file select wscript.echo files(0) objFile.Open(files(0)) AddCustomProperty Else for i=1 to count_files ' multiple file select wscript.echo files(0) & "\" & files(i) objFile.Open(files(0) & "\" & files(i)) AddCustomProperty next End If Msgbox "Выполнено." &chr(13)& "Количество обработанных файлов: "& FileChangedCount Sub AddCustomProperty ' remove if already exist For Each objProperty in objFile.CustomProperties if objProperty.Name = "Наименование" Then objProperty.Remove objFile.Save end if Next ' set new properties objFile.CustomProperties.Add "Наименование", 4 objFile.Save name = Split(objFile.Name, ".") Set objProperty = objFile.CustomProperties.Item("Наименование") objProperty.Value = "Уголок " & Chr(34) & "B@Sketch1@" & name(0) & ".SLDPRT" & Chr(34) objFile.Save objFile.close FileChangedCount = FileChangedCount + 1 End Sub |
| Всего записей: 19 | Зарегистр. 17-06-2013 | Отправлено: 11:57 11-10-2014 | Исправлено: Parazitif, 11:58 11-10-2014 |
|