home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2001 April
/
PCWorld_2001-04_cd.bin
/
Software
/
Vyzkuste
/
autoit
/
AutoIt.exe
/
AutoIt.msi
/
Cabs.w1.cab
/
Notepad.vbs
< prev
next >
Wrap
Text File
|
1999-08-19
|
2KB
|
53 lines
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'
' Example WSH Script (VBScript)
'
'
' (c)1999 Jonathan Bennett, jbennett@hidden.demon.co.uk
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Require Variants to be declared before used
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Declare Variables & Objects
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim oShell
Dim oAutoIt
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Initialise Variables & Objects
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Set oShell = WScript.CreateObject("WScript.Shell")
Set oAutoIt = WScript.CreateObject("AutoItX.Control")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Start of Script
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
WScript.Echo "This script will run notepad and type in some text"
oShell.Run "notepad.exe", 1, FALSE
' Wait for the Notepad window to become active
oAutoIt.WinWaitActive "Untitled - Notepad", ""
' Send some keystokes to notepad
oAutoIt.Send "Hello, this is line 1{ENTER}"
oAutoIt.Send "This is line 2{ENTER}This is line 3"
oAutoIt.Sleep 1000
oAutoIt.Send "!{F4}"
oAutoIt.WinWaitActive "Notepad", "save the changes?"
oAutoIt.Send "!n"
oAutoIt.WinWaitClose "Untitled - Notepad", ""
WScript.Quit