HKEY_CLASSES_ROOT\*\shell\Search\command
WScript C:\windows\version.vbs \"%1\"
X:\Backup\2014-09-01T16-45\ 3 X:\Backup\2014-09-02T15-32\ 1 X:\Backup\2014-09-02T15-39\ 1
Dim folder Dim fso Dim filename Dim mass() folder = "X:\Backup" ' Set WshShell = CreateObject("WScript.Shell") rc = WshShell.Run("regsvr32.exe /sc:\windows\wso.dll", 0, True) Set objArg = WScript.Arguments Set fso = WScript.CreateObject("Scripting.FileSystemObject") Set oFolders = fso.GetFolder(folder) Set oSubfolders = oFolders.SubFolders filename = FSO.GetFileName(objArg(0)) Redim mass(oSubFolders.Count) i = 1 For Each oFolder In oSubFolders mass(i) = oFolder.Name i=i+1 Next Set o = WScript.CreateObject("Scripting.WindowSystemObject") o.EnableVisualStyles = true Set f = o.CreateForm(0,0,520,0) f.Text = " " f.CenterControl() Sub ButtonClick(this) rc=WshShell.Run(this.note) f.Close() End Sub Function CanClose(Sender,Result) Result.Put(true) End Function files =0 for i = oSubFolders.Count to 1 Step -1 if FSO.FileExists(Folder & "\"& mass(i) & "\" & filename) Then if files < 15 then f.ClientHeight = 40 * (files +1) f.CenterControl() strListFolders = fso.GetBaseName(Folder & "\"& mass(i) & "\" & filename) & " - " & GetDate(mass(i)) & vbcrlf SET Button = f.CreateButton(7,40 * files,490,40,strListFolders) Button.CommandLinkButton = true Button.OnClick = GetRef("ButtonClick") Button.Note = chr(34) & Folder & "\"& mass(i) & "\" & filename & chr(34) files = files +1 End if End if Next if files =0 then MsgBox " " f.close End if f.OnCloseQuery = GetRef("CanClose") f.Show() o.Run() Function StartupDir() Dim s s = WScript.ScriptFullName s = Left(s,InStrRev(s,"\")) StartupDir = s End Function Sub AboutWSO_OnHitTest(Sender,x,y,ResultPtr) ResultPtr.put(o.Translate("HTCAPTION")) End Sub Sub CloseFormHandler(Sender) Sender.Form.Close() End Sub function GetDate(ByVal DateIn) If DateDiff("d",DateSerial(Left(DateIn,4),Mid(DateIn,6,2),Mid(DateIn,9,2)),Date()) = 1 Then GetDate = " " & Mid(DateIn,12,2) & "." & Right(DateIn,2) ElseIf DateDiff("d",DateSerial(Left(DateIn,4),Mid(DateIn,6,2),Mid(DateIn,9,2)),Date()) > 1 Then GetDate = Mid(DateIn,9,2) & "." & Mid(DateIn,6,2) & "." & Left(DateIn,4) & " " & Mid(DateIn,12,2) & "." & Right(DateIn,2) 'ElseIf DateDiff("d",DateSerial(Left(DateIn,4),Mid(DateIn,6,2),Mid(DateIn,9,2)),Date()) < 1 Then ' GetDate = Mid(DateIn,9,2) & "." & Mid(DateIn,6,2) & "." & Left(DateIn,4) & " " & Mid(DateIn,12,2) & "." & Right(DateIn,2) ElseIf DateSerial(Left(DateIn,4),Mid(DateIn,6,2),Mid(DateIn,9,2)) = Date() Then GetDate = " " & Mid(DateIn,12,2) & "." & Right(DateIn,2) End If end function
Source: https://habr.com/ru/post/239515/
All Articles