Solved

Set values in other program

Posted on 2006-11-29
2
206 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
ID: 18037808
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
ID: 18038083
Thanks a million Idle Mind
very good and fast answer
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

829 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