1.

Solve : creating a batch file to enter password in another program?

Answer»

How Can I create a batch file that will enter the password automatically into another program when it loads? 

I was doing some research this morning and  haven't found what I"m looking for.   I use 2 programs on my office computer (this is my computer not the COMPANY I work for) every day that require me to enter my password everytime I load the programs. 

Now I use Roboform form filler on the internet but that only fills forms on web based content in IE.  use this
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.AppActivate "program"
WshShell.SendKeys "password"
save as .vbs
Quote from: mat123 on March 07, 2010, 04:52:41 PM

use this
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.AppActivate "program"
WshShell.SendKeys "password"
save as .vbs


Thanks a million!   Okay so I got this to work using one of the programs so far but it's entering the password in the "User ID:" field.  What do I need to add to the code to have it enter into the field labeled "Password:" .......  Or better yet have both of them entered.  Here's what my script code looks like (keep in mind that the window ACTIVE is labeled "User Login" so I had to use that as the program name):

set wshshell = wscript.CreateObject("wscript.shell")
wshshell.AppActivate "User Login"
WshShell.SendKeys "mypassword" Quote
set wshshell = wscript.CreateObject("wscript.shell")
wshshell.AppActivate "User Login"
WshShell.SendKeys "{tab}mypassword"

this assumes you can press tab once to get from the userID to the password field. Also, if the userID is not filled in by default you should use "userID{tab}password{enter}"

- I cannot remember if it was {enter} or {return}, but one of those should automate the press of the OK button.BC - thanks the {tab} did the trick because the username was already there. 
One more question.... okay maybe it's not just one more question :-)

I'm running this script for 2 separate programs so I have to keep 2 icons on my desktop amongst many others I use hotkeys for.  I'm tyring to minimize the amount of icons I have on my desktop so Is there a way to have the 2 scripts run in the same .vbs file?  I tried this but it enter the 2 different passwords together in one of the programs.  I thought maybe with an "if, then, else" statement or something coded in it would work the way I need it to.  I just don't understand this the VB language so.....

Thanks in advance.   the appactive part needs to be in between the to passwords So it would look like this then?

set wshshell = wscript.CreateObject("wscript.shell")
wshshell.AppActivate "program#1"
WshShell.SendKeys "password#1"
wshshell.AppActivate "program#2"
WshShell.SendKeys "password#2"

I tried that and it still enters both passwords on top of each other in the program#1 but works on Program#2.  I'm sure I just have something wrong in the code.  better way put the two vbs files in a folder ex. C:\ex
make a bat file same folder with this code
Code: [Select]start 1.vbs
start 2.vbs
exit
Quote from: mat123 on March 08, 2010, 09:13:28 PM
better way put the two vbs files in a folder ex. C:\ex
make a bat file same folder with this code
Code: [Select]start 1.vbs
start 2.vbs
exit

Okay I didn't think about that.  I can create the bat - convert to .exe and create a short cut with a hot key and voila.  Thanks.  your welcomeOk I am ATTEMPTING this and having some issues... could you please assist me?

set wshshell = wscript.CreateObject("wscript.shell")
wshshell.AppActivate "path to .exe file"
WshShell.SendKeys "Username here{tab}password here{enter}"
This is what I have and have saved it as a .VB. it does not open the correct app, or anything.... What am I missing here???VBScript files have to be .vbs, not .vb.

AppActivate activates an already running program by the title of it's window. If you want to start a program, There is something else to do it (I don't know what, specifically, possibly WScript.Exec()... (Not On windows at the moment, so I cannot check)

Ok I will keep searching...


Discussion

No Comment Found