Discussion:
Sendkeys Spacebar
(too old to reply)
Luis Miguel
2004-04-02 12:28:13 UTC
Permalink
I need to copy the text from a Telnet session in a DOS window. I want to
activate the Control Menu to select Edit-Select All and then copy it, but I
can't find a way to do this.

I have googled it extensively and I have not found a way to put together the
keys Alt+Spacebar using Sendkeys. Apparently VBS does not have a code the
spacebar like it has for Enter and Alt.

Is this possible? Do you know of any other way to achieve this objective?

Thanks,

Luis.
Stivie S.
2004-04-02 12:46:02 UTC
Permalink
Hi Luis

please have a look at the "SendKeys" documentation in the MSDN library. Here you'll find information on how to send more than one character at a time, and how to send a "space" to an application. You can find the documentation here

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsendkeys.asp
Luis Miguel
2004-04-06 16:42:54 UTC
Permalink
Thanks for your reply. I looked in MSDN, but as far as I can see there is no
documented way of simulating the pressing of the space bar (in
VBScript/WSH), which is what I need. I'm not trying to send a space. I was
hoping I could achieve this using the resources available in the OS but I'm
convinced I'll have to use a third party tool like AuotIt.



Appreciated,



Luis.
Hi Luis,
please have a look at the "SendKeys" documentation in the MSDN library.
Here you'll find information on how to send more than one character at a
time, and how to send a "space" to an application. You can find the
documentation here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthsendkeys.asp
Harvey Colwell
2004-04-08 13:54:33 UTC
Permalink
Just put a blank spave between two double quotes. I've used this is some of
my scripts.

oWS.SendKeys " "
Post by Luis Miguel
Thanks for your reply. I looked in MSDN, but as far as I can see there is no
documented way of simulating the pressing of the space bar (in
VBScript/WSH), which is what I need. I'm not trying to send a space. I was
hoping I could achieve this using the resources available in the OS but I'm
convinced I'll have to use a third party tool like AuotIt.
Christine MacKenzie
2004-05-05 14:17:20 UTC
Permalink
Luis, It seems we're working on a similar issue...

objShell.SendKeys "% " seems to work for most windows, but not when
trying to select this in a command prompt window after issuing a telnet
command.

Did you somehow solve this problem? Were you able to write a VBScript
that gets the result of a telnet command?




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Torgeir Bakken (MVP)
2004-05-05 15:47:31 UTC
Permalink
Post by Christine MacKenzie
Luis, It seems we're working on a similar issue...
objShell.SendKeys "% " seems to work for most windows, but not when
trying to select this in a command prompt window after issuing a telnet
command.
Did you somehow solve this problem? Were you able to write a VBScript
that gets the result of a telnet command?
Hi

For a Sendkeys solution that might work better for this scenario,
you should use AutoIt or AutoItX.

AutoIt/AutoItX is free and can be found here:
http://www.hiddensoft.com/AutoIt/


AutoItX is an ActiveX control version of AutoIt and can be used
from a vbscript.
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/community/scriptcenter/default.mspx
Christine MacKenzie
2004-05-05 18:47:50 UTC
Permalink
We've been experimenting with AutoIT, and so far have not succeeded in
getting telnet's output on Windows 2000 using this approach. Luis, were
you ever able to get the solution you were working on completed?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
larrydalooza
2004-05-06 05:12:05 UTC
Permalink
Post by Christine MacKenzie
We've been experimenting with AutoIT, and so far have not succeeded in
getting telnet's output on Windows 2000 using this approach. Luis, were
you ever able to get the solution you were working on completed?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
http://www.hiddensoft.com/autoit3/

Get AutoIt3. I am the expert. Here is an example.

Opt("WinTitleMatchMode",4)

Run("telnet")
WinWait(@SYSTEMDIR & "\telnet.exe")
$hWnd = "handle=" & WinGetHandle(@SYSTEMDIR & "\telnet.exe")

Sleep(1000)
ControlSend($hWnd,"","","!{SPACE}es{ENTER}")
$text = ClipGet()
MsgBox(4096,"",$text)
larrydalooza
2004-05-06 05:20:43 UTC
Permalink
Post by Christine MacKenzie
We've been experimenting with AutoIT, and so far have not succeeded in
getting telnet's output on Windows 2000 using this approach. Luis, were
you ever able to get the solution you were working on completed?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
get http://www.hiddensoft.com/autoit3/

This is a tad more reliable for slower PCs

Opt("WinTitleMatchMode",4)
Opt("SendKeyDelay",500)

Run("telnet")
WinWait(@SYSTEMDIR & "\telnet.exe")
$hWnd = "handle=" & WinGetHandle(@SYSTEMDIR & "\telnet.exe")

Sleep(1000)
ControlSend($hWnd,"","","!{SPACE}es{ENTER}")
$text = ClipGet()
MsgBox(4096,"",$text)

Fosco
2004-04-05 05:07:41 UTC
Permalink
"Luis Miguel"

set oShell = CreateObject("WScript.Shell")
oShell.run"notepad"
WScript.Sleep 500
oShell.SendKeys" this is a spacebar> <"
oShell.SendKeys" this also" & chr(32)
WScript.Sleep 500
oShell.SendKeys chr(32)
WScript.Sleep 500
oShell.SendKeys chr(32)
WScript.Sleep 500
oShell.SendKeys" "
WScript.Sleep 1500
oShell.SendKeys"% "

--
Fosco
Continue reading on narkive:
Loading...