The following works for me on Win98SE. It opens
Notepad, writes some text, opens the SaveAs dialogue,
then saves the text as Sendkeys Demo.txt in the
default folder. (Usually My Documents.)
I seem to remember something about a problem
with Sendkeys on Vista, though. There might be
security issues or some such. You'll need to test it.
Dim sh
Set sh = CreateObject("WScript.Shell")
sh.Run "notepad.exe"
Do Until sh.AppActivate("Untitled - Notepad")
Loop
sh.SendKeys "Demonstration of Sendkeys. This file will be saved as SendKeys
Demo.txt in My Documents."
'-- Alt-file-SaveAs(%Fa) - opens the SaveAs dialogue.
'-- backspace deletes the default file title (focus is on the file title
textbox).
'-- new file title: "SendKeys Demo".
'-- ~ activates the Save button.
sh.SendKeys "%Fa{backspace}SendKeys Demo~"
set sh = nothing
Quote:
> I have various .vbs files in which (using AutoIt's ClipPut method) I put a
> string into the Clipboard and then paste the contents of the Clipboard
into
Quote:
> the active application, like this:
>
> Set oWSH = CreateObject("WScript.Shell")
> Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
> oAutoIt.ClipPut(sText)
> oWSH.SendKeys"^v"
>
> Is it possible to insert a string directly into the active application,
> without transferring the string to the Clipboard and then pasting it?
>
> Thanks,
> Larry
>
>