Hi all. Bity of a n00b question regarding vbs. Started a new job recently, night shifts and it's new to the company so we're basically doing sfa at the moment. It's not a very technical job, but it's middleman networking, ie: engineers get onto us, we get onto the customer and relay between the 2. Some tech knowledge is required, but not necessary.
While I do have a good bit of experience in computing, it's mainly basic building and operation. My boss gave me a job, but it's not very high on the list of things to do, and is more of a help tool for others. Basically, it's a .vbs file which opens Putty (tool for logging into customer routers, if ye haven't heard of it), automatically logs us in with 2 separate log in details, and opens the IP of the router we're connecting to, and opens a txt file.
Unfortunately, I have no prior knowledge of VB, or any scripting really, but I somehow managed to Google and fix the issue with the txt file not opening (didn't specify to open a notepad document before the command to open the file), but I'm stumped on another bit. I intend on learning more about vbs soon, but for now I need a hand as the internet, or my lack of understanding of what to search for, is letting me down.
When I run the script, it first opens a text box to enter an IP to access, then it opens Putty, logs us in, and attempts to log us into the router. However, there's a 'Are you sure' question between the second username/password, and I don't know how to script for that. Anyone be able to help? I've pasted the script below, removing any company/personal information:
Dim Shell
IPAdress = InputBox("Enter your IP Address")
Set Shell = CreateObject("WScript.Shell")
If IPAdress = "" Then
Wscript.Quit
End If
output = Shell.Run("C:\Users\USER\Desktop\putty.exe 192.x.x.x")
wscript.sleep(1000)
Shell.Sendkeys "LOGIN1" & VBCrLf
wscript.sleep(1000)
Shell.Sendkeys "PW1" & VBCrLf
wscript.sleep(1000)
Shell.Sendkeys "ssh"
wscript.sleep(1000)
Shell.Sendkeys " -l LOGIN2 " & IPAdress & VBCrLf
wscript.sleep(1000)
Shell.Sendkeys "PW2" & VBCrLf
wscript.sleep(1000)
output = Shell.Run("notepad.exe T:\path to file.txt")
The issue occurs between LOGIN2 and PW2, we get the 'Are you sure' message, and the above script enters PW2, which it then fails. Anyone any suggestions? No worries if not, I'll just have to say I couldn't figure it out, which is understandable with having no coding history! I don't think he realises that it's not complete, and he doesn't code himself either so no idea how he got it to this stage!
Thanks in advance!