sendkeys for other application (popup)

i am writing a vb script to open another application (pcomm) using shell.
It works and pop up a child window for login with below 2 info:
UserID:  <textbox>
Password: <textbox>

but i am fail to pass the useid/password that I have in variable to the screen...
Application.sendkeys seems not work.
do I need to use some  API?
Thanks!!!


sample.JPG
hikingexportAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ShallIStickABroomCommented:
Can you post your code please?

Ta
0
Alan_WhiteCommented:
You might want to look into AppActivate.  http://msdn.microsoft.com/en-us/library/wzcddbek(VS.85).aspx
The string for AppActivate would be "Signon to AS/400" in your case.  It is not always foolproof.
 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hikingexportAuthor Commented:
I can now send keys using sendkeys and AppActivate the return integer from Shell function
However, as there are 2 fields in my form, is that a better way to set/determine the current cursor position on the screen so that my sendkeys works exactly what I want?

or sendkeys to specific field in the 2 textbox I wish?

Thanks a lot!
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Alan_WhiteCommented:
Unfortunately send keys is not a very good tool.  Other than appactivate, all you can do is send keys presses.  Have a play around with the keyboard only and see if there is any fullproof method of getting the data in that you want.  eg does pressing ESC clear the boxes?  does ALT+Space then ESC always take you to the first box?  
Basically you need to figure it out with your keyboard and then you are just mimicking those key presses with sendkeys.
Sorry to not be more upbeat but send keys has frustrated me in the past.
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
If you can't find a RELIABLE way of making sure the keys go to the right field then you'll need a different language to automate the process.

Consider using the free VB.Net 2008 Express:
http://www.microsoft.com/express/vb/Default.aspx

Then you can use WinAPIs (FindWindow/FindWindowEx & SendMessage possibly) to get a handle to each window and send text directly them.

Let us know if you want to explore that route...
0
hikingexportAuthor Commented:
Alan_White:
Thanks for your comments. I think I just have the frustration you got in the past.
I have read lots of material online and know that sendkeys is not a reliable way, it MAY do what we want for some suitable cases.

Idle_Mind:
Thanks. Let me chk and figure out if I can use sendkeys or other ways in VB first, but just want to know if i can use VB scripts to call those WinAPIs?

0
Mike TomlinsonMiddle School Assistant TeacherCommented:
No...unfortunately you can't call WinAPIs from pure VBScript.
0
hikingexportAuthor Commented:
Actually I am writing the script in excel macro
I remember I used once to call from excel macro VB script to open a "Open document" dialog in windows for user to select desired file. (sorry I forget the code right now)
so isn't this WINAPI? correct me if I am wrong, thanks!
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
That's completely different then!  Yes, you can use WinAPIs in Excel.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.