Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending input to a program. 1

Status
Not open for further replies.

sarcus25

Programmer
Apr 14, 2005
27
0
0
Hi I am trying to create a program that automatically runs a setup program (Install Shield 10.0). I have tried running the setup automatically using an .iss file but it doesn't work. I read somewhere that their is because of the way the programmers put the setup package together. Tried using send keys to Send the keystrokes to the app and I can only get past the inital screen. When it goes to the license Screen I should be able to send "Alt + Y" to accept the agreement but it does nothing. If I do it manually though it works. Any ideas? Thanks in advance. My code is below.

Code:
'Create a new instance of the process.
        Dim myProcess As New Process()
        myProcess.StartInfo.FileName = ProgramToRun
        myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
        myProcess.EnableRaisingEvents = True

        'Add a fuction to to things once the program has exited.
        AddHandler myProcess.Exited, AddressOf Me.SendKeysTestExited
        myProcess.Start()

        'Wait 5 Seconds for the setup file to load.
        myProcess.WaitForInputIdle(5000)
       
        'Hitting The Next button
        SendKeys.Send("%n")
        Thread.Sleep(3000)
        'This is accepting the license agreement.(doesn't work)
        SendKeys.Send("%y")
        Thread.Sleep(3000)
        SendKeys.Send("ENTER")
        SendKeys.Send("DOWN") 'Set it to not reboot.
        SendKeys.Send("TAB")
        SendKeys.Send("ENTER")

        MsgBox("Macro Run")
 
I have had dealings with this in VB6 and unfortunately it is a bit 'flaky' - i would try using sendwait but if it is losing the focus / creating new windows it wont help you.

In the solution in vb6 i had to do my own navigation through the window handles (api calls) findwindow etc and then the child objects in that window - it occupied the long winter evenings & kept me out of trouble - havent got it to hand at the moment - plenty of help on the net about it - interpretation & getting it to work i found a different matter

good luck
 
Thanks. I though that was what was happening. good to know I'm not crazy after all(well not that much at least :)). Probably going to have to go the route of just installing the service pack then grabbing all the exe files and reziping and using that instead of the setup. I kind of didn't want to go the windows handles route. Touched on it a bit before and didn't like it to much. :). Thanks for your input. Take care.
 
no problem - i did find a handle demonstration program in vb6 (with source) that would be a good place to start - will see if i can find it for future reference - the actual application i wrote was to capture data from another application running that diaplayed all sorts of popup child windows so my application had to run in the background and test for the window names, capture the handle then navigate the controls (children) until i got the correct textboxes etc - kept me 'amused' for weeks off and on
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top