mozilla:abpxfiles:vbs:stablemaker
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
mozilla:abpxfiles:vbs:stablemaker [2013/11/09 19:40] – gfsadministrator | mozilla:abpxfiles:vbs:stablemaker [2017/01/30 10:34] (current) – gfsadministrator | ||
---|---|---|---|
Line 9: | Line 9: | ||
In versione 0.1 già perfettamente funzionante, | In versione 0.1 già perfettamente funzionante, | ||
- | Facendo clic sul nome dello script | + | Ho spostato lo script |
- | + | ||
- | <file vb Stable-Maker_0.1.vbs> | + | |
- | ' ABP X FILES Stable Maker 0.1 | + | |
- | ' GSolone - Ultima modifica: 20130905 rev0 | + | |
- | ' | + | |
- | ' Lo script modifica la lista filtri esportata dall' | + | |
- | ' | + | |
- | ' STORICO MODIFICHE | + | |
- | ' 0.1 rev0- stadio iniziale di sviluppo. | + | |
- | ' | + | |
- | ' Sviluppo: Giovanni F. -Gioxx- Solone (dev@gfsolone.com) | + | |
- | ' Testato su: Windows 7 Pro Sp1 | + | |
- | ' | + | |
- | ' Non toccare nulla oltre questa riga! | + | |
- | ' DO NOT touch anything below this line! | + | |
- | + | ||
- | ' Variables and constants definition | + | |
- | Dim i, objFile, objFSO, strFile, strMsg | + | |
- | Dim objWMIService, | + | |
- | Const ForReading = 1, ForWriting = 2, ForAppending = 8 | + | |
- | + | ||
- | ' Date and time | + | |
- | strComputer = " | + | |
- | Set objWMIService = GetObject(" | + | |
- | Set colItems = objWMIService.ExecQuery(" | + | |
- | For Each objItem in colItems | + | |
- | dtmLocalTime = objItem.LocalDateTime | + | |
- | dtmMonth = Mid(dtmLocalTime, | + | |
- | dtmDay = Mid(dtmLocalTime, | + | |
- | dtmYear = Left(dtmLocalTime, | + | |
- | dtmHour = Mid(dtmLocalTime, | + | |
- | dtmMinutes = Mid(dtmLocalTime, | + | |
- | dtmSeconds = Mid(dtmLocalTime, | + | |
- | Next | + | |
- | update = dtmYear & dtmMonth & dtmDay & dtmHour & dtmMinutes | + | |
- | lastmodified = dtmDay & " | + | |
- | ' DEBUG: show $datetime | + | |
- | ' | + | |
- | + | ||
- | ' Expand Environment | + | |
- | ' Create const' | + | |
- | Dim WshS | + | |
- | Set WshS = WScript.CreateObject(" | + | |
- | Set fso = CreateObject(" | + | |
- | usrProfile = WshS.ExpandEnvironmentStrings(" | + | |
- | strFile = usrProfile & " | + | |
- | ' DEBUG: Message to prove my string contains the path to my profile | + | |
- | ' | + | |
- | ' | + | |
- | + | ||
- | ' Staging filtri.txt is on my Desktop? | + | |
- | Set objFSO = CreateObject(" | + | |
- | If objFSO.FileExists(strFile) Then | + | |
- | Else | + | |
- | | + | |
- | | + | |
- | End If | + | |
- | + | ||
- | ' Remove line 1 to 2, default header of Adblock Plus export | + | |
- | For i = 1 To 2 | + | |
- | DeleteLine strFile, "", | + | |
- | | + | |
- | + | ||
- | ' Add list header (ABP X Files Stable) | + | |
- | Set objFSO = CreateObject(" | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | strContents = objFile.ReadAll | + | |
- | objFile.Close | + | |
- | + | ||
- | strFirstLine = " | + | |
- | strNewContents = strFirstLine & vbCrLf & strContents | + | |
- | + | ||
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | objFile.WriteLine strNewContents | + | |
- | objFile.Close | + | |
- | + | ||
- | ' Remove empty lines at the end of file! | + | |
- | Set objFSO = CreateObject(" | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | Do Until objFile.AtEndOfStream | + | |
- | strLine = objFile.Readline | + | |
- | strLine = Trim(strLine) | + | |
- | If Len(strLine) > 0 Then | + | |
- | strNewContents = strNewContents & strLine & vbCrLf | + | |
- | End If | + | |
- | Loop | + | |
- | objFile.Close | + | |
- | Set objFile = objFSO.OpenTextFile(strFile, | + | |
- | objFile.Write strNewContents | + | |
- | objFile.Close | + | |
- | + | ||
- | ' Move updated X Files to Dropbox (and overwrite old file) | + | |
- | ' (from %UserProfile%\Desktop\filtri.txt to C: | + | |
- | Const OverwriteExisting = TRUE | + | |
- | Set objFSO = CreateObject(" | + | |
- | strDropbox = " | + | |
- | If objFSO.FileExists(strFile) Then | + | |
- | | + | |
- | Else | + | |
- | | + | |
- | End If | + | |
- | + | ||
- | ' Open the file (verification process) and delete " | + | |
- | strDropboxFile = " | + | |
- | CreateObject(" | + | |
- | objFSO.DeleteFile strFile, True | + | |
- | + | ||
- | Sub Run(ByVal sFile) | + | |
- | ' Variables definition | + | |
- | Dim shell | + | |
- | Set shell = CreateObject( " | + | |
- | shell.Run Chr(34) & sFile & Chr(34), 1, false | + | |
- | Set shell = Nothing | + | |
- | End Sub | + | |
- | + | ||
- | Sub DeleteLine(strFile, | + | |
- | 'Use strFile = " | + | |
- | 'Use strKey = "John Doe" | + | |
- | 'Use strKey = "" | + | |
- | 'Use LineNumber = " | + | |
- | 'Use LineNumber = " | + | |
- | 'Use CheckCase = " | + | |
- | 'Use CheckCase = " | + | |
- | Const ForReading=1: | + | |
- | Dim objFSO, | + | |
- | Set objFSO=CreateObject(" | + | |
- | Set objFile=objFSO.OpenTextFile(strFile, | + | |
- | Do Until objFile.AtEndOfStream | + | |
- | | + | |
- | If CheckCase=0 then strLineCase=ucase(strLine): | + | |
- | If LineNumber=objFile.Line-1 or LineNumber=0 then | + | |
- | If instr(strLine, | + | |
- | | + | |
- | Else | + | |
- | | + | |
- | End If | + | |
- | | + | |
- | strNewFile=strNewFile& | + | |
- | End If | + | |
- | Loop | + | |
- | objFile.Close | + | |
- | Set objFSO=CreateObject(" | + | |
- | Set objFile=objFSO.OpenTextFile(strFile, | + | |
- | objFile.Write strNewFile | + | |
- | objFile.Close | + | |
- | End Sub | + | |
- | </ | + | |
- | + | ||
- | ===== Archivio versioni ===== | + | |
- | + | ||
- | Non ci sono ancora vecchie versioni di questo script. | + |
mozilla/abpxfiles/vbs/stablemaker.1384022443.txt.gz · Last modified: 2013/11/09 19:40 by gfsadministrator