A Windows 98 & ME forum. Win98banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Win98banter forum » Windows 98 » General
Site Map Home Authors List Search Today's Posts Mark Forums Read Web Partners

Keyboard Redirection in a DOS batch file?



 
 
Thread Tools Display Modes
  #41  
Old May 8th 10, 01:44 PM posted to microsoft.public.win98.gen_discussion
Bill Blanton
External Usenet User
 
Posts: 441
Default Keyboard Redirection in a DOS batch file?

On 5/7/2010 23:24, Bill in Co. wrote:
Updated below:

Bill in Co. wrote:
Bill Blanton wrote:



dim oShell
Set oShell=WScript.CreateObject("WScript.Shell")
oShell.Run "notepad ", 1, TRUE
WScript.Sleep(3000) 'wait (3 seconds (# milliseconds)) (added as you
said) oShell.Sendkeys "S"

In this case an "S" would be sent to whatever Window has focus after
notepad closes.


Remember, I am simply closing down OE with the mouse, and then, somehow,
need an "S" (for stay connected) to automatically be sent to "answer" that
disconnect prompt.


OK, I just tried this out (put it in a .vbs text file, etc), and when I run
it, it brings up OE fine, but it does NOT wait until I close OE to send the
"S". Instead, after 3 seconds, it evidently sends an "S", which doesn't
do any good.


Not sure what's going on there. I just tried the above (copied with your
edit). Ran it from Ultra-edit. It opened notpad. I closed notepad and
after 3 seconds it printed an "S" in UE's window. Perhaps it has
something to do with OE linking to the html engine. Probably a bad WAG.


When I was on dialup, I would try to keep it always connected. My ISP
would auto-disconnect me after 10 minutes (or something) if there was no
activity. So I set OE to check for mail every 8 minutes, and left OE
open all the time.


I could do that, but I'd really prefer not to!! :-) Especially since I
only have one phone line here (and no cell phone).


Oh yea, that's definitely a prerequisite.



  #42  
Old May 8th 10, 01:44 PM posted to microsoft.public.win98.gen_discussion
Bill Blanton
External Usenet User
 
Posts: 441
Default Keyboard Redirection in a DOS batch file?

On 5/7/2010 23:24, Bill in Co. wrote:
Updated below:

Bill in Co. wrote:
Bill Blanton wrote:



dim oShell
Set oShell=WScript.CreateObject("WScript.Shell")
oShell.Run "notepad ", 1, TRUE
WScript.Sleep(3000) 'wait (3 seconds (# milliseconds)) (added as you
said) oShell.Sendkeys "S"

In this case an "S" would be sent to whatever Window has focus after
notepad closes.


Remember, I am simply closing down OE with the mouse, and then, somehow,
need an "S" (for stay connected) to automatically be sent to "answer" that
disconnect prompt.


OK, I just tried this out (put it in a .vbs text file, etc), and when I run
it, it brings up OE fine, but it does NOT wait until I close OE to send the
"S". Instead, after 3 seconds, it evidently sends an "S", which doesn't
do any good.


Not sure what's going on there. I just tried the above (copied with your
edit). Ran it from Ultra-edit. It opened notpad. I closed notepad and
after 3 seconds it printed an "S" in UE's window. Perhaps it has
something to do with OE linking to the html engine. Probably a bad WAG.


When I was on dialup, I would try to keep it always connected. My ISP
would auto-disconnect me after 10 minutes (or something) if there was no
activity. So I set OE to check for mail every 8 minutes, and left OE
open all the time.


I could do that, but I'd really prefer not to!! :-) Especially since I
only have one phone line here (and no cell phone).


Oh yea, that's definitely a prerequisite.



  #43  
Old May 8th 10, 01:48 PM posted to microsoft.public.win98.gen_discussion
Bill Blanton
External Usenet User
 
Posts: 441
Default Keyboard Redirection in a DOS batch file?

On 5/8/2010 04:05, Bill in Co. wrote:
MEB wrote:
On 05/08/2010 12:34 AM, Bill in Co. wrote:
OK. Thanks Bill, I finally got it to work by adding a DO loop to check
for
the Auto Disconnect event. It pretty much works. :-)


