Robert Berke
asked on
How to get the name of the currently running vbs program?
ThisName = GetCurrentlyRunningVbsProg
----- details of why I want this magic function -------------
----- 375 bonus points for anyone who can make the following routine actually work. -------------
When I make a change to my MS Access Front End databases during the day, I tell the users to close access, then run a batch file which copies FrontEnd*.mdb files to their local client.
To automate this, I want their desktop shortcuts to point to vbs scripts which does the copy only when the server master copy is more recent that the client copy.
For instance CheckBilling.vbs, CheckOrdering.vbs and CheckAcctRecv.vbs would all have the exact same code:
Const SrvrPath = "\\server01\Prod\"
Const ClientPath = "c:\program files\Prod\"
ThisName = GetCurrentlyRunningProgram
DBName = "FrontEnd" & mid(Thisname,6)
Set ServerFile = CreateObject("Scripting.Fi
serverLastModified = ServerFile. DateLastModified
on error resume next
clientLastModified = CreateObject("Scripting.Fi
if err > 0 or clientLastModified < serverLastModified then
kill ClientPath & DBName
ServerFile.copy ClientPath & DBName
end if
have you tried app.EXEName?
ASKER
Is that for vb6? I am using vbs and it does not work. it says object required 'App'
xx = App.EXEName
msgbox xx
xx = App.EXEName
msgbox xx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
exactlly! thank you.
ASKER
Just in case a future researcher reads this:
My front end database referesher didn't work, so don't try it ! ! ! !
Out of date client databases can sometimes have ClientLastModified > ServerLastModified.
For instance,
at 10:00 am Joe on clientCPU01 is using c:\...\FrontEndOrderDataba se
at 10:01 a change is made to \\server01\..\FrontEndOrde rDatabase so LastModifed = 10:01
at 10:10 Joe closes data base, so its LastModified = 10:10
next time joe signs on, he will NOT get his database refreshed.
I think i'll have to build a little database to keep track of the time the last refresh was done. If I ever get it working, I will post it here.
My front end database referesher didn't work, so don't try it ! ! ! !
Out of date client databases can sometimes have ClientLastModified > ServerLastModified.
For instance,
at 10:00 am Joe on clientCPU01 is using c:\...\FrontEndOrderDataba
at 10:01 a change is made to \\server01\..\FrontEndOrde
at 10:10 Joe closes data base, so its LastModified = 10:10
next time joe signs on, he will NOT get his database refreshed.
I think i'll have to build a little database to keep track of the time the last refresh was done. If I ever get it working, I will post it here.