Sign in with
Sign up | Sign in
Your question

Create a batch file?

Last response: in Windows XP
Share
January 29, 2005 4:19:32 AM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

I want to create a batch file, or a command file - I'm not sure what the
correct terminology is.

What I want to do is create an exe file which I can execute in windows
when I choose to. I would want this file to bring up two different
programs sequentially - waiting for the first to load its files before
bringing up the second.

Way back in the days of dos, you could do this with the dos command
copycon etc. But that's long gone and I'm wondering how to do it from
within Win XP - probably as an exe file.

TIA

Louise

More about : create batch file

Anonymous
January 29, 2005 10:26:14 PM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

Louise <none@nospam.com> wrote:

>I want to create a batch file, or a command file - I'm not sure what the
>correct terminology is.
>
>What I want to do is create an exe file which I can execute in windows
>when I choose to. I would want this file to bring up two different
>programs sequentially - waiting for the first to load its files before
>bringing up the second.

That is a batch file. At a DOS prompt type
START /?
for help with this issue.

--
(tm)
January 30, 2005 9:54:38 AM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

In article <#EWsMBjBFHA.2392@TK2MSFTNGP14.phx.gbl>, tmatzner@gmx.net
says...
> Louise <none@nospam.com> wrote:
>
> >I want to create a batch file, or a command file - I'm not sure what the
> >correct terminology is.
> >
> >What I want to do is create an exe file which I can execute in windows
> >when I choose to. I would want this file to bring up two different
> >programs sequentially - waiting for the first to load its files before
> >bringing up the second.
>
> That is a batch file. At a DOS prompt type
> START /?
> for help with this issue.
>
>
Thanks - it looks complicated. Is there a dumb-down version? I thought
I once remembered seeing a little program that created these for you and
you just "filled in the blanks" but I couldn't find it when I searched
for it now.

Louise
Related resources
Anonymous
January 31, 2005 2:41:45 PM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

Louise wrote:
> In article <#EWsMBjBFHA.2392@TK2MSFTNGP14.phx.gbl>, tmatzner@gmx.net
> says...
>
>>Louise <none@nospam.com> wrote:
>>
>>
>>>I want to create a batch file, or a command file - I'm not sure what the
>>>correct terminology is.
>>>
>>>What I want to do is create an exe file which I can execute in windows
>>>when I choose to. I would want this file to bring up two different
>>>programs sequentially - waiting for the first to load its files before
>>>bringing up the second.
>>
>>That is a batch file. At a DOS prompt type
>>START /?
>>for help with this issue.
>>
>>
>
> Thanks - it looks complicated. Is there a dumb-down version? I thought
> I once remembered seeing a little program that created these for you and
> you just "filled in the blanks" but I couldn't find it when I searched
> for it now.
>
> Louise



None that I know of.
Can you describe what you want the batch file to do?

--
Bob Dietz
Anonymous
January 31, 2005 9:32:27 PM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

Louise <none@nospam.com> wrote:

>Thanks - it looks complicated. Is there a dumb-down version?

Not that I know of. You can find some more help in Help & Support.

--
(tm)
Anonymous
February 1, 2005 11:45:28 PM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

I believe you may be thinking about Batchrun which you can get from
here: http://www.outertech.com/index.php?_charisma_page=downl... .
Gene

Louise wrote:
> In article <#EWsMBjBFHA.2392@TK2MSFTNGP14.phx.gbl>, tmatzner@gmx.net
> says...
>
>>Louise <none@nospam.com> wrote:
>>
>>
>>>I want to create a batch file, or a command file - I'm not sure what the
>>>correct terminology is.
>>>
>>>What I want to do is create an exe file which I can execute in windows
>>>when I choose to. I would want this file to bring up two different
>>>programs sequentially - waiting for the first to load its files before
>>>bringing up the second.
>>
>>That is a batch file. At a DOS prompt type
>>START /?
>>for help with this issue.
>>
>>
>
> Thanks - it looks complicated. Is there a dumb-down version? I thought
> I once remembered seeing a little program that created these for you and
> you just "filled in the blanks" but I couldn't find it when I searched
> for it now.
>
> Louise
February 2, 2005 7:57:12 AM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

