Prev: Determine the number of bits in a negative number
Next: I want to make a VBScript to control Windows Media Player
From: אמיר עטרי on 2 Dec 2009 05:18 Hello there, I am trying to find or to write a script that will do the following. I have a doc file in a network share example: \\server10800\mivdak\mivdak.doc the script will be run from local computer. When i will start the script it should look if the following exists: c:\program files\microsoft office\office12\winword.exe If so open \\server10800\mivdak\mivdak.doc If not exists will open c:\program files\microsoft office\office11\winword.exe \\server10800\mivdak\mivdak.doc Any help will be appriciated. Thank you very much Amir :)
From: Reventlov on 2 Dec 2009 06:40
Il giorno Wed, 2 Dec 2009 02:18:01 -0800, =?Utf-8?B?15DXnteZ16gg16LXmNeo15k=?= <@discussions.microsoft.com> ha scritto: > >Hello there, > >I am trying to find or to write a script that will do the following. > >I have a doc file in a network share >example: >\\server10800\mivdak\mivdak.doc > >the script will be run from local computer. >When i will start the script it should look if the following exists: >c:\program files\microsoft office\office12\winword.exe >If so >open \\server10800\mivdak\mivdak.doc > >If not exists will open >c:\program files\microsoft office\office11\winword.exe >\\server10800\mivdak\mivdak.doc You could shell a "start \\server10800\mivdak\mivdak.doc" so it does not matter which version of office is installed. This function checks if a file exists. It uses filesystemobject and its function FileExists ' Bool File_IsExist( sFileName ) Function File_IsExist( ByVal sFileName ) Dim opfs On Error Resume Next File_IsExist=False Set opfs = CreateObject("Scripting.FileSystemObject") if Err <> 0 then Exit Function end if ' Test per l'esistenza del file File_IsExist = opfs.FileExists( sFileName ) set opfs = nothing Err.Clear On Error Goto 0 End Function -- Giovanni Cenati (Bergamo, Italy) Write to "Reventlov" at katamail com http://digilander.libero.it/Cenati (Esempi e programmi in VbScript) -- |