mistx
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Nagual ViSiToR есть скрипт, который ищит файлы по расширению и записывает их в файл. что необходимо дописать, чтобы он их конвертировал еще в добавок? On error Resume Next Dim oWmi Dim oRef Dim fso,f strTitle="File Type Search" strType=InputBox("What type of file do you want to look for? Do NOT use a period.",strTitle,"vbs") If strType="" Then wscript.echo "Nothing entered or you cancelled" wscript.quit End If strDrive=InputBox("What local drive do you want to search? Do NOT use a trailing \",strTitle,"c:") If strDrive="" Then wscript.echo "Nothing entered or you cancelled" wscript.quit End If 'trim strDrive just in case the user added a \ strDrive=Left(strDrive,2) strOutput=InputBox("Enter full path and filename for the CSV file. Existing files will " & _ "be overwritten.",strTitle,"c:\" & strType & "-query.csv") If strOutput="" Then wscript.echo "Nothing entered or you cancelled" wscript.quit End If strQuery="Select Name,CreationDate,LastAccessed,LastModified," & _ "FileSize,Extension,Drive FROM CIM_DATAFILE WHERE Extension='" & strType & _ "' AND Drive='" & strDrive & "'" Set fso=CreateObject("Scripting.FileSystemObject") If fso.FileExists(strOutput) Then fso.DeleteFile(strOutput) Set f=fso.CreateTextFile(strOutput) If Err.Number Then wscript.echo "Could not create output file " & strOutput wscript.quit End If Set oWmi=GetObject("winmgmts:") If Err.Number Then strErrMsg= "Error connecting to WINMGMTS" & vbCrlf strErrMsg= strErrMsg & "Error #" & err.number & " [0x" & CStr(Hex(Err.Number)) &"]" & vbCrlf If Err.Description <> "" Then strErrMsg = strErrMsg & "Error description: " & Err.Description & "." & vbCrlf End If Err.Clear wscript.echo strErrMsg wscript.quit End If Set oRef=oWmi.ExecQuery(strQuery) If Err.Number Then strErrMsg= "Error connecting executing query!" & vbCrlf strErrMsg= strErrMsg & "Error #" & err.number & " [0x" & CStr(Hex(Err.Number)) &"]" & vbCrlf If Err.Description <> "" Then strErrMsg = strErrMsg & "Error description: " & Err.Description & "." & vbCrlf End If Err.Clear wscript.echo strErrMsg wscript.quit End If wscript.echo "Working ...." f.Writeline "FilePath,Size(bytes),Created,LastAccessed,LastModified" For Each file In oRef f.Writeline file.Name & "," & file.FileSize & "," & ConvWMITime(file.CreationDate) & _ "," & ConvWMITime(file.LastAccessed) & "," & ConvWMITime(file.LastModified) Next f.Close wscript.echo "Finished. See " & strOutput & " for results" Set oWmi=Nothing Set oRef=Nothing Set fso=Nothing Set f=Nothing wscript.quit '************************************************************************************ ' Convert WMI Time Function '************************************************************************************ Function ConvWMITime(wmiTime) On Error Resume Next yr = left(wmiTime,4) mo = mid(wmiTime,5,2) dy = mid(wmiTime,7,2) tm = mid(wmiTime,9,6) ConvWMITime = mo & "/" & dy & "/" & yr & " " & FormatDateTime(left(tm,2) & _ ":" & Mid(tm,3,2) & ":" & Right(tm,2),3) End Function 'EOF добавлено для открытия и сохранения разобрался с функцией Const wdFormatRTF=6 Set oWord = WScript.CreateObject("Word.Application") oWord.Visible=True oWord.Documents.Open "c:\test\junk.doc" set oDoc=oWord.ActiveDocument oDoc.SaveAs "c:\test\junk.rtf",wdFormatRTF oWord.DisplayAlerts=False oWord.ActiveDocument.Close oWord.Quit Помогите плиз объединить 2 скрипта для окончательного результата | Всего записей: 771 | Зарегистр. 13-01-2005 | Отправлено: 13:11 17-09-2008 | Исправлено: mistx, 13:45 17-09-2008 |
|