In article <eJg0yw7BFHA.2260@TK2MSFTNGP14.phx.gbl>, rbdietz_1999
@yahoo.com says...
> Louise wrote:
> > In article <#EWsMBjBFHA.2392@TK2MSFTNGP14.phx.gbl>, tmatzner@gmx.net
> > says...
> >
> >>Louise <none@nospam.com> wrote:
> >>
> >>
> >>>I want to create a batch file, or a command file - I'm not sure what the
> >>>correct terminology is.
> >>>
> >>>What I want to do is create an exe file which I can execute in windows
> >>>when I choose to. I would want this file to bring up two different
> >>>programs sequentially - waiting for the first to load its files before
> >>>bringing up the second.
> >>
> >>That is a batch file. At a DOS prompt type
> >>START /?
> >>for help with this issue.
> >>
> >>
> >
> > Thanks - it looks complicated. Is there a dumb-down version? I thought
> > I once remembered seeing a little program that created these for you and
> > you just "filled in the blanks" but I couldn't find it when I searched
> > for it now.
> >
> > Louise
>
>
>
> None that I know of.
> Can you describe what you want the batch file to do?
>
>
I want it to open a program: Dragon Naturally Speaking

Then I want it to wait about 45 seconds because Dragon has to load a
user file.

Then I want it to bring up the surround mixer which is one of the
utilities from my Soundblaster Audigy 2ZS

Then, if possible (and this is probably asking too much), I want it to
remove the X from the line in box on the surround mixer, thereby
activating the line-in for recording.

I find I do this step by step a few times a day and I would love to get
it automated.

Louise
Anonymous
February 2, 2005 7:25:32 PM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

Use script. You should also use AppActivate (to ensure keystrokes go where you expect) and possibley Sleep (depends on the relationship of sending and recieving programs). Copy line into a text file called whatever.vbs

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%{TAB}^c%{TAB}^v"

[above sends Alt + Tab, Ctrl + C, Alt + Tab, then Ctrl + V]

or

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "calc"
WScript.Sleep 100
WshShell.AppActivate "Calculator"
WScript.Sleep 100
WshShell.SendKeys "1{+}"


Then set a shortcut to the scripts and set a hotkey for the shortcut (see help)


Windows Script Host

SendKeys Method
See Also
WshShell Object | Run Method

Sends one or more keystrokes to the active window (as if typed on the keyboard).

object.SendKeys(string)
Arguments
object
WshShell object.
string
String value indicating the keystroke(s) you want to send.
Remarks
Use the SendKeys method to send keystrokes to applications that have no automation interface. Most keyboard characters are represented by a single keystroke. Some keyboard characters are made up of combinations of keystrokes (CTRL+SHIFT+HOME, for example). To send a single keyboard character, send the character itself as the string argument. For example, to send the letter x, send the string argument "x".

Note 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:

a.. plus sign "+",
b.. caret "^",
c.. percent sign "%",
d.. 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).

a.. To send bracket characters, send the string argument "{[}" for the left bracket and "{]}" for the right one.
b.. 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 %

Note When used this way, these special characters are not enclosed within a set of braces.
To specify that a combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, create a compound string argument with the modified keystrokes enclosed in parentheses. For example, to send the keystroke combination that specifies that the SHIFT key is held down while:

a.. e and c are pressed, send the string argument "+(ec)".
b.. e is pressed, followed by a lone c (with no SHIFT), send the string argument "+ec".
You can use the SendKeys method to send a pattern of keystrokes that consists of a single keystroke pressed several times in a row. To do this, create a compound string argument that specifies the keystroke you want to repeat, followed by the number of times you want it repeated. You do this using a compound string argument of the form {keystroke number}. For example, to send the letter "x" ten times, you would send the string argument "{x 10}". Be sure to include a space between keystroke and number.

