My goal is to display an image for X seconds before application runs. Basically like a splash screen that simply shows the logo and some brief info about the program before the input box comes up.
I have included the code below so you can see how it acts. Any help on this is greatly appreciated.
<code>
on error resume next
strComputer=inputbox("Enter Device Name: ", "Login Script Generator V1.1")
strUser=inputbox("Enter Username: ", "Login Script Generator V1.1")
Const HKEY_USERS = &H80000003
strMsg = ""
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objWbem = GetObject("winmgmts:")
Set objRegistry = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")
if err.number = "-2147217375" then
else
Select Case err.number
Case 462
strWarn=MsgBox("Unable to connect to " & strComputer & ".", 48, "Login Script Generator V1.1 - System Information Checker")
Case -2147217394
strWarn=MsgBox(strComputer & " is not a valid name.", 48, "Login Script Generator V1.1 - System Information Checker")
Case 70
strWarn=MsgBox(strComputer & " has denied access.", 48, "Login Script Generator V1.1 - System Information Checker")
Case Else
Set colProc = objWmiService.ExecQuery("Select Name from Win32_Process" & " Where Name='explorer.exe'")
strMsg = strMsg & "'***** User: " & strUser & VbCrLf
strMsg = strMsg & "'***** Device: " & strComputer & VbCrLf & VbCrLf
lngRtn = objRegistry.EnumKey(HKEY_USERS, "", arrRegKeys)
For Each strKey In arrRegKeys
If UCase(strKey) = ".DEFAULT" Or UCase(Right(strKey, 8)) = "_CLASSES" Then
Else
Set objSID = objWbem.Get("Win32_SID.SID='" & strKey & "'")
If objSID.accountname = strUser Then
regpath2enumerate = strkey & "\Network"
objRegistry.enumkey hkey_users, regpath2enumerate, arrkeynames
If Not (IsEmpty(arrkeynames)) Then
For Each subkey In arrkeynames
regpath = strkey & "\Network\" & subkey
regentry = "RemotePath"
objRegistry.getstringvalue hkey_users, regpath, regentry, dapath
strMsg = strMsg & "net use " & subkey & ": """ & dapath & """ /yes" & VbCrLf
Next
End If
End If
End If
Next
strDirectory=inputbox("(OPTIONAL) Enter Save File Location: ", "Login Script Generator V1.1", "\\techserv\gear\_Login_Script_Generator\Generated_Scripts")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDirectory) Then
Else
Set objFolder = objFSO.CreateFolder(strDirectory)
End if
intMonth = month(now)
if intMonth < 10 then
strThisMonth = "0" & intMonth
else
strThisMonth = intMOnth
end if
intDay = Day(now)
if intDay < 10 then
strThisDay = "0" & intDay
else
strThisDay = intDay
end if
strFilenameDateSerial = year(now) & strThisMonth & strThisDay
Set objFile = objFSO.CreateTextFile(strDirectory & "\" & strUser & "_" & strComputer & ".txt",True)
objFile.Write strMsg & vbCrLf
strFinish = "Finished generating login script for:"& VbCrLf & VbCrLf & "DEVICE: " & strComputer & VbCrLf & "USERNAME: " & strUser & VbCrLf & VbCrLf & "View file?"
strAnswer=MsgBox(strFinish, 68, "Login Script Generator V1.1 - System Information Checker")
if strAnswer = 6 then
Set objShell = CreateObject("WScript.Shell")
objShell.run strDirectory & "\" & strUser & "_" & strComputer & ".txt"
end if
end select
end if
</code>
I have included the code below so you can see how it acts. Any help on this is greatly appreciated.
<code>
on error resume next
strComputer=inputbox("Enter Device Name: ", "Login Script Generator V1.1")
strUser=inputbox("Enter Username: ", "Login Script Generator V1.1")
Const HKEY_USERS = &H80000003
strMsg = ""
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objWbem = GetObject("winmgmts:")
Set objRegistry = GetObject("winmgmts://" & strComputer & "/root/default:StdRegProv")
if err.number = "-2147217375" then
else
Select Case err.number
Case 462
strWarn=MsgBox("Unable to connect to " & strComputer & ".", 48, "Login Script Generator V1.1 - System Information Checker")
Case -2147217394
strWarn=MsgBox(strComputer & " is not a valid name.", 48, "Login Script Generator V1.1 - System Information Checker")
Case 70
strWarn=MsgBox(strComputer & " has denied access.", 48, "Login Script Generator V1.1 - System Information Checker")
Case Else
Set colProc = objWmiService.ExecQuery("Select Name from Win32_Process" & " Where Name='explorer.exe'")
strMsg = strMsg & "'***** User: " & strUser & VbCrLf
strMsg = strMsg & "'***** Device: " & strComputer & VbCrLf & VbCrLf
lngRtn = objRegistry.EnumKey(HKEY_USERS, "", arrRegKeys)
For Each strKey In arrRegKeys
If UCase(strKey) = ".DEFAULT" Or UCase(Right(strKey, 8)) = "_CLASSES" Then
Else
Set objSID = objWbem.Get("Win32_SID.SID='" & strKey & "'")
If objSID.accountname = strUser Then
regpath2enumerate = strkey & "\Network"
objRegistry.enumkey hkey_users, regpath2enumerate, arrkeynames
If Not (IsEmpty(arrkeynames)) Then
For Each subkey In arrkeynames
regpath = strkey & "\Network\" & subkey
regentry = "RemotePath"
objRegistry.getstringvalue hkey_users, regpath, regentry, dapath
strMsg = strMsg & "net use " & subkey & ": """ & dapath & """ /yes" & VbCrLf
Next
End If
End If
End If
Next
strDirectory=inputbox("(OPTIONAL) Enter Save File Location: ", "Login Script Generator V1.1", "\\techserv\gear\_Login_Script_Generator\Generated_Scripts")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strDirectory) Then
Else
Set objFolder = objFSO.CreateFolder(strDirectory)
End if
intMonth = month(now)
if intMonth < 10 then
strThisMonth = "0" & intMonth
else
strThisMonth = intMOnth
end if
intDay = Day(now)
if intDay < 10 then
strThisDay = "0" & intDay
else
strThisDay = intDay
end if
strFilenameDateSerial = year(now) & strThisMonth & strThisDay
Set objFile = objFSO.CreateTextFile(strDirectory & "\" & strUser & "_" & strComputer & ".txt",True)
objFile.Write strMsg & vbCrLf
strFinish = "Finished generating login script for:"& VbCrLf & VbCrLf & "DEVICE: " & strComputer & VbCrLf & "USERNAME: " & strUser & VbCrLf & VbCrLf & "View file?"
strAnswer=MsgBox(strFinish, 68, "Login Script Generator V1.1 - System Information Checker")
if strAnswer = 6 then
Set objShell = CreateObject("WScript.Shell")
objShell.run strDirectory & "\" & strUser & "_" & strComputer & ".txt"
end if
end select
end if
</code>