autoit

package module
v0.0.0-...-881b0e0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

README

go-autoit

GoDoc Build status

A Go AutoItX wrapper.

##Sample code##

package main

import (
	"fmt"

	"github.com/brunoqc/go-autoit"
)

func main() {
	success, pid := autoit.Run("notepad.exe", "", autoit.SwNormal)
	if !success {
		panic("can't run process")
	}

	fmt.Println("pid", pid)
}

##Build##

You need the DLL (AutoItX3.dll or AutoItX3_x64.dll for 64-bit) and the Swig executable in your PATH.

Note: I wasn't able to set CGO_CFLAGS to C:\Program Files (x86)\AutoIt3\AutoItX. It doesn't seem to like white spaces in the path so I copied the AutoItX directory to c:\

Note 2: swig seems to ignore CGO_CFLAGS so you may have to copy AutoItX3_DLL.h to the current directory.

set CGO_CFLAGS=-Ic:/AutoItX
set CGO_LDFLAGS=-Lc:/AutoItX -lAutoItX3_DLL

# (for 64-bit)
set CGO_LDFLAGS=-Lc:/AutoItX -lAutoItX3_x64_DLL

go build

Documentation

Overview

Package autoit is a AutoItX Go wrapper

Dependencies

AutoItX (http://www.autoitscript.com/site/autoit/downloads/)

Example

package main

import (
	"fmt"

	"github.com/brunoqc/go-autoit"
)

func main() {
	success, pid := autoit.Run("notepad.exe", "", autoit.SwNormal)
	if !success {
		panic("can't run process")
	}

	fmt.Println("pid", pid)
}

Build

set CGO_CFLAGS=-Ic:/AutoItX
set CGO_LDFLAGS=-lAutoItX3_DLL
set CGO_LDFLAGS=-lAutoItX3_x64_DLL # for 64-bit
go build

Index

Constants

View Source
const (
	EnableUserInput  = 0
	DisabelUserInput = 1
)
View Source
const (
	StateExists    = 1
	StateVisible   = 2
	StateEnabled   = 4
	StateActive    = 8
	StateMinimized = 16
	StateMaximized = 32
)

Variables

This section is empty.

Functions

func ControlClick

func ControlClick(title, text, controlID, button string, clicks, x, y int) int

ControlClick clicks on a control without using the mouse pointer TODO: x, y should be center by defaut

func MouseMove

func MouseMove(x, y, speed int)

MouseMove moves the mouse's pointer to a specific location

func Opt

func Opt(option string, param int) int

Opt is used to set/get a property

func PixelChecksum

func PixelChecksum(left, top, right, bottom int32, step int) int64

PixelChecksum returns a checksum of the pixel in a region

func PixelGetColor

func PixelGetColor(x, y int) int

PixelGetColor returns the color of the pixel at the specified location return -1 if the location is invalid

func Run

func Run(filename, workingdir string, flag int) (bool, int)

Run a program and don't wait Possibles flags are SwHide, SwMinimize, SwMaximize and SwNormal returns true on success with the pid

func Send

func Send(keys string, flag int)

Send simulates input on the keyboard flag: 0: normal, 1: raw

func WinActivate

func WinActivate(title, text string)

WinActivate set the focus on a window

func WinActive

func WinActive(title, text string) bool

WinActive returns true if the window is active

func WinClose

func WinClose(title, text string)

WinClose closes a window

func WinExists

func WinExists(title, text string) bool

WinExists returns true if the window exist

func WinGetState

func WinGetState(title, text string) (bool, int)

WinGetState returns a window's state

func WinGetText

func WinGetText(title, text string, bufSize int) (result string)

WinGetText returns the text contained in a window

func WinSetState

func WinSetState(title, text string, flag int)

WinSetState sets a window's state

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL