So it's been a hot minute since I've worked with VBS, but I've never run into this problem with simple things like this. Below is the current state of my script to navigate through File Explorer to a specific file, open it, and replace one value in it(the last bit is still in the works.) My issue is that the script does not execute consistently. Sometimes it only opens the file explorer window and then seems to do nothing, but sometimes it works perfectly. When it doesn't, I check task manager to see if the script is still executing, which it should be, but it doesn't show up in processes. Any ideas?
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "explorer"
WScript.Sleep 700
WshShell.AppActivate "File Explorer"
WScript.Sleep 500
WshShell.SendKeys("{TAB}")
WScript.Sleep 100
WshShell.SendKeys("{TAB}")
WScript.Sleep 100
WshShell.SendKeys("{TAB}")
WScript.Sleep 100
WshShell.SendKeys("{TAB}")
WScript.Sleep 100
WshShell.SendKeys("{TAB}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{RIGHT}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("{DOWN}")
WScript.Sleep 100
WshShell.SendKeys("~")
WScript.Sleep 100
WshShell.SendKeys("{TAB}")
WScript.Sleep 100
WshShell.SendKeys("T")
WScript.Sleep 100
WshShell.SendKeys("E")
WScript.Sleep 100
WshShell.SendKeys("S")
WScript.Sleep 100
WshShell.SendKeys("S")
WScript.Sleep 100
WshShell.SendKeys("~")
WScript.Sleep 100
WshShell.SendKeys("T")
WScript.Sleep 100
WshShell.SendKeys("~")
WScript.Sleep 100
WshShell.SendKeys("^{H}")