Note The only keystroke pattern you can send is the kind that is comprised of a single keystroke pressed several times. For example, you can send "x" ten times, but you cannot do the same for "Ctrl+x".
Note You cannot send the PRINT SCREEN key {PRTSC} to an application.
Example
The following example demonstrates the use of a single .wsf file for two jobs in different script languages (VBScript and JScript). Each job runs the Windows calculator and sends it keystrokes to execute a simple calculation.

<package>
<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "calc"
WScript.Sleep 100
WshShell.AppActivate "Calculator"
WScript.Sleep 100
WshShell.SendKeys "1{+}"
WScript.Sleep 500
WshShell.SendKeys "2"
WScript.Sleep 500
WshShell.SendKeys "~"
WScript.Sleep 500
WshShell.SendKeys "*3"
WScript.Sleep 500
WshShell.SendKeys "~"
WScript.Sleep 2500
</script>
</job>

<job id="js">
<script language="JScript">
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("calc");
WScript.Sleep(100);
WshShell.AppActivate("Calculator");
WScript.Sleep(100);
WshShell.SendKeys ("1{+}");
WScript.Sleep(500);
WshShell.SendKeys("2");
WScript.Sleep(500);
WshShell.SendKeys("~");
WScript.Sleep(500);
WshShell.SendKeys("*3");
WScript.Sleep(500);
WshShell.SendKeys("~");
WScript.Sleep(2500);
</script>
</job>
</package>
See Also
WshShell Object | Run Method


--
----------------------------------------------------------
http://www.uscricket.com
"Louise" <none@nospam.com> wrote in message news:MPG.1c6a296383ff66119897db@news-server.nyc.rr.com...
> In article <eJg0yw7BFHA.2260@TK2MSFTNGP14.phx.gbl>, rbdietz_1999
> @yahoo.com says...
>> Louise wrote:
>> > In article <#EWsMBjBFHA.2392@TK2MSFTNGP14.phx.gbl>, tmatzner@gmx.net
>> > says...
>> >
>> >>Louise <none@nospam.com> wrote:
>> >>
>> >>
>> >>>I want to create a batch file, or a command file - I'm not sure what the
>> >>>correct terminology is.
>> >>>
>> >>>What I want to do is create an exe file which I can execute in windows
>> >>>when I choose to. I would want this file to bring up two different
>> >>>programs sequentially - waiting for the first to load its files before
>> >>>bringing up the second.
>> >>
>> >>That is a batch file. At a DOS prompt type
>> >>START /?
>> >>for help with this issue.
>> >>
>> >>
>> >
>> > Thanks - it looks complicated. Is there a dumb-down version? I thought
>> > I once remembered seeing a little program that created these for you and
>> > you just "filled in the blanks" but I couldn't find it when I searched
>> > for it now.
>> >
>> > Louise
>>
>>
>>
>> None that I know of.
>> Can you describe what you want the batch file to do?
>>
>>
> I want it to open a program: Dragon Naturally Speaking
>
> Then I want it to wait about 45 seconds because Dragon has to load a
> user file.
>
> Then I want it to bring up the surround mixer which is one of the
> utilities from my Soundblaster Audigy 2ZS
>
> Then, if possible (and this is probably asking too much), I want it to
> remove the X from the line in box on the surround mixer, thereby
> activating the line-in for recording.
>
> I find I do this step by step a few times a day and I would love to get
> it automated.
>
> Louise
Anonymous
February 2, 2005 7:25:33 PM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

I dabble in VB and found your post fascinating. Thanks for taking the time.

Modem Ani

"David Candy" <.> wrote in message
news:uZuxfeOCFHA.208@TK2MSFTNGP12.phx.gbl...
Use script. You should also use AppActivate (to ensure keystrokes go where
you expect) and possibley Sleep (depends on the relationship of sending and
recieving programs). Copy line into a text file called whatever.vbs

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "%{TAB}^c%{TAB}^v"