If you don't mind, could you post the final script for others to
potentially use?


Sure. I'm using OE-QuoteFix, and that's where I put this vbs file (in its
Program Files subdirectory). I got some ideas from what Bill said (thanks
Bill!), and a Microsoft website article discussing vbs scripts, which also
covered the DO loop construct.

The time delays seemed to be needed, otherwise the disconnect prompt
sometimes still shows up. (I tried reducing them, and got some
inconsistent performance).

Contents of the vbs file:

dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "OElaunch.exe" (or call msimn.exe, or whatever)
Success = False
Do Until Success = True
Success = objShell.AppActivate("Auto Disconnect") (title bar of message
box)
Wscript.Sleep 1000 (wait 1000 ms)
Loop
Wscript.Sleep 1000 (wait 1000 ms)
objShell.SendKeys "S"


Excellent!
;-)

  #44  
Old May 8th 10, 01:48 PM posted to microsoft.public.win98.gen_discussion
Bill Blanton
External Usenet User
 
Posts: 441
Default Keyboard Redirection in a DOS batch file?

On 5/8/2010 04:05, Bill in Co. wrote:
MEB wrote:
On 05/08/2010 12:34 AM, Bill in Co. wrote:
OK. Thanks Bill, I finally got it to work by adding a DO loop to check
for
the Auto Disconnect event. It pretty much works. :-)


If you don't mind, could you post the final script for others to
potentially use?


Sure. I'm using OE-QuoteFix, and that's where I put this vbs file (in its
Program Files subdirectory). I got some ideas from what Bill said (thanks
Bill!), and a Microsoft website article discussing vbs scripts, which also
covered the DO loop construct.

The time delays seemed to be needed, otherwise the disconnect prompt
sometimes still shows up. (I tried reducing them, and got some
inconsistent performance).

Contents of the vbs file:

dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "OElaunch.exe" (or call msimn.exe, or whatever)
Success = False
Do Until Success = True
Success = objShell.AppActivate("Auto Disconnect") (title bar of message
box)
Wscript.Sleep 1000 (wait 1000 ms)
Loop
Wscript.Sleep 1000 (wait 1000 ms)
objShell.SendKeys "S"


Excellent!
;-)

  #45  
Old May 8th 10, 01:48 PM posted to microsoft.public.win98.gen_discussion
Bill Blanton
External Usenet User
 
Posts: 441
Default Keyboard Redirection in a DOS batch file?

On 5/7/2010 21:29, MEB wrote:
On 05/07/2010 08:43 PM, Bill Blanton wrote:
On 5/7/2010 13:24, MEB wrote:
On 05/06/2010 11:40 PM, Bill in Co. wrote:
Does anyone know how to do this in a DOS batch file?

So instead, I'm creating a batch file to run (call up) that program,
so that
when I close the program, I want the batch file to send the "S"
character to
the keyboard buffer automatically, so I don't have to type it in each
and
every time.



Wouldn't you need to setup a loop based upon errorlevels and with a
pause [waiting for the close return] or timed [repeating the test after
a defined period], and then send con the ansii 115 {s} with a
return/enter when your application returned the closed errorlevel or it
ceased to exist?


Or use
CALL OTHER.BAT
which would contain the executable. The original .bat will suspend
execution until OTHER.BAT returns.


Oh forgot to add, wouldn't he need something monitoring both OE and IE
since he indicated OE closed the connection and he wanted a choice with
IE or did I misconstrue the intent from the posts.


Probably doable though it might get messy. Launch both and set up two
return flags. When both flags are true, both haved closed.


  #46  
Old May 8th 10, 01:48 PM posted to microsoft.public.win98.gen_discussion
Bill Blanton
External Usenet User
 
Posts: 441
Default Keyboard Redirection in a DOS batch file?

On 5/7/2010 21:29, MEB wrote:
On 05/07/2010 08:43 PM, Bill Blanton wrote:
On 5/7/2010 13:24, MEB wrote:
On 05/06/2010 11:40 PM, Bill in Co. wrote:
Does anyone know how to do this in a DOS batch file?

So instead, I'm creating a batch file to run (call up) that program,
so that
when I close the program, I want the batch file to send the "S"
character to
the keyboard buffer automatically, so I don't have to type it in each
and
every time.



