Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

sendkeys

Posted on 2001-06-22
8
332 Views
Last Modified: 2010-08-05
What do I need to add to this --

I'm trying to run setup.exe and have(enter) pressed when the dialog pops up???




Private Sub form_load()



Shell ("command.com /c c:\windows\desktop\setup.exe"), vbHide
SendKeys (enter)
End Sub
0
Comment
Question by:patrickm3
8 Comments
 
LVL 6

Expert Comment

by:JonFish85
ID: 6220522
AppActivate "Caption Of Setup.exe"
SendKeys "{ENTER}", True
0
 

Expert Comment

by:RichardVBman
ID: 6220540
I agree with JonFish85; you might also need to create a time delay between the activation of the form and the sendkeys statement (you'll need to adjust the forms timer interval to suit your own needs):

AppActivate"Caption Of Setup.exe"
Call Delay(10)
SendKeys "{ENTER}",True

'Paste this Function in the declarations section

Function Delay(lngDelay as long)

dim StartTime as long

StartTime = Timer
While Timer <> StartTime + lngDelay
   Doevents
Wend

End sub
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6220577
Hello RichardVBMan! I notice that you are fairly new to EE. Here at EE, experts usually choose to post always with comments, as a proposed answer locks the question and moves it to the "Answered Questions" section. Also, your "answer" is basically the same as mine, just with revisions. Please just keep in mind that it is generally better to just use comments, since the questionerre can accept a comment as an answer. Just thought I'd let you know!
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:patrickm3
ID: 6223168
I've never used vb--could you tell me where to paste this stuff in?
0
 

Author Comment

by:patrickm3
ID: 6223189
I've never used vb--could you tell me where to paste this stuff in?
0
 
LVL 6

Accepted Solution

by:
JonFish85 earned 200 total points
ID: 6223514
try something like this:

Private Sub Form_Load()
  Shell "C:\Path\To\Setup\Setup.exe", vbNormalFocus
  DoEvents
  DoEvents
  'Replace "caption" with the caption of
  'the main setup.exe
  AppActivate "Caption", True
  DoEvents
  SendKeys "{ENTER}", True
End Sub
0
 
LVL 1

Expert Comment

by:Form_Glow
ID: 6224809
Why use SENDKEYS?
Just Loop until you get the handle of the "OK" button or whatever..

Do:Doevents
x = get the handle of button to click
loop until x

Call SendMessage(x, WM_LBUTTONDOWN, 0&, 0&)
Call SendMessage(x, WM_LBUTTONUP, 0&, 0&)
 
0
 
LVL 6

Expert Comment

by:JonFish85
ID: 6494593
thanks for the points, but why the B grade?
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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

838 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