[above sends Alt + Tab, Ctrl + C, Alt + Tab, then Ctrl + V]

or

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "calc"
WScript.Sleep 100
WshShell.AppActivate "Calculator"
WScript.Sleep 100
WshShell.SendKeys "1{+}"


Then set a shortcut to the scripts and set a hotkey for the shortcut (see
help)


Windows Script Host

SendKeys Method
See Also
WshShell Object | Run Method

Sends one or more keystrokes to the active window (as if typed on the
keyboard).

object.SendKeys(string)
Arguments
object
WshShell object.
string
String value indicating the keystroke(s) you want to send.
Remarks
Use the SendKeys method to send keystrokes to applications that have no
automation interface. Most keyboard characters are represented by a single
keystroke. Some keyboard characters are made up of combinations of
keystrokes (CTRL+SHIFT+HOME, for example). To send a single keyboard
character, send the character itself as the string argument. For example, to
send the letter x, send the string argument "x".

Note 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:

a.. plus sign "+",
b.. caret "^",
c.. percent sign "%",
d.. 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).

a.. To send bracket characters, send the string argument "{[}" for the
left bracket and "{]}" for the right one.
b.. 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 %

Note When used this way, these special characters are not enclosed
within a set of braces.
To specify that a combination of SHIFT, CTRL, and ALT should be held down
while several other keys are pressed, create a compound string argument with
the modified keystrokes enclosed in parentheses. For example, to send the
keystroke combination that specifies that the SHIFT key is held down while:

a.. e and c are pressed, send the string argument "+(ec)".
b.. e is pressed, followed by a lone c (with no SHIFT), send the string
argument "+ec".
You can use the SendKeys method to send a pattern of keystrokes that
consists of a single keystroke pressed several times in a row. To do this,
create a compound string argument that specifies the keystroke you want to
repeat, followed by the number of times you want it repeated. You do this
using a compound string argument of the form {keystroke number}. For
example, to send the letter "x" ten times, you would send the string
argument "{x 10}". Be sure to include a space between keystroke and number.

Note The only keystroke pattern you can send is the kind that is
comprised of a single keystroke pressed several times. For example, you can
send "x" ten times, but you cannot do the same for "Ctrl+x".
Note You cannot send the PRINT SCREEN key {PRTSC} to an application.
Example
The following example demonstrates the use of a single .wsf file for two
jobs in different script languages (VBScript and JScript). Each job runs the
Windows calculator and sends it keystrokes to execute a simple calculation.

<package>
<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "calc"
WScript.Sleep 100
WshShell.AppActivate "Calculator"
WScript.Sleep 100
WshShell.SendKeys "1{+}"
WScript.Sleep 500
WshShell.SendKeys "2"
WScript.Sleep 500
WshShell.SendKeys "~"
WScript.Sleep 500
WshShell.SendKeys "*3"
WScript.Sleep 500
WshShell.SendKeys "~"
WScript.Sleep 2500
</script>
</job>

<job id="js">
<script language="JScript">
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("calc");
WScript.Sleep(100);
WshShell.AppActivate("Calculator");
WScript.Sleep(100);
WshShell.SendKeys ("1{+}");
WScript.Sleep(500);
WshShell.SendKeys("2");
WScript.Sleep(500);
WshShell.SendKeys("~");
WScript.Sleep(500);
WshShell.SendKeys("*3");
WScript.Sleep(500);
WshShell.SendKeys("~");
WScript.Sleep(2500);
</script>
</job>
</package>
See Also
WshShell Object | Run Method


