Hiya Folks
if anyone could answer my question, it would be really wonderful as I have spent alot of time trying to solve this one.
The following script compares 2 files, and if the file on the CD is more recent then the one on the hard drive it updates the hard drive file to the latest version.
Function Update( source, target)
Dim f1,f2,d1,d2,c1,c2,m1
if fs.FileExists( source ) then
set f1 = fs.GetFile( source )
d1 = f1.DateLastModified
c1 = Year(d1) * 10000 + Month(d1) * 100 + Day(d1)
if fs.FileExists( target ) then
set f2 = fs.GetFile( target )
d2 = f2.DateLastModified
c2 = Year(d2) * 10000 + Month(d2) * 100 + Day(d2)
else
c2 = 0
end if
if c1 > c2 then
f1.Copy target,True
MsgBox("New file found and update completed"
end if
end if
End Function
Dim fs
set fs = WScript.CreateObject("Scripting.FileSystemObject"
s = "C:\main.exe"
t = "C:\BB\main.exe"
update s, t
What is happening is that this script is run every 30 secs in a Flash projector to check for new files, if it finds one it updates the old one...so far so good.
However whilst it is checking every 30 secs for an update, the flash production 'main.exe' on the hard drive is already playing, so I need to be able to close the application 'main.exe' if the script finds an update, and then run the new and updated version of 'main.exe' which has now been copied from the CD to the hard drive.
Has anyone PLEASE got any ideas at all, as I seem to be going around and around in circles.
All input GRATEFULLY accepted.
Yours
Kimara
if anyone could answer my question, it would be really wonderful as I have spent alot of time trying to solve this one.
The following script compares 2 files, and if the file on the CD is more recent then the one on the hard drive it updates the hard drive file to the latest version.
Function Update( source, target)
Dim f1,f2,d1,d2,c1,c2,m1
if fs.FileExists( source ) then
set f1 = fs.GetFile( source )
d1 = f1.DateLastModified
c1 = Year(d1) * 10000 + Month(d1) * 100 + Day(d1)
if fs.FileExists( target ) then
set f2 = fs.GetFile( target )
d2 = f2.DateLastModified
c2 = Year(d2) * 10000 + Month(d2) * 100 + Day(d2)
else
c2 = 0
end if
if c1 > c2 then
f1.Copy target,True
MsgBox("New file found and update completed"
end if
end if
End Function
Dim fs
set fs = WScript.CreateObject("Scripting.FileSystemObject"
s = "C:\main.exe"
t = "C:\BB\main.exe"
update s, t
What is happening is that this script is run every 30 secs in a Flash projector to check for new files, if it finds one it updates the old one...so far so good.
However whilst it is checking every 30 secs for an update, the flash production 'main.exe' on the hard drive is already playing, so I need to be able to close the application 'main.exe' if the script finds an update, and then run the new and updated version of 'main.exe' which has now been copied from the CD to the hard drive.
Has anyone PLEASE got any ideas at all, as I seem to be going around and around in circles.
All input GRATEFULLY accepted.
Yours
Kimara