JMongi
Active member
- Local time
- Today, 15:16
- Joined
- Jan 6, 2021
- Messages
- 802
This is my first VBS script. I wrote it in notepad. It works fine. I'm going to use it to launch my Access app.
1. Any improvements I can make?
2. Is there an included dev environment in Windows 10?
1. Any improvements I can make?
2. Is there an included dev environment in Windows 10?
Code:
'This script is used to launch the KingslyOperation database.
'It tests if the database front end location exists then copies the most
'current front end from the server location to the target local directory.
'It then launches the database.
'Set new folder location and current file location
Const strFolder = "C:\KingslyOp\", strFile = "\\KCI-CAMBRIDGE\TEST FOLDER\test.txt"
Const Overwrite = True
Dim oFSO
Set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FolderExists(strFolder) Then
oFSO.CreateFolder strFolder
End If
oFSO.CopyFile strFile, strFolder, Overwrite
'Pop Up WiFi Warning
strMsgBoxText = "Do NOT connect to Kingsly Operations over WiFi, FortiNet or other VPN software. " _
& "This may cause program instability and data corruption."
strMsgBoxTitle = "WARNING!"
'This is a messagebox with OK and Cancel buttons.
result = MsgBox(strMsgBoxText, 1+48, strMsgBoxTitle)
Select Case result
Case 1
'App Launch Code
Dim objShell
Dim strPath
strPath = "C:\KingslyOp\test.txt"
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run (strPath)
Case 2
MsgBox "Application Launch Terminated"
End Select