--
----------------------------------------------------------
http://www.uscricket.com
"Louise" <none@nospam.com> wrote in message
news:MPG.1c6a296383ff66119897db@news-server.nyc.rr.com...
> In article <eJg0yw7BFHA.2260@TK2MSFTNGP14.phx.gbl>, rbdietz_1999
> @yahoo.com says...
>> Louise wrote:
>> > In article <#EWsMBjBFHA.2392@TK2MSFTNGP14.phx.gbl>, tmatzner@gmx.net
>> > says...
>> >
>> >>Louise <none@nospam.com> wrote:
>> >>
>> >>
>> >>>I want to create a batch file, or a command file - I'm not sure what
>> >>>the
>> >>>correct terminology is.
>> >>>
>> >>>What I want to do is create an exe file which I can execute in windows
>> >>>when I choose to. I would want this file to bring up two different
>> >>>programs sequentially - waiting for the first to load its files before
>> >>>bringing up the second.
>> >>
>> >>That is a batch file. At a DOS prompt type
>> >>START /?
>> >>for help with this issue.
>> >>
>> >>
>> >
>> > Thanks - it looks complicated. Is there a dumb-down version? I
>> > thought
>> > I once remembered seeing a little program that created these for you
>> > and
>> > you just "filled in the blanks" but I couldn't find it when I searched
>> > for it now.
>> >
>> > Louise
>>
>>
>>
>> None that I know of.
>> Can you describe what you want the batch file to do?
>>
>>
> I want it to open a program: Dragon Naturally Speaking
>
> Then I want it to wait about 45 seconds because Dragon has to load a
> user file.
>
> Then I want it to bring up the surround mixer which is one of the
> utilities from my Soundblaster Audigy 2ZS
>
> Then, if possible (and this is probably asking too much), I want it to
> remove the X from the line in box on the surround mixer, thereby
> activating the line-in for recording.
>
> I find I do this step by step a few times a day and I would love to get
> it automated.
>
> Louise
Anonymous
February 2, 2005 7:54:39 PM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

I should just explain appactivate for louise. It is the titlebar text

WshShell.AppActivate "Calculator"

Calculator is what it shows in calc's titlebar.

I also suspect that one of the things she wishes to use is a system notification icon.
To move around the desktop toolbars, Taskbar, Notification Area and the Desktop - press Ctrl + Escape (or the Winkey) to activate Start, Escape to cancel the menu, then Tab and Shift + Tab to the various parts of the screen. Use the arrow keys to move within a section. Winkey + B jumps straight to the System Notification Area. To get a context menu of a blank part of the taskbar use the clock's context menu. Shift + F10 displays the context menu, Space or Enter activates.