Wouldn't you need to setup a loop based upon errorlevels and with a
pause [waiting for the close return] or timed [repeating the test after
a defined period], and then send con the ansii 115 {s} with a
return/enter when your application returned the closed errorlevel or it
ceased to exist?


Or use
CALL OTHER.BAT
which would contain the executable. The original .bat will suspend
execution until OTHER.BAT returns.


Oh forgot to add, wouldn't he need something monitoring both OE and IE
since he indicated OE closed the connection and he wanted a choice with
IE or did I misconstrue the intent from the posts.


Probably doable though it might get messy. Launch both and set up two
return flags. When both flags are true, both haved closed.


  #47  
Old May 8th 10, 06:43 PM posted to microsoft.public.win98.gen_discussion
MEB[_17_]
External Usenet User
 
Posts: 1,830
Default Keyboard Redirection in a DOS batch file?

On 05/08/2010 08:48 AM, Bill Blanton wrote:
On 5/8/2010 04:05, Bill in Co. wrote:
MEB wrote:
On 05/08/2010 12:34 AM, Bill in Co. wrote:
OK. Thanks Bill, I finally got it to work by adding a DO loop to
check
for
the Auto Disconnect event. It pretty much works. :-)


If you don't mind, could you post the final script for others to
potentially use?


Sure. I'm using OE-QuoteFix, and that's where I put this vbs file (in
its
Program Files subdirectory). I got some ideas from what Bill said
(thanks
Bill!), and a Microsoft website article discussing vbs scripts, which
also
covered the DO loop construct.

The time delays seemed to be needed, otherwise the disconnect prompt
sometimes still shows up. (I tried reducing them, and got some
inconsistent performance).

Contents of the vbs file:

dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "OElaunch.exe" (or call msimn.exe, or whatever)
Success = False
Do Until Success = True
Success = objShell.AppActivate("Auto Disconnect") (title bar of
message
box)
Wscript.Sleep 1000 (wait 1000 ms)
Loop
Wscript.Sleep 1000 (wait 1000 ms)
objShell.SendKeys "S"


Excellent!
;-)

+1

Yeah, thanks Bill, err, Bill in CO. for the final version, and Bill B.
for the script code from which to work.

--
MEB
  #48  
Old May 8th 10, 06:43 PM posted to microsoft.public.win98.gen_discussion
MEB[_17_]
External Usenet User
 
Posts: 1,830
Default Keyboard Redirection in a DOS batch file?


On 05/08/2010 08:48 AM, Bill Blanton wrote:
On 5/8/2010 04:05, Bill in Co. wrote:
MEB wrote:
On 05/08/2010 12:34 AM, Bill in Co. wrote:
OK. Thanks Bill, I finally got it to work by adding a DO loop to
check
for
the Auto Disconnect event. It pretty much works. :-)


If you don't mind, could you post the final script for others to
potentially use?


Sure. I'm using OE-QuoteFix, and that's where I put this vbs file (in
its
Program Files subdirectory). I got some ideas from what Bill said
(thanks
Bill!), and a Microsoft website article discussing vbs scripts, which
also
covered the DO loop construct.

The time delays seemed to be needed, otherwise the disconnect prompt
sometimes still shows up. (I tried reducing them, and got some
inconsistent performance).

Contents of the vbs file:

dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "OElaunch.exe" (or call msimn.exe, or whatever)
Success = False
Do Until Success = True
Success = objShell.AppActivate("Auto Disconnect") (title bar of
message
box)
Wscript.Sleep 1000 (wait 1000 ms)
Loop
Wscript.Sleep 1000 (wait 1000 ms)
objShell.SendKeys "S"


Excellent!
;-)

+1

Yeah, thanks Bill, err, Bill in CO. for the final version, and Bill B.
for the script code from which to work.

--
MEB
  #49  
Old May 8th 10, 06:57 PM posted to microsoft.public.win98.gen_discussion
MEB[_17_]
External Usenet User
 
Posts: 1,830
Default Keyboard Redirection in a DOS batch file?

