Запуск триальной проги zip
Option Explicit
Dim remotedate, diff, newnow, newdate, newtime, ddiff, sdiff, ws, MyDate, my_path, ret, MyPath, sPathSpec
newdate = FormatDateTime("2005-11-10", vbShortDate)
MyDate = FormatDateTime("2006-02-09", vbShortDate)
‘вычисляем разницу между сегодня и датой,когда прога работала в часах
ddiff = DateDiff("h", Date, newdate)
'ddiff = DateDiff("h", mydate, newdate)
WSH.Echo "diff " & ddiff
'Split out time.
'shift time 8 hours back
‘отматываем разницу
doResetTime ddiff, 0
Set ws = CreateObject("WScript.Shell")
my_path = "E:/Program Files/PLSQL Developer/" ' & filename
ws.CurrentDirectory = my_path
‘запускаем прогу
ws.Run "PLSQLDev.exe"
'E:\Program Files\PLSQL Developer\PLSQLDev.exe
'~~~ do some copying of CAD-files here ~~~
'10.11.2005
'reset time to normal again
‘ждем 1с пока запуститься
WScript.Sleep 1000
'ws.SendKeys "Welcome Tech-Ezo Round23"
‘приматываем разницу – все..
doResetTime -ddiff, 0
'Add local time zone offset to GMT returned from USNO server.
'remotedate = DateAdd("n", timeoffset, gmttime)
'Calculate seconds difference betweed remote and local.
'diff = DateDiff("s", localdate, remotedate)
'Adjust for difference and lag to get actual time.
'newnow = DateAdd("s", diff + lag, now)
's = FormatDateTime(Now, vbShortDate) 's = "2000-12-30"
'newnow=FormatDateTime("2005-11-10", vbShortDate)
'WSH.Echo "date2work "&newnow
'Split out date and calculate any difference.
'newdate = FormatDateTime(DateValue(newnow))
'ddiff = DateDiff("d", Date, newdate)
'strValue = DateAdd("d", -1, Date() )
'WSH.Echo "diff "&ddiff
'Split out time.
'shift time 8 hours back
'doResetTime -1008, 0
'~~~ do some copying of CAD-files here ~~~
'10.11.2005
'reset time to normal again
'doResetTime +1008, 0
'Dim dt As String
'dt = Format(Calendar1.Value, "ddmmyyyy")
'Main
'WSH.Echo FileCreated("E:\Program Files\PLSQL Developer\PLSQLDev.exe")
'WSH.Echo "done"
'Public Function GetDateAndTime() as String
' GetDateAndTime = CStr(Now)
'End Function
Sub Main()
Const TITLE = "AnzioWin Test"
Dim MyDate
GetDate MyDate
MsgBox "Today is " & MyDate, vbInformation, TITLE
End Sub
Sub GetDate(X)
X = CStr(Date)
End Sub
Sub doResetTime(intHours, intMinutes)
Dim dateNew 'As String
Dim timeNew 'As String
Dim timeChanged 'As Date
Dim ws
timeChanged = DateAdd("h", intHours, Now())
timeChanged = DateAdd("n", intMinutes, timeChanged)
Call getTimeStrings(timeChanged, timeNew, dateNew)
Set ws = CreateObject("WScript.Shell")
ws.Run "cmd /c date " & dateNew & " & time " & timeNew, 7, True
'for testing/demo:
WSH.Echo "new time:", Now
End Sub
Sub getTimeStrings(fullDate, timeNew, dateNew)
'create date and time *string* according to NLS (e.g. dd.mm.yyyy for germany)
dateNew = Day(fullDate) & "." & Month(fullDate) & "." & Year(fullDate)
timeNew = Hour(fullDate) & ":" & Minute(fullDate)
End Sub
Function FileCreated(Fname)
Dim fs, f
FileCreated = ""
Set fs = CreateObject("Scripting.FileSystemObject")
If fs.FileExists(Fname) = True Then
Set f = fs.GetFile(Fname)
FileCreated = f.DateCreated
End If
Set f = Nothing
Set fs = Nothing
End Function