--
----------------------------------------------------------
http://www.uscricket.com
"Modem Ani" <notquinoas@notmyrealbox.com> wrote in message news:%23dKdfpOCFHA.904@TK2MSFTNGP12.phx.gbl...
>I dabble in VB and found your post fascinating. Thanks for taking the time.
>
> Modem Ani
>
> "David Candy" <.> wrote in message
> news:uZuxfeOCFHA.208@TK2MSFTNGP12.phx.gbl...
> Use script. You should also use AppActivate (to ensure keystrokes go where
> you expect) and possibley Sleep (depends on the relationship of sending and
> recieving programs). Copy line into a text file called whatever.vbs
>
> set WshShell = WScript.CreateObject("WScript.Shell")
> WshShell.SendKeys "%{TAB}^c%{TAB}^v"
>
> [above sends Alt + Tab, Ctrl + C, Alt + Tab, then Ctrl + V]
>
> or
>
> set WshShell = WScript.CreateObject("WScript.Shell")
> WshShell.Run "calc"
> WScript.Sleep 100
> WshShell.AppActivate "Calculator"
> WScript.Sleep 100
> WshShell.SendKeys "1{+}"
>
>
> Then set a shortcut to the scripts and set a hotkey for the shortcut (see
> help)
>
>
> Windows Script Host
>
> SendKeys Method
> See Also
> WshShell Object | Run Method
>
> Sends one or more keystrokes to the active window (as if typed on the
> keyboard).
>
> object.SendKeys(string)
> Arguments
> object
> WshShell object.
> string
> String value indicating the keystroke(s) you want to send.
> Remarks
> Use the SendKeys method to send keystrokes to applications that have no
> automation interface. Most keyboard characters are represented by a single
> keystroke. Some keyboard characters are made up of combinations of
> keystrokes (CTRL+SHIFT+HOME, for example). To send a single keyboard
> character, send the character itself as the string argument. For example, to
> send the letter x, send the string argument "x".
>
> Note 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:
>
> a.. plus sign "+",
> b.. caret "^",
> c.. percent sign "%",
> d.. 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).
>
> a.. To send bracket characters, send the string argument "{[}" for the
> left bracket and "{]}" for the right one.
> b.. 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 %
>
> Note When used this way, these special characters are not enclosed
> within a set of braces.
> To specify that a combination of SHIFT, CTRL, and ALT should be held down
> while several other keys are pressed, create a compound string argument with
> the modified keystrokes enclosed in parentheses. For example, to send the
> keystroke combination that specifies that the SHIFT key is held down while:
>
> a.. e and c are pressed, send the string argument "+(ec)".
> b.. e is pressed, followed by a lone c (with no SHIFT), send the string
> argument "+ec".
> You can use the SendKeys method to send a pattern of keystrokes that
> consists of a single keystroke pressed several times in a row. To do this,
> create a compound string argument that specifies the keystroke you want to
> repeat, followed by the number of times you want it repeated. You do this
> using a compound string argument of the form {keystroke number}. For
> example, to send the letter "x" ten times, you would send the string
> argument "{x 10}". Be sure to include a space between keystroke and number.
>
> Note The only keystroke pattern you can send is the kind that is
> comprised of a single keystroke pressed several times. For example, you can
> send "x" ten times, but you cannot do the same for "Ctrl+x".
> Note You cannot send the PRINT SCREEN key {PRTSC} to an application.
> Example
> The following example demonstrates the use of a single .wsf file for two
> jobs in different script languages (VBScript and JScript). Each job runs the
> Windows calculator and sends it keystrokes to execute a simple calculation.
>
> <package>
> <job id="vbs">
> <script language="VBScript">
> set WshShell = WScript.CreateObject("WScript.Shell")
> WshShell.Run "calc"
> WScript.Sleep 100
> WshShell.AppActivate "Calculator"
> WScript.Sleep 100
> WshShell.SendKeys "1{+}"
> WScript.Sleep 500
> WshShell.SendKeys "2"
> WScript.Sleep 500
> WshShell.SendKeys "~"
> WScript.Sleep 500
> WshShell.SendKeys "*3"
> WScript.Sleep 500
> WshShell.SendKeys "~"
> WScript.Sleep 2500
> </script>
> </job>
>
> <job id="js">
> <script language="JScript">
> var WshShell = WScript.CreateObject("WScript.Shell");
> WshShell.Run("calc");
> WScript.Sleep(100);
> WshShell.AppActivate("Calculator");
> WScript.Sleep(100);
> WshShell.SendKeys ("1{+}");
> WScript.Sleep(500);
> WshShell.SendKeys("2");
> WScript.Sleep(500);
> WshShell.SendKeys("~");
> WScript.Sleep(500);
> WshShell.SendKeys("*3");
> WScript.Sleep(500);
> WshShell.SendKeys("~");
> WScript.Sleep(2500);
> </script>
> </job>
> </package>
> See Also
> WshShell Object | Run Method
>
>
> --
> ----------------------------------------------------------
> http://www.uscricket.com
> "Louise" <none@nospam.com> wrote in message
> news:MPG.1c6a296383ff66119897db@news-server.nyc.rr.com...
>> In article <eJg0yw7BFHA.2260@TK2MSFTNGP14.phx.gbl>, rbdietz_1999
>> @yahoo.com says...
>>> Louise wrote:
>>> > In article <#EWsMBjBFHA.2392@TK2MSFTNGP14.phx.gbl>, tmatzner@gmx.net
>>> > says...
>>> >
>>> >>Louise <none@nospam.com> wrote:
>>> >>
>>> >>
>>> >>>I want to create a batch file, or a command file - I'm not sure what
>>> >>>the
>>> >>>correct terminology is.
>>> >>>
>>> >>>What I want to do is create an exe file which I can execute in windows
>>> >>>when I choose to. I would want this file to bring up two different
>>> >>>programs sequentially - waiting for the first to load its files before
>>> >>>bringing up the second.
>>> >>
>>> >>That is a batch file. At a DOS prompt type
>>> >>START /?
>>> >>for help with this issue.
>>> >>
>>> >>
>>> >
>>> > Thanks - it looks complicated. Is there a dumb-down version? I
>>> > thought
>>> > I once remembered seeing a little program that created these for you
>>> > and
>>> > you just "filled in the blanks" but I couldn't find it when I searched
>>> > for it now.
>>> >
>>> > Louise
>>>
>>>
>>>
>>> None that I know of.
>>> Can you describe what you want the batch file to do?
>>>
>>>
>> I want it to open a program: Dragon Naturally Speaking
>>
>> Then I want it to wait about 45 seconds because Dragon has to load a
>> user file.
>>
>> Then I want it to bring up the surround mixer which is one of the
>> utilities from my Soundblaster Audigy 2ZS
>>
>> Then, if possible (and this is probably asking too much), I want it to
>> remove the X from the line in box on the surround mixer, thereby
>> activating the line-in for recording.
>>
>> I find I do this step by step a few times a day and I would love to get
>> it automated.
>>
>> Louise
>
February 3, 2005 11:58:33 PM

