| 1. |
Solve : Makeing a batch exicute a text? |
|
Answer» hello im a bit new to batch files. OK is there any way to make it so that after i make the batch open notepad it enters a text into the notepad. right i understand that. but is there any way to first open the notepad.exe then have the batch create a line in the notepad. like No. Notepad is a WINDOWS application. You'll need to use a language that can grab a handle to a window. VBScript sample: Code: [Select]Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "notepad" WScript.Sleep 100 WshShell.AppActivate "Untitled - Notepad" WScript.Sleep 100 WshShell.SendKeys "This is line 1" WScript.Sleep 500 WshShell.SendKeys "~" WScript.Sleep 500 WshShell.SendKeys "This is line 2" WScript.Sleep 500 WshShell.SendKeys "~" WScript.Sleep 500 WshShell.SendKeys "This is line 3" WScript.Sleep 500 WshShell.SendKeys "~" WScript.Sleep 2500 Save script with a VBS EXTENSION and run from the command line as wscript scriptname.vbs Good luck. |
|