Batya

|
Posted: Mon Jul 31, 2006 11:34 Post subject: |
|
|
Всем привет
Скрипт исправил:
Code: | If Wscript.Arguments.Count < 3 Then
MsgBox "Неправильно заданы параметры. Параметров должно быть не менее 3." & chr(13) & _
"Парметры для вызова из TotalCmd:" & chr(13) & _
"startset.vbs {Путь\nscopy.exe} %L "%T" {Параметры}", _
vbOKOnly + vbCritical, _
"Ошибка!"
Wscript.Quit()
End If
Dim FSO, StreamFile, WSH
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WSH = CreateObject("WScript.Shell")
Dim Selected, Exe, Arg, Args, Target
Exe = Wscript.Arguments(0)
Target = Wscript.Arguments(2)
If Not FSO.FolderExists(Target) Then
MsgBox "Неправильно заданы параметры." & chr(13) & _
"Третьим параметром должна быть папка назначения (в TotalCmd можно написать %T).", _
vbOKOnly + vbCritical, _
"Ошибка!"
Set FSO = Nothing
Set WSH = Nothing
Wscript.Quit()
End If
For i = 4 To Wscript.Arguments.Count
Args = Args & " " & Wscript.Arguments(i - 1)
Next
Set StreamFile = FSO.OpenTextFile(WScript.Arguments(1), 1)
Do While Not StreamFile.AtEndOfStream
Selected = StreamFile.ReadLine
If FSO.FileExists(Selected) Then
WSH.Run Exe & " """ & Selected & """ """ & Target & _
FSO.GetFileName(Selected) & """" & Args
End If
If FSO.FolderExists(Selected) Then
FolderProcess FSO.GetFolder(Selected), Target & FSO.GetBaseName(Selected) & "\"
End If
Loop
Set FSO = Nothing
Set WSH = Nothing
Set StreamFile = Nothing
Wscript.Quit()
Function FolderProcess(CurrFolder, TargetFolder)
Dim sf, f
If Not FSO.FolderExists(TargetFolder) Then
FSO.CreateFolder(TargetFolder)
End If
For Each sf in CurrFolder.SubFolders
FolderProcess sf, TargetFolder & sf.Name & "\"
Next
For Each f in CurrFolder.Files
WSH.Run Exe & " """ & f & """ """ & TargetFolder & _
FSO.GetFileName(f) & """" & Args
Next
End Function |
Кнопка для вызова:
Code: | TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Utils\WHS\startset.vbs %COMMANDER_PATH%\Utils\NonStopCopy\nscopy.exe
%L "%T" /e
%COMMANDER_PATH%\Icons\X-Qute.icl
Копирование с помощью NonStopCopy
-1
|
Last edited by Batya on Mon Jul 31, 2006 13:36; edited 2 times in total |
|