-
Apr 19th, 2021, 11:44 AM
#1
Thread Starter
New Member
Input a password to dialog box after launching app through VB script
I have written a script that launches an application from my desktop. I have no knowledge in scripting, but was able to google around and have it done. However I am stuck at a point where I am not able to input the password in the dialog box that gets opened when I launch the app. Below is code :
Dim exeName
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
exeName = """Actual Application path"""
call WshShell.Run (exeName, 1, true)
WScript.Sleep(100)
WshShell.AppActivate "TAE" '-- Please note that TAE is the name that appears on title bar of the app
WScript.Sleep(100)
'Passing the value password
WSHShell.SendKeys "welcome124"
'MOving to enter
WSHShell.SendKeys "{TAB}"
'Clicking enter to complete the screen
WSHShell.SendKeys "{ENTER}"
set WshShell=Nothing
Application gets launched and I get a dialog box which already has the username and cursor is on the password text field. Nothing happens after that. Sometimes password gets entered in some other application that is open - like notepad
-
Apr 23rd, 2021, 06:00 AM
#2
Re: Input a password to dialog box after launching app through VB script
Hi manishkumarM,
You're calling whshell.run method the wrong way for your purposes. Your script doesn't need to wait for the application to close so change "true" to "false":
Code:
call WshShell.Run (exeName, 1, false)
Also, please use code tags. You can access these using the "#" button in the toolbar above a message you're about to post on the fourm.
-
Apr 23rd, 2021, 07:21 AM
#3
Thread Starter
New Member
Re: Input a password to dialog box after launching app through VB script
Thanks for offering assistance . I now changed it as below
Code:
call WshShell.Run (exeName, 1, false)
WScript.Sleep(25)
WshShell.AppActivate "TAE"
'Passing the value password
WSHShell.SendKeys "welcome2"
'MOving to enter
WSHShell.SendKeys "{TAB}"
'Clicking enter to complete the screen
WSHShell.SendKeys "{ENTER}"
Application dialog box opens up asking for password. Cursor is on the password text box. But nothing goes in as input.
-
Apr 24th, 2021, 05:57 AM
#4
Re: Input a password to dialog box after launching app through VB script
That is odd, it works for me. Why did you change the waiting period to 25 milliseconds? Try increasing it and see if that helps.
-
Apr 24th, 2021, 09:34 AM
#5
Thread Starter
New Member
Re: Input a password to dialog box after launching app through VB script
Perfect. It worked ... I checked the time it takes to open the app manually and increased the wait time accordingly . Thank you so much for your help ! You are a star ..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|