Archived from groups: microsoft.public.windowsxp.configuration_manage (More info?)

In article <OilNzuOCFHA.1404@TK2MSFTNGP11.phx.gbl>, "David Candy" <.>
says...
> I should just explain appactivate for louise. It is the titlebar text
>
> WshShell.AppActivate "Calculator"
>
> Calculator is what it shows in calc's titlebar.
>
> I also suspect that one of the things she wishes to use is a system =
> notification icon.=20
> To move around the desktop toolbars, Taskbar, Notification Area and the =
> Desktop - press Ctrl + Escape (or the Winkey) to activate Start, Escape =
> to cancel the menu, then Tab and Shift + Tab to the various parts of the =
> screen. Use the arrow keys to move within a section. Winkey + B jumps =
> straight to the System Notification Area. To get a context menu of a =
> blank part of the taskbar use the clock's context menu. Shift + F10 =
> displays the context menu, Space or Enter activates.
>
> --=20
> ----------------------------------------------------------
> http://www.uscricket.com
> "Modem Ani" <notquinoas@notmyrealbox.com> wrote in message =
> news:%23dKdfpOCFHA.904@TK2MSFTNGP12.phx.gbl...
> >I dabble in VB and found your post fascinating. Thanks for taking the =
> time.
> >=20
> > Modem Ani
> >=20
> > "David Candy" <.> wrote in message=20
> > news:uZuxfeOCFHA.208@TK2MSFTNGP12.phx.gbl...
> > Use script. You should also use AppActivate (to ensure keystrokes go =
> where=20
> > you expect) and possibley Sleep (depends on the relationship of =
> sending and=20
> > recieving programs). Copy line into a text file called whatever.vbs
> >=20
> > set WshShell =3D WScript.CreateObject("WScript.Shell")
> > WshShell.SendKeys "%{TAB}^c%{TAB}^v"
> >=20
> > [above sends Alt + Tab, Ctrl + C, Alt + Tab, then Ctrl + V]
> >=20
> > or
> >=20
> > set WshShell =3D WScript.CreateObject("WScript.Shell")
> > WshShell.Run "calc"
> > WScript.Sleep 100
> > WshShell.AppActivate "Calculator"
> > WScript.Sleep 100
> > WshShell.SendKeys "1{+}"
> >=20
> >=20
> > Then set a shortcut to the scripts and set a hotkey for the shortcut =
Thanks so much - I will try....

Louise
!