Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Новый участник


Сообщения: 2
Благодарности: 0

Профиль | Отправить PM | Цитировать


часто слетали вкладки последнее время паэтому наваял вот
Код: Выделить весь код
' VBScript source code

Set objShell=Createobject("Wscript.Shell")
strFile =  objShell.ExpandEnvironmentStrings("%APPDATA%\Opera\Opera\sessions\autosave.win")
strFileSlash = Replace(strFile, "\", "\\")

intInterval = "2"
strDrive = "C:" 

strFilename = "autosave"
strExtension = "win"

strComputer = "." 

' Connect to WMI

Set objWMIService = GetObject( "winmgmts:" &_ 
    "{impersonationLevel=impersonate}!\\" &_ 
    strComputer & "\root\cimv2" )

' The query string

strQuery =  _
    "Select * From __InstanceOperationEvent" _
    & " Within " & intInterval _
    & " Where Targetinstance Isa 'CIM_DataFile'" _
    & " And TargetInstance.Name='" & strFileSlash & "'"_
'    & " And TargetInstance.Drive='" & strDrive & "'"_
' & " And TargetInstance.Path='" & strFolder & "'" _
'& " And TargetInstance.Filename='" & strFilename & "'" _
'& " And TargetInstance.Extension='" & strExtension & "'" _



' Execute the query

Set colEvents = _
    objWMIService. ExecNotificationQuery (strQuery) 

' The loop

Set objShell = WScript.CreateObject("WScript.Shell")


Do 
    ' Wait for the next event  
    ' Get SWbemEventSource object
    ' Get SWbemObject for the target instance
    
    Set objEvent = colEvents.NextEvent()
    Set objTargetInst = objEvent.TargetInstance
    
    ' Check the class name for SWbemEventSource
    ' It cane be one of the following:
    ' - __InstanceCreationEvent
    ' - __INstanceDeletionEvent
    ' - __InstanceModificationEvent
    
Return = objShell.Run("3.bat", 0, true)


    Select Case objEvent.Path_.Class 
        
        ' If it is file creation or deletion event
        ' just echo the file name
        
        
	Case "__InstanceCreationEvent" 
            WScript.Echo "Created: " & objTargetInst.Name 

        Case "__InstanceDeletionEvent" 
            WScript.Echo "Deleted: " & objTargetInst.Name 
        
        ' If it is file modification event, 
        ' compare property values of the target and previous
        ' instance and echo the properties that have changed
        
'        Case "__InstanceModificationEvent" 
'        
'            Set objPrevInst = objEvent.PreviousInstance
'        
'            For Each objProperty In objTargetInst.Properties_
'                If objProperty.Value <> _
'                objPrevInst.Properties_(objProperty.Name) Then
'                    WScript.Echo "Changed:        " _
'                        & objTargetInst.Name
'                    WScript.Echo "Property:       " _
'                        & objProperty.Name
'                    WScript.Echo "Previous value: " _
'                        & objPrevInst.Properties_(objProperty.Name)
'                    WScript.Echo "New value:      " _
'                        & objProperty.Value
'                    WScript.Echo
'
'                End If            
 '           Next

    End Select 

Loop
Код: Выделить весь код
set opappdatases=%APPDATA%\Opera\Opera\sessions
pushd %opappdatases%

if not exist "%opappdatases%\autosave.win" goto :exit
if not exist "%opappdatases%\autosave.win.bak" goto :exit
for /f "skip=1 delims=." %%d in ('wmic OS Get LocalDateTime') do copy /b /V /Y autosave.win autosave_%%d.win
for /f "skip=27" %%f in ('dir /b/o-d/tc autosave_??????????????.win') do del /q %%f


:exit

popd
первое код на VBScript - для детекта изменений - второе собственно сам батник бекапа
скрипт пока сыроват - но может использоватся уже
кидаем в папочку %APPDATA%\Opera\Opera\sessions\
оба файла и ярлык на первый в автозагрузку
и удобно получаем историю с модификациями вкладок

Отправлено: 23:15, 27-09-2012 | #7