'* Mp, 28.12.2009 '* Iz PotBaze prebere Pot programa. '* Nato pogleda iz katere mape je bil ta VbScript pognan, od tam vzame program in ga skopira na Pot v ustrezno mapo. '* Če je lbTudiNaVirtual=True, potem kopira tudi na "C:\Documents and Settings\" + lsUserName + "\Finesa.Xp\...." Dim lbTudiNaVirtual, lsFilePath, lsOdKod, oFso, oTextFilein, lsReadLine, lsSelfZip, lsDir Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set oFso = CreateObject("Scripting.FileSystemObject") lsFilePath=left(WScript.ScriptFullName,Len(WScript.ScriptFullName) - len(WScript.ScriptName)) & "PotBaze.txt" IF oFso.FileExists(lsFilePath) = False Then lsFilePath="C:\Finesa.Xp\PotBaze.txt" End if Set oTextFileIn = oFso.OpenTextFile(lsFilepath, ForReading) lsReadLine = oTextFilein.ReadLine lsReadLine=RTrim(Mid(lsReadLine,InStr(1,lsReadLine,"#",vbTextCompare )+1)) IF Right(lsReadLine,1)="\" Then lsReadLine=Left(lsReadLine, Len(lsReadLine)-1) End IF lsOdKod=WScript.ScriptFullName IF Ucase(lsReadLine)=Ucase(Left(lsOdKod,Len(lsReadLine))) Then '* Kopiranje ni potrebno. WScript.Quit End IF IF (oFso.FolderExists(lsReadLine)) = False Then MsgBox "Pri kopiranju programa na mrežni disk je prišlo do napake, Mapa " & lsReadLine & " ne obstoja." WScript.Quit End If '* Pridobim UserName prijavljenega uporabnika Dim strDomain ,lsUserName, objNet Set objNet = WScript.CreateObject("WScript.Network") lsUserName = objNet.UserName '----------------------------------------------------------------------------------- '* MM 2.2.2010 '* Najprej dobim kaj je potrebno kopirati lsDir=RTrim(Mid(lsOdKod,1,len(lsOdKod)-10)) While InStr(1,lsDir,"\",vbTextCompare ) >0 lsDir=RTrim(Mid(lsdir,InStr(1,lsDir,"\",vbTextCompare )+1,len(lsDir))) Wend 'MsgBox "Kopiram: C:\Finesa.Xp\" + lsDir + "\ -> " + lsReadLine + "\" + lsDir '* kopiranje IF AliObstajaKateraDatoteka("C:\Finesa.Xp\" + lsDir + "\", "Ade")=False Then MsgBox "Nepravilen klic programa!" WScript.Quit End If NarediMapoCeJeNi lsReadLine + "\" + lsDir + "\" NarediMapoCeJeNi "C:\Finesa.Xp\" + lsDir + "\ScriptSQL" oFso.CopyFile "C:\Finesa.Xp\" + lsDir + "\*.Ade", lsReadLine + "\" + lsDir + "\", True IF AliObstajaKateraDatoteka("C:\Finesa.Xp\" + lsDir + "\", "Chm") = True Then oFso.CopyFile "C:\Finesa.Xp\" + lsDir + "\*.Chm", lsReadLine + "\" + lsDir + "\", True Else MsgBox "Manjkajoča datoteka: " + "C:\Finesa.Xp\" + lsDir + "\*.Chm Pokličite vzdrževalca programske opreme Finesa!" End If oFso.CopyFolder "C:\Finesa.Xp\" + lsDir + "\ScriptSQL", lsReadLine + "\" + lsDir + "\", True IF AliObstajaKateraDatoteka("C:\Documents and Settings\" + lsUserName + "\Finesa.Xp\" + lsDir + "\", "Ade") = True Then 'IF lbTudiNaVirtual=True Then '* Mp 22.12.2009, da kopira na Virtulano postajo oFso.CopyFile "C:\Finesa.Xp\" + lsDir + "\*.Ade", "C:\Documents and Settings\" + lsUserName + "\Finesa.Xp\" + lsDir + "\", True IF AliObstajaKateraDatoteka("C:\Finesa.Xp\" + lsDir + "\", "Chm") = True Then oFso.CopyFile "C:\Finesa.Xp\" + lsDir + "\*.Chm", "C:\Documents and Settings\" + lsUserName + "\Finesa.Xp\" + lsDir + "\", True End If oFso.CopyFolder "C:\Finesa.Xp\" + lsDir + "\ScriptSQL", "C:\Documents and Settings\" + lsUserName + "\Finesa.Xp\" + lsDir + "\", True End IF '* END MM 2.2.2010 '----------------------------------------------------------------------------------- '* Zaprem WinZipSelfExtract, če se ni že sam sComputer = "." Set oWmi = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & sComputer & "\root\cimv2") Set colProcessList = oWmi.ExecQuery ("Select * from Win32_Process Where Name = '" & sProcessName & "'") For Each oProcess in colProcessList oProcess.Terminate() Next 'If Err.Number<>0 THEN ' MsgBox "Pri kopiranju programa na mrežni disk (" & lsReadLine & ") je prišlo do napake." ' WScript.Quit 'End IF MsgBox "Program je posodobljen.",,"Posodobitev programa z www.finesa.si" Function NarediMapoCeJeNi(argMapa) IF oFso.FolderExists( argMapa) = False Then oFso.CreateFolder(argMapa) End If End Function Function AliObstajaKateraDatoteka(argMapa, argKoncnica) Dim Files, File AliObstajaKateraDatoteka=False IF oFso.FolderExists( argMapa) = True Then Set Files = oFso.GetFolder(argMapa).Files If Files.Count <> 0 Then For Each File In Files IF UCase(ofso.GetExtensionName(File)) = UCase(argKoncnica) Then AliObstajaKateraDatoteka=True Exit Function End If Next End If End If End Function