Noob in VBS, need help please.

April 16, 2015 at 02:54:10
Specs: Windows 7
Hi all, i am new in vbs scripting, just starting evening classes for VBS. I just stared as a system engineer and I am busy in SCCM 2012. I am adding an application but I would like an AUTO fill form for an application.

I've create this vbs script to auto fill the Address field:

There is only 1 field that I have to fill with an IP address, can someone help me?

Dim wshShell
' Set up the shell
Set wshShell = WScript.CreateObject( "WScript.Shell" )
' Run the application (extra "s are in case path has spaces)
wshShell.Run """C:\Program Files (x86)\Taknet\Takclient\Takclient.exe"""
' Make sure the application is active
wshShell.AppActivate "Takclient"
' Send credentials
WshShell.SendKeys "Connection Name"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "Server Address"
WshShell.SendKeys "212.88.238.237:10443"
WshShell.SendKeys "{ENTER}"

Thanks for your help :-)


See More: Noob in VBS, need help please.

Report •

#1
April 16, 2015 at 19:01:53
From here down has me confused:
' Send credentials
WshShell.SendKeys "Connection Name"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "Server Address"
WshShell.SendKeys "212.88.238.237:10443"
WshShell.SendKeys "{ENTER}"
'===============
The syntax looks correct, but I'm not sure about the logistics. Is "Connection Name" a replaced value that needs sent? Or just the name of a field? Sendkeys will not take you to a named field based on a prompt or caption-string, you have to use tabs and/or arrows to do that. Your best bet is simply to run the program, then note any and all keystrokes you need to get to any given target-field and enter the data, then have sendkeys send that same sequence of keystrokes immediately after your script "appactivates" the application. Typically you have zero or one tabs to get to a "username"-type field, then a single tab after data entry to get to "password"-type field, then enter data followed by {ENTER} or maybe {TAB} (to "submit") then {ENTER}.
Download "script56.chm" if you don't already have it. It's handy to have.

message edited by nbrane


Report •
Related Solutions


Ask Question