Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: sendkey keystroke key send dos file function call flashes black
run("MYDOS.BAT", "")The SendKeysTo function makes sure the window you want is on top (activated) first. The SendKey function sends blindly to whatever window is on top.
Sendkeysto("Microsoft Word", "!fo") ; send File Open keystrokes
SendKeysto("Microsoft Word", "^+{F7}")
SendKeysto("Microsoft Word","{* 20}")
SendKeysto("Microsoft Word","{DOWN 8}")It is possible to use SendKey to send keystrokes to a DOS application, but only if you are running Windows in 386 Enhanced mode. You would then transfer the keystrokes to the DOS application via the Clipboard. It is only possible to send standard ASCII characters to DOS applications; you cannot send function key or Alt-key combinations.
; start Notepad, and use *.* for filenames Run("notepad.exe", "") SendKey("!fo*.*~") ; run DOS batch file which starts our editor Run("edit.bat", "") ; wait 15 seconds for editor to load Timedelay(15) ; send string (with carriage return) to the clipboard ClipPut("Hello%@crlf%") ; paste contents of clipboard to DOS window SendKey("!{SP}ep")
In those cases where you have an application which can accept text pasted in from the clipboard, it will often be more efficient to use the ClipGet function:
Run("notepad.exe", "") ; copy some text to the clipboard ClipPut("Dear Sirs:%@crlf%%@crlf%") ; paste the text into Notepad (using Shift-Ins) SendKey("+{INSERT}")A WIL program cannot send keystrokes to its own WIL Interpreter window.
Note: If your SendKey statement doesn't seem to be working (eg., all you get are beeping noises), you may need to place a WinActivate statement before the SendKey statement to insure that you are sending the keystrokes to the correct window.
See Also:
ClipGet, SnapShot, WinActivate
SendKey("!(SP)EP")everything works perfectly except no sendkey!
More info..............
SendKey("!{SP}EP")Actually the following will also work:
SendKey("! EP") ;<<<- when you just type a space for a spaceAlso as a point of nitpicking:
SendKey("! EP")is the same as:
However, I don't really think you're supposed to do it that way. So instead use the lower case example:
SendKey("! ep")
Clipput("c:\temp\xyz.txt") SendKey("! ep") ; Alt space E P
Article ID: W12902
Filename: Sending Keystrokes to DOS Apps and Blanked Screen.txt
File Created: 1999:04:15:16:50:24
Last Updated: 1999:04:15:16:50:24