Skip to content

Instantly share code, notes, and snippets.

@luisbebop
Created April 22, 2010 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisbebop/375716 to your computer and use it in GitHub Desktop.
Save luisbebop/375716 to your computer and use it in GitHub Desktop.
require 'win32ole'
# based on this tutorial http://www.autoitscript.com/autoit3/docs/tutorials/notepad/notepad.htm
# 1. Download http://www.zapt.in/9Qt
# 2. Put the AutoItX3.dll on c:\windows\system32
# 3. Open the DOS Prompt and register the dll with: "regsvr32 C:\windows\system32\AutoItX3.dll
# 4. Install Ruby if you don't have it already installed: http://www.rubyinstaller.org/
# 5. Execute this file
@au3 = WIN32OLE.new "AutoItX3.Control"
@au3.Run "c:\\windows\\notepad.exe"
@au3.WinWaitActive "Untitled - Notepad"
@au3.Send "This is some text."
@au3.Send "!Fx" #or @au3.WinClose("Untitled - Notepad")
@au3.WinWaitActive "Notepad", "Do you want to save"
@au3.Send "!n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment