Solved

Set values in other program

Posted on 2006-11-29
2
176 Views
Last Modified: 2010-08-05
Hi experts,

I have a 3rd party program that starts up from a shortcut, the first window it’s a logging screen  now my question is it possible to write a scrip or program to run the shortcut and set the values for the user and password?. and how can it be done?

Thanks.
0
Comment
Question by:Stendor
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 400 total points
Comment Utility
Sure it's possible...the only thing in question is how much work needs to be done.

At it's simplest you could do:

    (1) Process.Start()
    (2) Process.WaitForInputIdle()
    (3) SendKeys.Send() ' UserName
    (4) SendKeys.Send() ' Tab to move to next Field
    (5) SendKeys.Send() ' Password
    (6) SendKeys.Send() ' Enter

Here is an example using NotePad:

        Dim p As Process = Process.Start("notepad")
        p.WaitForInputIdle()
        SendKeys.Send("Bond")
        SendKeys.Send("{Tab}")
        SendKeys.Send("007")
        SendKeys.Send("{Enter}")

It often gets more complicated than that though.  Sometimes you need to use APIs to look for the presence of the "login" window.  Other times you have to explicitly give a window/control focus.  I've seen some situations where SendKeys.Send() doesn't work and you have to either use APIs to simulate keyboard input directly or send the info the controls directly with SendMessage().   etc....
0
 
LVL 1

Author Comment

by:Stendor
Comment Utility
Thanks a million Idle Mind
very good and fast answer
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now