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. |
|
|
Thread Tools | Display Modes |
#21
|
|||
|
|||
Keyboard Redirection in a DOS batch file?
On May 7, 12:05*pm, "Bill in Co."
wrote: Bill Blanton wrote: On 5/6/2010 23:40, Bill in Co. wrote: Does anyone know how to do this in a DOS batch file? Normally when I run this windows online program and am finished and close it down, I have to then type "S" to stay connected online (otherwise, the default behavior is to disconnect from being online (I'm using dial-up). 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. Not a exactly a batch, but you could use vbs script instead. (save send.vbs, etc) Set oShell = WScript.CreateObject("WScript.Shell") oShell.Run("notepad") WScript.Sleep(3000) * * * 'wait (3 seconds (# milliseconds)) oShell.Sendkeys "S" WScript.Sleep(2000) oShell.Sendkeys"{ENTER}" In retrospect, I think what I am trying to do is impossible. * Let me explain: Ever since installing IE8 (or IE7), whenever I go to check mail and close OE, it (annoyingly) prompts me to disconnect from being online. *And, in retrospect, I don't think there is a way to "intercept" that, unless I completely turn off autodisconnect. It never did this in IE6. * It wouldn't prompt me to disconnect until I closed down IE (assuming IE was also online as it normally would be). Sure, I can disable the autodisconnect option, but that's just as annoying, as it forces you to manually disconnect. After I (dial-up) connect online (with IE), I simply want to be able to go to OE and check my mail or the newsgroups, close OE and go back to IE to browse, and THEN when I close IE, get the disconnect prompt, as it used to be with IE6. *Guess it ain't gonna happen. May not apply, but doesn't IE allow you to set whether you go offline, or not? For me, it took a long time to find where to put IE BACK tohanging up automatically, kept wanting to change to stay on line. |
#22
|
|||
|
|||
Keyboard Redirection in a DOS batch file?
Robert Macy wrote:
On May 7, 12:05 pm, "Bill in Co." wrote: Bill Blanton wrote: On 5/6/2010 23:40, Bill in Co. wrote: Does anyone know how to do this in a DOS batch file? Normally when I run this windows online program and am finished and close it down, I have to then type "S" to stay connected online (otherwise, the default behavior is to disconnect from being online (I'm using dial-up). 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. Not a exactly a batch, but you could use vbs script instead. (save send.vbs, etc) Set oShell = WScript.CreateObject("WScript.Shell") oShell.Run("notepad") WScript.Sleep(3000) 'wait (3 seconds (# milliseconds)) oShell.Sendkeys "S" WScript.Sleep(2000) oShell.Sendkeys"{ENTER}" In retrospect, I think what I am trying to do is impossible. Let me explain: Ever since installing IE8 (or IE7), whenever I go to check mail and close OE, it (annoyingly) prompts me to disconnect from being online. And, in retrospect, I don't think there is a way to "intercept" that, unless I completely turn off autodisconnect. It never did this in IE6. It wouldn't prompt me to disconnect until I closed down IE (assuming IE was also online as it normally would be). Sure, I can disable the autodisconnect option, but that's just as annoying, as it forces you to manually disconnect. After I (dial-up) connect online (with IE), I simply want to be able to go to OE and check my mail or the newsgroups, close OE and go back to IE to browse, and THEN when I close IE, get the disconnect prompt, as it used to be with IE6. Guess it ain't gonna happen. May not apply, but doesn't IE allow you to set whether you go offline, or not? For me, it took a long time to find where to put IE BACK to hanging up automatically, kept wanting to change to stay on line. I am only aware of the option as to whether or not to use autodisconnect, which I think is about the same thing. (like the: "disconnect when connection is no longer needed" checkbox) If you deselect it, then it always stays online, unless and until you manually disconnect (easiest to do in the taskbar). If you select the autodisconnect option, then as soon as you close IE (or evidently OE, in IE 7/8), you will get the disconnect prompt. |
#23
|
|||
|
|||
Keyboard Redirection in a DOS batch file?
Robert Macy wrote:
On May 7, 12:05 pm, "Bill in Co." wrote: Bill Blanton wrote: On 5/6/2010 23:40, Bill in Co. wrote: Does anyone know how to do this in a DOS batch file? Normally when I run this windows online program and am finished and close it down, I have to then type "S" to stay connected online (otherwise, the default behavior is to disconnect from being online (I'm using dial-up). 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. Not a exactly a batch, but you could use vbs script instead. (save send.vbs, etc) Set oShell = WScript.CreateObject("WScript.Shell") oShell.Run("notepad") WScript.Sleep(3000) 'wait (3 seconds (# milliseconds)) oShell.Sendkeys "S" WScript.Sleep(2000) oShell.Sendkeys"{ENTER}" In retrospect, I think what I am trying to do is impossible. Let me explain: Ever since installing IE8 (or IE7), whenever I go to check mail and close OE, it (annoyingly) prompts me to disconnect from being online. And, in retrospect, I don't think there is a way to "intercept" that, unless I completely turn off autodisconnect. It never did this in IE6. It wouldn't prompt me to disconnect until I closed down IE (assuming IE was also online as it normally would be). Sure, I can disable the autodisconnect option, but that's just as annoying, as it forces you to manually disconnect. After I (dial-up) connect online (with IE), I simply want to be able to go to OE and check my mail or the newsgroups, close OE and go back to IE to browse, and THEN when I close IE, get the disconnect prompt, as it used to be with IE6. Guess it ain't gonna happen. May not apply, but doesn't IE allow you to set whether you go offline, or not? For me, it took a long time to find where to put IE BACK to hanging up automatically, kept wanting to change to stay on line. I am only aware of the option as to whether or not to use autodisconnect, which I think is about the same thing. (like the: "disconnect when connection is no longer needed" checkbox) If you deselect it, then it always stays online, unless and until you manually disconnect (easiest to do in the taskbar). If you select the autodisconnect option, then as soon as you close IE (or evidently OE, in IE 7/8), you will get the disconnect prompt. |
#24
|
|||
|
|||
Keyboard Redirection in a DOS batch file?
On 5/7/2010 15:05, Bill in Co. wrote:
Bill Blanton wrote: On 5/6/2010 23:40, Bill in Co. wrote: Does anyone know how to do this in a DOS batch file? Normally when I run this windows online program and am finished and close it down, I have to then type "S" to stay connected online (otherwise, the default behavior is to disconnect from being online (I'm using dial-up). 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. Not a exactly a batch, but you could use vbs script instead. (save send.vbs, etc) Set oShell = WScript.CreateObject("WScript.Shell") oShell.Run("notepad") WScript.Sleep(3000) 'wait (3 seconds (# milliseconds)) oShell.Sendkeys "S" WScript.Sleep(2000) oShell.Sendkeys"{ENTER}" In retrospect, I think what I am trying to do is impossible. I missed the part about sending the char when you _close_ the program. In vbs you can call a program, and set a flag to suspend script execution until the program returns. After the return, the script resumes execution. Perhaps you could use that. dim oShell Set oShell=WScript.CreateObject("WScript.Shell") oShell.Run "notepad ", 1, TRUE oShell.Sendkeys "S" In this case an "S" would be sent to whatever Window has focus after notepad closes. From my notes: 'Syntax 'oShell.Run strCommand, [intWindowStype], [bWaitOnReturn] 'Parameters ' strCommand ' Environment variables within the strCommand parameter are automatically expanded. ' intWindowSType ' ' Likely this. ' ' Value Window Style ' --------------------------------- ' 1, 5, 9 Normal with focus ' 2 Minimized with focus ' 3 Maximized with focus ' 4, 8 Normal without focus ' 6, 7 Minimized without focus ' ' bWaitOnReturn ' If bWaitOnReturn is not specified or FALSE, this method immediately returns to script ' ' ' execution rather than waiting on the process termination. ' If bWaitOnReturn is set to TRUE, the Run method returns any error code returned by ' ' the application. ' If bWaitOnReturn is not specified or is FALSE, Run returns an error code of 0 (zero). Let me explain: Ever since installing IE8 (or IE7), whenever I go to check mail and close OE, it (annoyingly) prompts me to disconnect from being online. And, in retrospect, I don't think there is a way to "intercept" that, unless I completely turn off autodisconnect. It never did this in IE6. It wouldn't prompt me to disconnect until I closed down IE (assuming IE was also online as it normally would be). Sure, I can disable the autodisconnect option, but that's just as annoying, as it forces you to manually disconnect. After I (dial-up) connect online (with IE), I simply want to be able to go to OE and check my mail or the newsgroups, close OE and go back to IE to browse, and THEN when I close IE, get the disconnect prompt, as it used to be with IE6. Guess it ain't gonna happen. 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. |
#25
|
|||
|
|||
Keyboard Redirection in a DOS batch file?
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. |
#26
|
|||
|
|||
Keyboard Redirection in a DOS batch file?
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. |
#27
|
|||
|
|||
Keyboard Redirection in a DOS batch file?
On 5/7/2010 20:35, Bill Blanton wrote:
dim oShell Set oShell=WScript.CreateObject("WScript.Shell") oShell.Run "notepad ", 1, TRUE WScript.Sleep(3000) 'wait (3 seconds (# milliseconds)) oShell.Sendkeys "S" Perhgaps add time delay between program closing and sendkey. |
#28
|
|||
|
|||
Keyboard Redirection in a DOS batch file?
On 5/7/2010 20:35, Bill Blanton wrote: dim oShell Set oShell=WScript.CreateObject("WScript.Shell") oShell.Run "notepad ", 1, TRUE WScript.Sleep(3000) 'wait (3 seconds (# milliseconds)) oShell.Sendkeys "S" Perhgaps add time delay between program closing and sendkey. |
#29
|
|||
|
|||
Keyboard Redirection in a DOS batch file?
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. I see that's true, I pulled out some old DOS books thinking the method was worth a re-look. I see you've fixed the script, which should work better in the newer OS for what he wanted, and is a heck of a lot simpler. -- MEB http://peoplescounsel.org/ref/windows-main.htm Windows Info, Diagnostics, Security, Networking http://peoplescounsel.org The "real world" of Law, Justice, and Government ___--- |
#30
|
|||
|
|||
Keyboard Redirection in a DOS batch file?
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. I see that's true, I pulled out some old DOS books thinking the method was worth a re-look. I see you've fixed the script, which should work better in the newer OS for what he wanted, and is a heck of a lot simpler. -- 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 | |
|
|
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 |