Re: Help with a VB.exe to run an Application.exe



I suggest try macro program. They have this functionality already built
in. Why reinvent the wheel.
You can try our macro program, Worspace Macro Pro. You can get more
information and free trial download from
http://www.tethyssolutions.com/macro-automation.htm

Tethys Solutions, Expert Services Group
http://www.tethyssolutions.com/ask-the-expert.htm
SMART Macro & Automation Software

Forte Agent wrote:
On 24 Jan 2006 18:51:50 -0800, "Bill" <wlippinc130@xxxxxxxxx> wrote:

I'm looking to write an VB.exe file that will open an applications
.exe file and wait a given amount of time and then transmit a
character, wait a while longer and do the same thing. There is an .exe
file out on my system that creates a .CSV file that I need to have for
updating a database. I'm hoping to be about the have the VB.exe run
as a Scheduled Task automatically. Could some one give point me in the
right direction? Its' been a while since I've had to write anything
in VB.


I'm trying to do something similar now myself. Here's what I have
learned. This applies to vb6.


Shell Function (this runs the program)

Shell(pathname[, windowstyle])
Runs the executable program specified by the pathname argument and
returns a Variant of subtype Double that represents the program's task
ID. If Shell is unsuccessful, it returns zero. The optional
windowstyle argument determines the style of the window in which the
shelled program runs.

AppActivate Statement (this gives focus to the program so that
SendKeys will send keystrokes to it, and not your program)

AppActivate title[,wait]
Activates the application window that has the string title in its
title bar or, alternatively, the task ID specified by title. The
optional wait argument (Boolean) can be used to specify whether the
calling application should wait until it has the focus before the
application window is activated.

SendKeys Statement (this sends keystrokes to the program, just as if
you had typed them to the program. You can use alt-keys to press
buttons, and use the tab key to move to different fields on the
program)

Generates one or more keystrokes as if they came from the keyboard.
The string argument determines which keystrokes to send, and the
optional Wait argument (Boolean) specifies whether keystrokes must be
processed before control is returned to the procedure. False, the
default value, means that control is returned to the procedure
immediately after the keystrokes are sent.

To send a space, send the string " ".

You can use SendKeys to send more than one keystroke at a time. To do
this, create a compound string argument that represents a sequence of
keystrokes by appending each keystroke in the sequence to the one
before it. For example, to send the keystrokes a, b, and c, you would
send the string argument "abc". The SendKeys method uses some
characters as modifiers of characters (instead of using their
face-values). This set of special characters consists of parentheses,
brackets, braces, and the:

plus sign "+",

caret "^",

percent sign "%",

and tilde "~"

Send these characters by enclosing them within braces "{}". For
example, to send the plus sign, send the string argument "{+}".
Brackets "[ ]" have no special meaning when used with SendKeys, but
you must enclose them within braces to accommodate applications that
do give them a special meaning (for dynamic data exchange (DDE) for
example).

To send bracket characters, send the string argument "{[}" for the
left bracket and "{]}" for the right one.

To send brace characters, send the string argument "{{}" for the left
brace and "{}}" for the right one.

Some keystrokes do not generate characters (such as ENTER and TAB).
Some keystrokes represent actions (such as BACKSPACE and BREAK). To
send these kinds of keystrokes, send the arguments shown in the
following table:

Key Argument

BACKSPACE {BACKSPACE}, {BS}, or {BKSP}

BREAK {BREAK}

CAPS LOCK {CAPSLOCK}

DEL or DELETE {DELETE} or {DEL}

DOWN ARROW {DOWN}

END {END}

ENTER {ENTER} or ~

ESC {ESC}

HELP {HELP}

HOME {HOME}

INS or INSERT {INSERT} or {INS}

LEFT ARROW {LEFT}

NUM LOCK {NUMLOCK}

PAGE DOWN {PGDN}

PAGE UP {PGUP}

PRINT SCREEN {PRTSC}

RIGHT ARROW {RIGHT}

SCROLL LOCK {SCROLLLOCK}

TAB {TAB}

UP ARROW {UP}

F1 {F1}

F2 {F2}

F3 {F3}

F4 {F4}

F5 {F5}

F6 {F6}

F7 {F7}

F8 {F8}

F9 {F9}

F10 {F10}

F11 {F11}

F12 {F12}

F13 {F13}

F14 {F14}

F15 {F15}

F16 {F16}


To send keyboard characters that are comprised of a regular keystroke
in combination with a SHIFT, CTRL, or ALT, create a compound string
argument that represents the keystroke combination. You do this by
preceding the regular keystroke with one or more of the following
special characters:

Key Special Character

SHIFT +

CTRL ^

ALT %


Timing could be done by recording the start time in a variable, and
comparing that time with the current time.

Hope this helps you!

.



Relevant Pages

  • Re: Help with a VB.exe to run an Application.exe
    ... SendKeys will send keystrokes to it, ... Activates the application window that has the string title in its ... characters as modifiers of characters (instead of using their ... Send these characters by enclosing them within braces "". ...
    (comp.lang.basic.visual.misc)
  • Re: My Word shortcut keys for Windings wont work in Excel
    ... I was hoping for keystrokes for both characters ... in the same font as the entry of ticks and smileys is random and I will have ... to format each cell to either windings or windings 2 as I go. ...
    (microsoft.public.excel.misc)
  • Re: Newbie question re TIB
    ... transmitter. ... You might try getting your keystrokes with KEY instead, ... some way to put keystrokes into your own input buffer, ... as you want it or at least 1024 characters. ...
    (comp.lang.forth)
  • Re: Reduce the string length
    ... keystrokes over the last few years. ... > Erma and Rick, ... > No need to calculate the actual length of the string. ... > number of characters to show is entered, ...
    (microsoft.public.access.queries)
  • Re: Correct group for WDM development??
    ... >mode so you don't have to hit I to be in that mode. ... characters will always appear in the file being edited. ... That's the key difference. ... keystrokes generally have the same ...
    (microsoft.public.development.device.drivers)