On 05/08/2010 08:48 AM, Bill Blanton wrote:
On 5/7/2010 21:29, MEB wrote:
On 05/07/2010 08:43 PM, Bill Blanton wrote:
On 5/7/2010 13:24, MEB wrote:
On 05/06/2010 11:40 PM, Bill in Co. wrote:
Does anyone know how to do this in a DOS batch file?

So instead, I'm creating a batch file to run (call up) that program,
so that
when I close the program, I want the batch file to send the "S"
character to
the keyboard buffer automatically, so I don't have to type it in each
and
every time.


Wouldn't you need to setup a loop based upon errorlevels and with a
pause [waiting for the close return] or timed [repeating the test after
a defined period], and then send con the ansii 115 {s} with a
return/enter when your application returned the closed errorlevel or it
ceased to exist?

Or use
CALL OTHER.BAT
which would contain the executable. The original .bat will suspend
execution until OTHER.BAT returns.


Oh forgot to add, wouldn't he need something monitoring both OE and IE
since he indicated OE closed the connection and he wanted a choice with
IE or did I misconstrue the intent from the posts.


Probably doable though it might get messy. Launch both and set up two
return flags. When both flags are true, both haved closed.



Yeah that would work even in a batch, though you would apparently need
to run a check and, if and ifnot on both intervaled or maybe sublooped,
and maybe more. Messy as you say from my quick re-read on batch, and
definitely not as easy as you two have now shown with the script. It
would be interesting to see a script version where the IE and OE is/is
not issue is addressed. But anyway, thanks guys...

--
MEB
http://peoplescounsel.org/ref/windows-main.htm
Windows Info, Diagnostics, Security, Networking
http://peoplescounsel.org
The "real world" of Law, Justice, and Government
___---
  #50  
Old May 8th 10, 06:57 PM posted to microsoft.public.win98.gen_discussion
MEB[_17_]
External Usenet User
 
Posts: 1,830
Default Keyboard Redirection in a DOS batch file?

On 05/08/2010 08:48 AM, Bill Blanton wrote:
On 5/7/2010 21:29, MEB wrote:
On 05/07/2010 08:43 PM, Bill Blanton wrote:
On 5/7/2010 13:24, MEB wrote:
On 05/06/2010 11:40 PM, Bill in Co. wrote:
Does anyone know how to do this in a DOS batch file?

So instead, I'm creating a batch file to run (call up) that program,
so that
when I close the program, I want the batch file to send the "S"
character to
the keyboard buffer automatically, so I don't have to type it in each
and
every time.


Wouldn't you need to setup a loop based upon errorlevels and with a
pause [waiting for the close return] or timed [repeating the test after
a defined period], and then send con the ansii 115 {s} with a
return/enter when your application returned the closed errorlevel or it
ceased to exist?

Or use
CALL OTHER.BAT
which would contain the executable. The original .bat will suspend
execution until OTHER.BAT returns.


Oh forgot to add, wouldn't he need something monitoring both OE and IE
since he indicated OE closed the connection and he wanted a choice with
IE or did I misconstrue the intent from the posts.


Probably doable though it might get messy. Launch both and set up two
return flags. When both flags are true, both haved closed.



Yeah that would work even in a batch, though you would apparently need
to run a check and, if and ifnot on both intervaled or maybe sublooped,
and maybe more. Messy as you say from my quick re-read on batch, and
definitely not as easy as you two have now shown with the script. It
would be interesting to see a script version where the IE and OE is/is
not issue is addressed. But anyway, thanks guys...

--
MEB
http://peoplescounsel.org/ref/windows-main.htm
Windows Info, Diagnostics, Security, Networking
http://peoplescounsel.org
The "real world" of Law, Justice, and Government
___---
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dos Batch File Edward General 17 November 29th 07 07:56 PM
Batch file for IE 6 - 5.5 dll replacement (explorer hang issue with bulk move/delete file operations) Ivan Bútora General 5 December 16th 05 01:58 AM
internet explorer....redirection rickoh General 3 August 11th 04 04:20 AM
Batch file syntax Rednelle General 4 July 11th 04 11:30 AM
Making Batch File Farhan General 1 June 28th 04 08:30 AM


All times are GMT +1. The time now is 10:04 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Win98banter.
The comments are property of their posters.