mirror of
https://github.com/xiaoqidun/aukit.git
synced 2025-12-16 23:42:53 +08:00
1448 lines
50 KiB
Go
1448 lines
50 KiB
Go
// Copyright 2025 肖其顿
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
//go:build windows
|
|
|
|
// Package aukit 一个高性能、并发安全的 AutoItX3 Go 语言封装
|
|
package aukit
|
|
|
|
import (
|
|
"errors"
|
|
"sync"
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
// IntDefault AutoIt 默认参数值 (-2147483647)
|
|
const IntDefault = -2147483647
|
|
|
|
// Rect 矩形区域结构体
|
|
type Rect struct {
|
|
Left int32
|
|
Top int32
|
|
Right int32
|
|
Bottom int32
|
|
}
|
|
|
|
// Point 坐标结构体
|
|
type Point struct {
|
|
X int32
|
|
Y int32
|
|
}
|
|
|
|
// AuKit 核心自动化工具结构体
|
|
type AuKit struct {
|
|
dll *syscall.DLL
|
|
lock sync.Mutex
|
|
au3Init *syscall.Proc
|
|
au3Error *syscall.Proc
|
|
au3AutoItSetOption *syscall.Proc
|
|
au3ClipGet *syscall.Proc
|
|
au3ClipPut *syscall.Proc
|
|
au3ControlClick *syscall.Proc
|
|
au3ControlClickByHandle *syscall.Proc
|
|
au3ControlCommand *syscall.Proc
|
|
au3ControlCommandByHandle *syscall.Proc
|
|
au3ControlListView *syscall.Proc
|
|
au3ControlListViewByHandle *syscall.Proc
|
|
au3ControlDisable *syscall.Proc
|
|
au3ControlDisableByHandle *syscall.Proc
|
|
au3ControlEnable *syscall.Proc
|
|
au3ControlEnableByHandle *syscall.Proc
|
|
au3ControlFocus *syscall.Proc
|
|
au3ControlFocusByHandle *syscall.Proc
|
|
au3ControlGetFocus *syscall.Proc
|
|
au3ControlGetFocusByHandle *syscall.Proc
|
|
au3ControlGetHandle *syscall.Proc
|
|
au3ControlGetHandleAsText *syscall.Proc
|
|
au3ControlGetPos *syscall.Proc
|
|
au3ControlGetPosByHandle *syscall.Proc
|
|
au3ControlGetText *syscall.Proc
|
|
au3ControlGetTextByHandle *syscall.Proc
|
|
au3ControlHide *syscall.Proc
|
|
au3ControlHideByHandle *syscall.Proc
|
|
au3ControlMove *syscall.Proc
|
|
au3ControlMoveByHandle *syscall.Proc
|
|
au3ControlSend *syscall.Proc
|
|
au3ControlSendByHandle *syscall.Proc
|
|
au3ControlSetText *syscall.Proc
|
|
au3ControlSetTextByHandle *syscall.Proc
|
|
au3ControlShow *syscall.Proc
|
|
au3ControlShowByHandle *syscall.Proc
|
|
au3ControlTreeView *syscall.Proc
|
|
au3ControlTreeViewByHandle *syscall.Proc
|
|
au3DriveMapAdd *syscall.Proc
|
|
au3DriveMapDel *syscall.Proc
|
|
au3DriveMapGet *syscall.Proc
|
|
au3IsAdmin *syscall.Proc
|
|
au3MouseClick *syscall.Proc
|
|
au3MouseClickDrag *syscall.Proc
|
|
au3MouseDown *syscall.Proc
|
|
au3MouseGetCursor *syscall.Proc
|
|
au3MouseGetPos *syscall.Proc
|
|
au3MouseMove *syscall.Proc
|
|
au3MouseUp *syscall.Proc
|
|
au3MouseWheel *syscall.Proc
|
|
au3Opt *syscall.Proc
|
|
au3PixelChecksum *syscall.Proc
|
|
au3PixelGetColor *syscall.Proc
|
|
au3PixelSearch *syscall.Proc
|
|
au3ProcessClose *syscall.Proc
|
|
au3ProcessExists *syscall.Proc
|
|
au3ProcessSetPriority *syscall.Proc
|
|
au3ProcessWait *syscall.Proc
|
|
au3ProcessWaitClose *syscall.Proc
|
|
au3Run *syscall.Proc
|
|
au3RunWait *syscall.Proc
|
|
au3RunAs *syscall.Proc
|
|
au3RunAsWait *syscall.Proc
|
|
au3Send *syscall.Proc
|
|
au3Shutdown *syscall.Proc
|
|
au3Sleep *syscall.Proc
|
|
au3StatusbarGetText *syscall.Proc
|
|
au3StatusbarGetTextByHandle *syscall.Proc
|
|
au3ToolTip *syscall.Proc
|
|
au3WinActivate *syscall.Proc
|
|
au3WinActivateByHandle *syscall.Proc
|
|
au3WinActive *syscall.Proc
|
|
au3WinActiveByHandle *syscall.Proc
|
|
au3WinClose *syscall.Proc
|
|
au3WinCloseByHandle *syscall.Proc
|
|
au3WinExists *syscall.Proc
|
|
au3WinExistsByHandle *syscall.Proc
|
|
au3WinGetCaretPos *syscall.Proc
|
|
au3WinGetClassList *syscall.Proc
|
|
au3WinGetClassListByHandle *syscall.Proc
|
|
au3WinGetClientSize *syscall.Proc
|
|
au3WinGetClientSizeByHandle *syscall.Proc
|
|
au3WinGetHandle *syscall.Proc
|
|
au3WinGetHandleAsText *syscall.Proc
|
|
au3WinGetPos *syscall.Proc
|
|
au3WinGetPosByHandle *syscall.Proc
|
|
au3WinGetProcess *syscall.Proc
|
|
au3WinGetProcessByHandle *syscall.Proc
|
|
au3WinGetState *syscall.Proc
|
|
au3WinGetStateByHandle *syscall.Proc
|
|
au3WinGetText *syscall.Proc
|
|
au3WinGetTextByHandle *syscall.Proc
|
|
au3WinGetTitle *syscall.Proc
|
|
au3WinGetTitleByHandle *syscall.Proc
|
|
au3WinKill *syscall.Proc
|
|
au3WinKillByHandle *syscall.Proc
|
|
au3WinMenuSelectItem *syscall.Proc
|
|
au3WinMenuSelectItemByHandle *syscall.Proc
|
|
au3WinMinimizeAll *syscall.Proc
|
|
au3WinMinimizeAllUndo *syscall.Proc
|
|
au3WinMove *syscall.Proc
|
|
au3WinMoveByHandle *syscall.Proc
|
|
au3WinSetOnTop *syscall.Proc
|
|
au3WinSetOnTopByHandle *syscall.Proc
|
|
au3WinSetState *syscall.Proc
|
|
au3WinSetStateByHandle *syscall.Proc
|
|
au3WinSetTitle *syscall.Proc
|
|
au3WinSetTitleByHandle *syscall.Proc
|
|
au3WinSetTrans *syscall.Proc
|
|
au3WinSetTransByHandle *syscall.Proc
|
|
au3WinWait *syscall.Proc
|
|
au3WinWaitByHandle *syscall.Proc
|
|
au3WinWaitActive *syscall.Proc
|
|
au3WinWaitActiveByHandle *syscall.Proc
|
|
au3WinWaitClose *syscall.Proc
|
|
au3WinWaitCloseByHandle *syscall.Proc
|
|
au3WinWaitNotActive *syscall.Proc
|
|
au3WinWaitNotActiveByHandle *syscall.Proc
|
|
}
|
|
|
|
// New 创建并初始化 AuKit 实例
|
|
// 入参: dllPath DLL路径(空则使用 AutoItX3_x64.dll)
|
|
// 返回: 实例指针, 错误信息
|
|
func New(dllPath string) (*AuKit, error) {
|
|
if dllPath == "" {
|
|
dllPath = "AutoItX3_x64.dll"
|
|
}
|
|
dll, err := syscall.LoadDLL(dllPath)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
a := &AuKit{dll: dll}
|
|
find := func(name string) *syscall.Proc {
|
|
if err != nil {
|
|
return nil
|
|
}
|
|
p, e := dll.FindProc(name)
|
|
if e != nil {
|
|
err = errors.New("AutoItX3 missing function: " + name)
|
|
return nil
|
|
}
|
|
return p
|
|
}
|
|
a.au3Init = find("AU3_Init")
|
|
a.au3Error = find("AU3_error")
|
|
a.au3AutoItSetOption = find("AU3_AutoItSetOption")
|
|
a.au3ClipGet = find("AU3_ClipGet")
|
|
a.au3ClipPut = find("AU3_ClipPut")
|
|
a.au3ControlClick = find("AU3_ControlClick")
|
|
a.au3ControlClickByHandle = find("AU3_ControlClickByHandle")
|
|
a.au3ControlCommand = find("AU3_ControlCommand")
|
|
a.au3ControlCommandByHandle = find("AU3_ControlCommandByHandle")
|
|
a.au3ControlListView = find("AU3_ControlListView")
|
|
a.au3ControlListViewByHandle = find("AU3_ControlListViewByHandle")
|
|
a.au3ControlDisable = find("AU3_ControlDisable")
|
|
a.au3ControlDisableByHandle = find("AU3_ControlDisableByHandle")
|
|
a.au3ControlEnable = find("AU3_ControlEnable")
|
|
a.au3ControlEnableByHandle = find("AU3_ControlEnableByHandle")
|
|
a.au3ControlFocus = find("AU3_ControlFocus")
|
|
a.au3ControlFocusByHandle = find("AU3_ControlFocusByHandle")
|
|
a.au3ControlGetFocus = find("AU3_ControlGetFocus")
|
|
a.au3ControlGetFocusByHandle = find("AU3_ControlGetFocusByHandle")
|
|
a.au3ControlGetHandle = find("AU3_ControlGetHandle")
|
|
a.au3ControlGetHandleAsText = find("AU3_ControlGetHandleAsText")
|
|
a.au3ControlGetPos = find("AU3_ControlGetPos")
|
|
a.au3ControlGetPosByHandle = find("AU3_ControlGetPosByHandle")
|
|
a.au3ControlGetText = find("AU3_ControlGetText")
|
|
a.au3ControlGetTextByHandle = find("AU3_ControlGetTextByHandle")
|
|
a.au3ControlHide = find("AU3_ControlHide")
|
|
a.au3ControlHideByHandle = find("AU3_ControlHideByHandle")
|
|
a.au3ControlMove = find("AU3_ControlMove")
|
|
a.au3ControlMoveByHandle = find("AU3_ControlMoveByHandle")
|
|
a.au3ControlSend = find("AU3_ControlSend")
|
|
a.au3ControlSendByHandle = find("AU3_ControlSendByHandle")
|
|
a.au3ControlSetText = find("AU3_ControlSetText")
|
|
a.au3ControlSetTextByHandle = find("AU3_ControlSetTextByHandle")
|
|
a.au3ControlShow = find("AU3_ControlShow")
|
|
a.au3ControlShowByHandle = find("AU3_ControlShowByHandle")
|
|
a.au3ControlTreeView = find("AU3_ControlTreeView")
|
|
a.au3ControlTreeViewByHandle = find("AU3_ControlTreeViewByHandle")
|
|
a.au3DriveMapAdd = find("AU3_DriveMapAdd")
|
|
a.au3DriveMapDel = find("AU3_DriveMapDel")
|
|
a.au3DriveMapGet = find("AU3_DriveMapGet")
|
|
a.au3IsAdmin = find("AU3_IsAdmin")
|
|
a.au3MouseClick = find("AU3_MouseClick")
|
|
a.au3MouseClickDrag = find("AU3_MouseClickDrag")
|
|
a.au3MouseDown = find("AU3_MouseDown")
|
|
a.au3MouseGetCursor = find("AU3_MouseGetCursor")
|
|
a.au3MouseGetPos = find("AU3_MouseGetPos")
|
|
a.au3MouseMove = find("AU3_MouseMove")
|
|
a.au3MouseUp = find("AU3_MouseUp")
|
|
a.au3MouseWheel = find("AU3_MouseWheel")
|
|
a.au3Opt = find("AU3_Opt")
|
|
a.au3PixelChecksum = find("AU3_PixelChecksum")
|
|
a.au3PixelGetColor = find("AU3_PixelGetColor")
|
|
a.au3PixelSearch = find("AU3_PixelSearch")
|
|
a.au3ProcessClose = find("AU3_ProcessClose")
|
|
a.au3ProcessExists = find("AU3_ProcessExists")
|
|
a.au3ProcessSetPriority = find("AU3_ProcessSetPriority")
|
|
a.au3ProcessWait = find("AU3_ProcessWait")
|
|
a.au3ProcessWaitClose = find("AU3_ProcessWaitClose")
|
|
a.au3Run = find("AU3_Run")
|
|
a.au3RunWait = find("AU3_RunWait")
|
|
a.au3RunAs = find("AU3_RunAs")
|
|
a.au3RunAsWait = find("AU3_RunAsWait")
|
|
a.au3Send = find("AU3_Send")
|
|
a.au3Shutdown = find("AU3_Shutdown")
|
|
a.au3Sleep = find("AU3_Sleep")
|
|
a.au3StatusbarGetText = find("AU3_StatusbarGetText")
|
|
a.au3StatusbarGetTextByHandle = find("AU3_StatusbarGetTextByHandle")
|
|
a.au3ToolTip = find("AU3_ToolTip")
|
|
a.au3WinActivate = find("AU3_WinActivate")
|
|
a.au3WinActivateByHandle = find("AU3_WinActivateByHandle")
|
|
a.au3WinActive = find("AU3_WinActive")
|
|
a.au3WinActiveByHandle = find("AU3_WinActiveByHandle")
|
|
a.au3WinClose = find("AU3_WinClose")
|
|
a.au3WinCloseByHandle = find("AU3_WinCloseByHandle")
|
|
a.au3WinExists = find("AU3_WinExists")
|
|
a.au3WinExistsByHandle = find("AU3_WinExistsByHandle")
|
|
a.au3WinGetCaretPos = find("AU3_WinGetCaretPos")
|
|
a.au3WinGetClassList = find("AU3_WinGetClassList")
|
|
a.au3WinGetClassListByHandle = find("AU3_WinGetClassListByHandle")
|
|
a.au3WinGetClientSize = find("AU3_WinGetClientSize")
|
|
a.au3WinGetClientSizeByHandle = find("AU3_WinGetClientSizeByHandle")
|
|
a.au3WinGetHandle = find("AU3_WinGetHandle")
|
|
a.au3WinGetHandleAsText = find("AU3_WinGetHandleAsText")
|
|
a.au3WinGetPos = find("AU3_WinGetPos")
|
|
a.au3WinGetPosByHandle = find("AU3_WinGetPosByHandle")
|
|
a.au3WinGetProcess = find("AU3_WinGetProcess")
|
|
a.au3WinGetProcessByHandle = find("AU3_WinGetProcessByHandle")
|
|
a.au3WinGetState = find("AU3_WinGetState")
|
|
a.au3WinGetStateByHandle = find("AU3_WinGetStateByHandle")
|
|
a.au3WinGetText = find("AU3_WinGetText")
|
|
a.au3WinGetTextByHandle = find("AU3_WinGetTextByHandle")
|
|
a.au3WinGetTitle = find("AU3_WinGetTitle")
|
|
a.au3WinGetTitleByHandle = find("AU3_WinGetTitleByHandle")
|
|
a.au3WinKill = find("AU3_WinKill")
|
|
a.au3WinKillByHandle = find("AU3_WinKillByHandle")
|
|
a.au3WinMenuSelectItem = find("AU3_WinMenuSelectItem")
|
|
a.au3WinMenuSelectItemByHandle = find("AU3_WinMenuSelectItemByHandle")
|
|
a.au3WinMinimizeAll = find("AU3_WinMinimizeAll")
|
|
a.au3WinMinimizeAllUndo = find("AU3_WinMinimizeAllUndo")
|
|
a.au3WinMove = find("AU3_WinMove")
|
|
a.au3WinMoveByHandle = find("AU3_WinMoveByHandle")
|
|
a.au3WinSetOnTop = find("AU3_WinSetOnTop")
|
|
a.au3WinSetOnTopByHandle = find("AU3_WinSetOnTopByHandle")
|
|
a.au3WinSetState = find("AU3_WinSetState")
|
|
a.au3WinSetStateByHandle = find("AU3_WinSetStateByHandle")
|
|
a.au3WinSetTitle = find("AU3_WinSetTitle")
|
|
a.au3WinSetTitleByHandle = find("AU3_WinSetTitleByHandle")
|
|
a.au3WinSetTrans = find("AU3_WinSetTrans")
|
|
a.au3WinSetTransByHandle = find("AU3_WinSetTransByHandle")
|
|
a.au3WinWait = find("AU3_WinWait")
|
|
a.au3WinWaitByHandle = find("AU3_WinWaitByHandle")
|
|
a.au3WinWaitActive = find("AU3_WinWaitActive")
|
|
a.au3WinWaitActiveByHandle = find("AU3_WinWaitActiveByHandle")
|
|
a.au3WinWaitClose = find("AU3_WinWaitClose")
|
|
a.au3WinWaitCloseByHandle = find("AU3_WinWaitCloseByHandle")
|
|
a.au3WinWaitNotActive = find("AU3_WinWaitNotActive")
|
|
a.au3WinWaitNotActiveByHandle = find("AU3_WinWaitNotActiveByHandle")
|
|
if err != nil {
|
|
dll.Release()
|
|
return nil, err
|
|
}
|
|
a.Init()
|
|
return a, nil
|
|
}
|
|
|
|
// strPtr 将字符串转换为 UTF16 指针
|
|
func (a *AuKit) strPtr(s string) uintptr {
|
|
ptr, _ := syscall.UTF16PtrFromString(s)
|
|
return uintptr(unsafe.Pointer(ptr))
|
|
}
|
|
|
|
// intPtr 将 int 转换为 uintptr
|
|
func (a *AuKit) intPtr(n int) uintptr {
|
|
return uintptr(n)
|
|
}
|
|
|
|
// getInt 调用 DLL 函数并返回 int 结果
|
|
func (a *AuKit) getInt(proc *syscall.Proc, args ...uintptr) int {
|
|
ret, _, _ := proc.Call(args...)
|
|
return int(ret)
|
|
}
|
|
|
|
// Init 显式初始化
|
|
func (a *AuKit) Init() {
|
|
a.au3Init.Call()
|
|
}
|
|
|
|
// Error 获取最后一个错误代码
|
|
// 返回: 错误代码
|
|
func (a *AuKit) Error() int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3Error)
|
|
}
|
|
|
|
// AutoItSetOption 设置选项
|
|
// 入参: szOption 选项名, nValue 值
|
|
// 返回: 1 成功
|
|
func (a *AuKit) AutoItSetOption(szOption string, nValue int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3AutoItSetOption, a.strPtr(szOption), a.intPtr(nValue))
|
|
}
|
|
|
|
// ClipGet 获取剪贴板内容
|
|
// 返回: 剪贴板文本
|
|
func (a *AuKit) ClipGet() string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3ClipGet.Call(uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ClipPut 设置剪贴板内容
|
|
// 入参: szClip 文本
|
|
func (a *AuKit) ClipPut(szClip string) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
a.au3ClipPut.Call(a.strPtr(szClip))
|
|
}
|
|
|
|
// ControlClick 点击控件
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件, szButton 按钮, nNumClicks 点击数, nX, nY 坐标
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlClick(szTitle, szText, szControl, szButton string, nNumClicks, nX, nY int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlClick, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl), a.strPtr(szButton), a.intPtr(nNumClicks), a.intPtr(nX), a.intPtr(nY))
|
|
}
|
|
|
|
// ControlClickByHandle 点击控件(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄, szButton 按钮, nNumClicks 点击数, nX, nY 坐标
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlClickByHandle(hWnd, hCtrl uintptr, szButton string, nNumClicks, nX, nY int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlClickByHandle, hWnd, hCtrl, a.strPtr(szButton), a.intPtr(nNumClicks), a.intPtr(nX), a.intPtr(nY))
|
|
}
|
|
|
|
// ControlCommand 发送控件命令
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件, szCommand 命令, szExtra 参数
|
|
// 返回: 结果文本
|
|
func (a *AuKit) ControlCommand(szTitle, szText, szControl, szCommand, szExtra string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3ControlCommand.Call(a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl), a.strPtr(szCommand), a.strPtr(szExtra), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ControlCommandByHandle 发送控件命令(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄, szCommand 命令, szExtra 参数
|
|
// 返回: 结果文本
|
|
func (a *AuKit) ControlCommandByHandle(hWnd, hCtrl uintptr, szCommand, szExtra string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3ControlCommandByHandle.Call(hWnd, hCtrl, a.strPtr(szCommand), a.strPtr(szExtra), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ControlListView 操作列表视图
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件, szCommand 命令, szExtra1, szExtra2 参数
|
|
// 返回: 结果文本
|
|
func (a *AuKit) ControlListView(szTitle, szText, szControl, szCommand, szExtra1, szExtra2 string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3ControlListView.Call(a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl), a.strPtr(szCommand), a.strPtr(szExtra1), a.strPtr(szExtra2), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ControlListViewByHandle 操作列表视图(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄, szCommand 命令, szExtra1, szExtra2 参数
|
|
// 返回: 结果文本
|
|
func (a *AuKit) ControlListViewByHandle(hWnd, hCtrl uintptr, szCommand, szExtra1, szExtra2 string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3ControlListViewByHandle.Call(hWnd, hCtrl, a.strPtr(szCommand), a.strPtr(szExtra1), a.strPtr(szExtra2), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ControlDisable 禁用控件
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlDisable(szTitle, szText, szControl string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlDisable, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl))
|
|
}
|
|
|
|
// ControlDisableByHandle 禁用控件(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlDisableByHandle(hWnd, hCtrl uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlDisableByHandle, hWnd, hCtrl)
|
|
}
|
|
|
|
// ControlEnable 启用控件
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlEnable(szTitle, szText, szControl string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlEnable, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl))
|
|
}
|
|
|
|
// ControlEnableByHandle 启用控件(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlEnableByHandle(hWnd, hCtrl uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlEnableByHandle, hWnd, hCtrl)
|
|
}
|
|
|
|
// ControlFocus 聚焦控件
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlFocus(szTitle, szText, szControl string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlFocus, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl))
|
|
}
|
|
|
|
// ControlFocusByHandle 聚焦控件(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlFocusByHandle(hWnd, hCtrl uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlFocusByHandle, hWnd, hCtrl)
|
|
}
|
|
|
|
// ControlGetFocus 获取焦点控件
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 控件文本
|
|
func (a *AuKit) ControlGetFocus(szTitle, szText string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 1024)
|
|
a.au3ControlGetFocus.Call(a.strPtr(szTitle), a.strPtr(szText), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ControlGetFocusByHandle 获取焦点控件(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 控件文本
|
|
func (a *AuKit) ControlGetFocusByHandle(hWnd uintptr) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 1024)
|
|
a.au3ControlGetFocusByHandle.Call(hWnd, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ControlGetHandle 获取控件句柄
|
|
// 入参: hWnd 窗口句柄, szControl 控件
|
|
// 返回: 控件句柄
|
|
func (a *AuKit) ControlGetHandle(hWnd uintptr, szControl string) uintptr {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
ret, _, _ := a.au3ControlGetHandle.Call(hWnd, a.strPtr(szControl))
|
|
return ret
|
|
}
|
|
|
|
// ControlGetHandleAsText 获取控件句柄(文本)
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件
|
|
// 返回: 句柄文本
|
|
func (a *AuKit) ControlGetHandleAsText(szTitle, szText, szControl string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 256)
|
|
a.au3ControlGetHandleAsText.Call(a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ControlGetPos 获取控件位置
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件
|
|
// 返回: 矩形区域, 1 成功
|
|
func (a *AuKit) ControlGetPos(szTitle, szText, szControl string) (Rect, int) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
var r Rect
|
|
ret := a.getInt(a.au3ControlGetPos, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl), uintptr(unsafe.Pointer(&r)))
|
|
return r, ret
|
|
}
|
|
|
|
// ControlGetPosByHandle 获取控件位置(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄
|
|
// 返回: 矩形区域, 1 成功
|
|
func (a *AuKit) ControlGetPosByHandle(hWnd, hCtrl uintptr) (Rect, int) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
var r Rect
|
|
ret := a.getInt(a.au3ControlGetPosByHandle, hWnd, hCtrl, uintptr(unsafe.Pointer(&r)))
|
|
return r, ret
|
|
}
|
|
|
|
// ControlGetText 获取控件文本
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件
|
|
// 返回: 控件文本
|
|
func (a *AuKit) ControlGetText(szTitle, szText, szControl string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3ControlGetText.Call(a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ControlGetTextByHandle 获取控件文本(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄
|
|
// 返回: 控件文本
|
|
func (a *AuKit) ControlGetTextByHandle(hWnd, hCtrl uintptr) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3ControlGetTextByHandle.Call(hWnd, hCtrl, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ControlHide 隐藏控件
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlHide(szTitle, szText, szControl string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlHide, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl))
|
|
}
|
|
|
|
// ControlHideByHandle 隐藏控件(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlHideByHandle(hWnd, hCtrl uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlHideByHandle, hWnd, hCtrl)
|
|
}
|
|
|
|
// ControlMove 移动控件
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件, nX, nY 坐标, nWidth, nHeight 大小
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlMove(szTitle, szText, szControl string, nX, nY, nWidth, nHeight int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlMove, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl), a.intPtr(nX), a.intPtr(nY), a.intPtr(nWidth), a.intPtr(nHeight))
|
|
}
|
|
|
|
// ControlMoveByHandle 移动控件(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄, nX, nY 坐标, nWidth, nHeight 大小
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlMoveByHandle(hWnd, hCtrl uintptr, nX, nY, nWidth, nHeight int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlMoveByHandle, hWnd, hCtrl, a.intPtr(nX), a.intPtr(nY), a.intPtr(nWidth), a.intPtr(nHeight))
|
|
}
|
|
|
|
// ControlSend 发送文本到控件
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件, szSendText 内容, nMode 模式
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlSend(szTitle, szText, szControl, szSendText string, nMode int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlSend, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl), a.strPtr(szSendText), a.intPtr(nMode))
|
|
}
|
|
|
|
// ControlSendByHandle 发送文本到控件(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄, szSendText 内容, nMode 模式
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlSendByHandle(hWnd, hCtrl uintptr, szSendText string, nMode int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlSendByHandle, hWnd, hCtrl, a.strPtr(szSendText), a.intPtr(nMode))
|
|
}
|
|
|
|
// ControlSetText 设置控件文本
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件, szControlText 内容
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlSetText(szTitle, szText, szControl, szControlText string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlSetText, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl), a.strPtr(szControlText))
|
|
}
|
|
|
|
// ControlSetTextByHandle 设置控件文本(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄, szControlText 内容
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlSetTextByHandle(hWnd, hCtrl uintptr, szControlText string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlSetTextByHandle, hWnd, hCtrl, a.strPtr(szControlText))
|
|
}
|
|
|
|
// ControlShow 显示控件
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlShow(szTitle, szText, szControl string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlShow, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl))
|
|
}
|
|
|
|
// ControlShowByHandle 显示控件(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ControlShowByHandle(hWnd, hCtrl uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ControlShowByHandle, hWnd, hCtrl)
|
|
}
|
|
|
|
// ControlTreeView 操作树形视图
|
|
// 入参: szTitle 标题, szText 文本, szControl 控件, szCommand 命令, szExtra1, szExtra2 参数
|
|
// 返回: 结果文本
|
|
func (a *AuKit) ControlTreeView(szTitle, szText, szControl, szCommand, szExtra1, szExtra2 string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3ControlTreeView.Call(a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szControl), a.strPtr(szCommand), a.strPtr(szExtra1), a.strPtr(szExtra2), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ControlTreeViewByHandle 操作树形视图(句柄)
|
|
// 入参: hWnd 窗口句柄, hCtrl 控件句柄, szCommand 命令, szExtra1, szExtra2 参数
|
|
// 返回: 结果文本
|
|
func (a *AuKit) ControlTreeViewByHandle(hWnd, hCtrl uintptr, szCommand, szExtra1, szExtra2 string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3ControlTreeViewByHandle.Call(hWnd, hCtrl, a.strPtr(szCommand), a.strPtr(szExtra1), a.strPtr(szExtra2), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// DriveMapAdd 映射网络驱动器
|
|
// 入参: szDevice 设备名, szShare 共享路径, nFlags 标志, szUser 用户, szPwd 密码
|
|
// 返回: 结果文本
|
|
func (a *AuKit) DriveMapAdd(szDevice, szShare string, nFlags int, szUser, szPwd string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 1024)
|
|
a.au3DriveMapAdd.Call(a.strPtr(szDevice), a.strPtr(szShare), a.intPtr(nFlags), a.strPtr(szUser), a.strPtr(szPwd), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// DriveMapDel 删除网络驱动器映射
|
|
// 入参: szDevice 设备名
|
|
// 返回: 1 成功
|
|
func (a *AuKit) DriveMapDel(szDevice string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3DriveMapDel, a.strPtr(szDevice))
|
|
}
|
|
|
|
// DriveMapGet 获取映射的网络路径
|
|
// 入参: szDevice 设备名
|
|
// 返回: 路径
|
|
func (a *AuKit) DriveMapGet(szDevice string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 1024)
|
|
a.au3DriveMapGet.Call(a.strPtr(szDevice), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// IsAdmin 检查当前是否为管理员
|
|
// 返回: 1 是
|
|
func (a *AuKit) IsAdmin() int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3IsAdmin)
|
|
}
|
|
|
|
// MouseClick 鼠标点击
|
|
// 入参: szButton 按钮, nX, nY 坐标, nClicks 次数, nSpeed 速度
|
|
// 返回: 1 成功
|
|
func (a *AuKit) MouseClick(szButton string, nX, nY, nClicks, nSpeed int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3MouseClick, a.strPtr(szButton), a.intPtr(nX), a.intPtr(nY), a.intPtr(nClicks), a.intPtr(nSpeed))
|
|
}
|
|
|
|
// MouseClickDrag 鼠标拖拽
|
|
// 入参: szButton 按钮, nX1, nY1 起点, nX2, nY2 终点, nSpeed 速度
|
|
// 返回: 1 成功
|
|
func (a *AuKit) MouseClickDrag(szButton string, nX1, nY1, nX2, nY2, nSpeed int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3MouseClickDrag, a.strPtr(szButton), a.intPtr(nX1), a.intPtr(nY1), a.intPtr(nX2), a.intPtr(nY2), a.intPtr(nSpeed))
|
|
}
|
|
|
|
// MouseDown 鼠标按下
|
|
// 入参: szButton 按钮
|
|
func (a *AuKit) MouseDown(szButton string) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
a.au3MouseDown.Call(a.strPtr(szButton))
|
|
}
|
|
|
|
// MouseGetCursor 获取鼠标光标ID
|
|
// 返回: 光标ID
|
|
func (a *AuKit) MouseGetCursor() int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3MouseGetCursor)
|
|
}
|
|
|
|
// MouseGetPos 获取鼠标位置
|
|
// 返回: 坐标
|
|
func (a *AuKit) MouseGetPos() Point {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
var pt Point
|
|
a.au3MouseGetPos.Call(uintptr(unsafe.Pointer(&pt)))
|
|
return pt
|
|
}
|
|
|
|
// MouseMove 移动鼠标
|
|
// 入参: nX, nY 坐标, nSpeed 速度
|
|
// 返回: 1 成功
|
|
func (a *AuKit) MouseMove(nX, nY, nSpeed int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3MouseMove, a.intPtr(nX), a.intPtr(nY), a.intPtr(nSpeed))
|
|
}
|
|
|
|
// MouseUp 鼠标松开
|
|
// 入参: szButton 按钮
|
|
func (a *AuKit) MouseUp(szButton string) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
a.au3MouseUp.Call(a.strPtr(szButton))
|
|
}
|
|
|
|
// MouseWheel 滚动鼠标滚轮
|
|
// 入参: szDirection 方向, nClicks 次数
|
|
func (a *AuKit) MouseWheel(szDirection string, nClicks int) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
a.au3MouseWheel.Call(a.strPtr(szDirection), a.intPtr(nClicks))
|
|
}
|
|
|
|
// Opt 设置选项
|
|
// 入参: szOption 选项名, nValue 值
|
|
// 返回: 1 成功
|
|
func (a *AuKit) Opt(szOption string, nValue int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3Opt, a.strPtr(szOption), a.intPtr(nValue))
|
|
}
|
|
|
|
// PixelChecksum 计算像素校验和
|
|
// 入参: lpRect 区域, nStep 步长
|
|
// 返回: 校验和
|
|
func (a *AuKit) PixelChecksum(lpRect Rect, nStep int) uint32 {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
ret, _, _ := a.au3PixelChecksum.Call(uintptr(unsafe.Pointer(&lpRect)), a.intPtr(nStep))
|
|
return uint32(ret)
|
|
}
|
|
|
|
// PixelGetColor 获取像素颜色
|
|
// 入参: nX, nY 坐标
|
|
// 返回: 颜色值
|
|
func (a *AuKit) PixelGetColor(nX, nY int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3PixelGetColor, a.intPtr(nX), a.intPtr(nY))
|
|
}
|
|
|
|
// PixelSearch 搜索像素颜色
|
|
// 入参: lpRect 区域, nCol 颜色, nVar 容差, nStep 步长
|
|
// 返回: 坐标
|
|
func (a *AuKit) PixelSearch(lpRect Rect, nCol, nVar, nStep int) Point {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
var pt Point
|
|
a.au3PixelSearch.Call(uintptr(unsafe.Pointer(&lpRect)), a.intPtr(nCol), a.intPtr(nVar), a.intPtr(nStep), uintptr(unsafe.Pointer(&pt)))
|
|
return pt
|
|
}
|
|
|
|
// ProcessClose 关闭进程
|
|
// 入参: szProcess 进程名或PID
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ProcessClose(szProcess string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ProcessClose, a.strPtr(szProcess))
|
|
}
|
|
|
|
// ProcessExists 检查进程是否存在
|
|
// 入参: szProcess 进程名或PID
|
|
// 返回: PID
|
|
func (a *AuKit) ProcessExists(szProcess string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ProcessExists, a.strPtr(szProcess))
|
|
}
|
|
|
|
// ProcessSetPriority 设置进程优先级
|
|
// 入参: szProcess 进程名或PID, nPriority 优先级
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ProcessSetPriority(szProcess string, nPriority int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ProcessSetPriority, a.strPtr(szProcess), a.intPtr(nPriority))
|
|
}
|
|
|
|
// ProcessWait 等待进程
|
|
// 入参: szProcess 进程名, nTimeout 超时
|
|
// 返回: PID
|
|
func (a *AuKit) ProcessWait(szProcess string, nTimeout int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ProcessWait, a.strPtr(szProcess), a.intPtr(nTimeout))
|
|
}
|
|
|
|
// ProcessWaitClose 等待进程关闭
|
|
// 入参: szProcess 进程名, nTimeout 超时
|
|
// 返回: 1 成功
|
|
func (a *AuKit) ProcessWaitClose(szProcess string, nTimeout int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3ProcessWaitClose, a.strPtr(szProcess), a.intPtr(nTimeout))
|
|
}
|
|
|
|
// Run 运行程序
|
|
// 入参: szProgram 程序, szDir 目录, nShowFlag 显示标志
|
|
// 返回: PID
|
|
func (a *AuKit) Run(szProgram, szDir string, nShowFlag int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3Run, a.strPtr(szProgram), a.strPtr(szDir), a.intPtr(nShowFlag))
|
|
}
|
|
|
|
// RunWait 运行并等待
|
|
// 入参: szProgram 程序, szDir 目录, nShowFlag 显示标志
|
|
// 返回: 退出码
|
|
func (a *AuKit) RunWait(szProgram, szDir string, nShowFlag int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3RunWait, a.strPtr(szProgram), a.strPtr(szDir), a.intPtr(nShowFlag))
|
|
}
|
|
|
|
// RunAs 以用户身份运行
|
|
// 入参: szUser 用户名, szDomain 域, szPassword 密码, nLogonFlag 登录标志, szProgram 程序, szDir 目录, nShowFlag 显示标志
|
|
// 返回: PID
|
|
func (a *AuKit) RunAs(szUser, szDomain, szPassword string, nLogonFlag int, szProgram, szDir string, nShowFlag int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3RunAs, a.strPtr(szUser), a.strPtr(szDomain), a.strPtr(szPassword), a.intPtr(nLogonFlag), a.strPtr(szProgram), a.strPtr(szDir), a.intPtr(nShowFlag))
|
|
}
|
|
|
|
// RunAsWait 以用户身份运行并等待
|
|
// 入参: szUser 用户名, szDomain 域, szPassword 密码, nLogonFlag 登录标志, szProgram 程序, szDir 目录, nShowFlag 显示标志
|
|
// 返回: 退出码
|
|
func (a *AuKit) RunAsWait(szUser, szDomain, szPassword string, nLogonFlag int, szProgram, szDir string, nShowFlag int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3RunAsWait, a.strPtr(szUser), a.strPtr(szDomain), a.strPtr(szPassword), a.intPtr(nLogonFlag), a.strPtr(szProgram), a.strPtr(szDir), a.intPtr(nShowFlag))
|
|
}
|
|
|
|
// Send 发送按键
|
|
// 入参: szSendText 文本, nMode 模式
|
|
func (a *AuKit) Send(szSendText string, nMode int) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
a.au3Send.Call(a.strPtr(szSendText), a.intPtr(nMode))
|
|
}
|
|
|
|
// Shutdown 关机
|
|
// 入参: nFlags 标志
|
|
// 返回: 1 成功
|
|
func (a *AuKit) Shutdown(nFlags int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3Shutdown, a.intPtr(nFlags))
|
|
}
|
|
|
|
// Sleep 睡眠
|
|
// 入参: nMilliseconds 毫秒
|
|
func (a *AuKit) Sleep(nMilliseconds int) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
a.au3Sleep.Call(a.intPtr(nMilliseconds))
|
|
}
|
|
|
|
// StatusbarGetText 获取状态栏文本
|
|
// 入参: szTitle 标题, szText 文本, nPart 部分
|
|
// 返回: 状态栏文本
|
|
func (a *AuKit) StatusbarGetText(szTitle, szText string, nPart int) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 4096)
|
|
a.au3StatusbarGetText.Call(a.strPtr(szTitle), a.strPtr(szText), a.intPtr(nPart), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// StatusbarGetTextByHandle 获取状态栏文本(句柄)
|
|
// 入参: hWnd 窗口句柄, nPart 部分
|
|
// 返回: 状态栏文本
|
|
func (a *AuKit) StatusbarGetTextByHandle(hWnd uintptr, nPart int) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 4096)
|
|
a.au3StatusbarGetTextByHandle.Call(hWnd, a.intPtr(nPart), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// ToolTip 显示工具提示
|
|
// 入参: szTip 提示文本, nX, nY 坐标
|
|
func (a *AuKit) ToolTip(szTip string, nX, nY int) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
a.au3ToolTip.Call(a.strPtr(szTip), a.intPtr(nX), a.intPtr(nY))
|
|
}
|
|
|
|
// WinActivate 激活窗口
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinActivate(szTitle, szText string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinActivate, a.strPtr(szTitle), a.strPtr(szText))
|
|
}
|
|
|
|
// WinActivateByHandle 激活窗口(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinActivateByHandle(hWnd uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinActivateByHandle, hWnd)
|
|
}
|
|
|
|
// WinActive 检查窗口激活
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 1 激活
|
|
func (a *AuKit) WinActive(szTitle, szText string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinActive, a.strPtr(szTitle), a.strPtr(szText))
|
|
}
|
|
|
|
// WinActiveByHandle 检查窗口激活(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 1 激活
|
|
func (a *AuKit) WinActiveByHandle(hWnd uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinActiveByHandle, hWnd)
|
|
}
|
|
|
|
// WinClose 关闭窗口
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinClose(szTitle, szText string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinClose, a.strPtr(szTitle), a.strPtr(szText))
|
|
}
|
|
|
|
// WinCloseByHandle 关闭窗口(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinCloseByHandle(hWnd uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinCloseByHandle, hWnd)
|
|
}
|
|
|
|
// WinExists 检查窗口存在
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 1 存在
|
|
func (a *AuKit) WinExists(szTitle, szText string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinExists, a.strPtr(szTitle), a.strPtr(szText))
|
|
}
|
|
|
|
// WinExistsByHandle 检查窗口存在(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 1 存在
|
|
func (a *AuKit) WinExistsByHandle(hWnd uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinExistsByHandle, hWnd)
|
|
}
|
|
|
|
// WinGetCaretPos 获取光标位置
|
|
// 返回: 坐标
|
|
func (a *AuKit) WinGetCaretPos() Point {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
var pt Point
|
|
a.au3WinGetCaretPos.Call(uintptr(unsafe.Pointer(&pt)))
|
|
return pt
|
|
}
|
|
|
|
// WinGetClassList 获取类列表
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 类列表文本
|
|
func (a *AuKit) WinGetClassList(szTitle, szText string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3WinGetClassList.Call(a.strPtr(szTitle), a.strPtr(szText), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// WinGetClassListByHandle 获取类列表(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 类列表文本
|
|
func (a *AuKit) WinGetClassListByHandle(hWnd uintptr) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3WinGetClassListByHandle.Call(hWnd, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// WinGetClientSize 获取客户区大小
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 矩形区域, 1 成功
|
|
func (a *AuKit) WinGetClientSize(szTitle, szText string) (Rect, int) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
var r Rect
|
|
ret := a.getInt(a.au3WinGetClientSize, a.strPtr(szTitle), a.strPtr(szText), uintptr(unsafe.Pointer(&r)))
|
|
return r, ret
|
|
}
|
|
|
|
// WinGetClientSizeByHandle 获取客户区大小(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 矩形区域, 1 成功
|
|
func (a *AuKit) WinGetClientSizeByHandle(hWnd uintptr) (Rect, int) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
var r Rect
|
|
ret := a.getInt(a.au3WinGetClientSizeByHandle, hWnd, uintptr(unsafe.Pointer(&r)))
|
|
return r, ret
|
|
}
|
|
|
|
// WinGetHandle 获取窗口句柄
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 窗口句柄
|
|
func (a *AuKit) WinGetHandle(szTitle, szText string) uintptr {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
ret, _, _ := a.au3WinGetHandle.Call(a.strPtr(szTitle), a.strPtr(szText))
|
|
return ret
|
|
}
|
|
|
|
// WinGetHandleAsText 获取窗口句柄(文本)
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 句柄文本
|
|
func (a *AuKit) WinGetHandleAsText(szTitle, szText string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 256)
|
|
a.au3WinGetHandleAsText.Call(a.strPtr(szTitle), a.strPtr(szText), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// WinGetPos 获取窗口位置
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 矩形区域, 1 成功
|
|
func (a *AuKit) WinGetPos(szTitle, szText string) (Rect, int) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
var r Rect
|
|
ret := a.getInt(a.au3WinGetPos, a.strPtr(szTitle), a.strPtr(szText), uintptr(unsafe.Pointer(&r)))
|
|
return r, ret
|
|
}
|
|
|
|
// WinGetPosByHandle 获取窗口位置(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 矩形区域, 1 成功
|
|
func (a *AuKit) WinGetPosByHandle(hWnd uintptr) (Rect, int) {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
var r Rect
|
|
ret := a.getInt(a.au3WinGetPosByHandle, hWnd, uintptr(unsafe.Pointer(&r)))
|
|
return r, ret
|
|
}
|
|
|
|
// WinGetProcess 获取窗口进程ID
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: PID
|
|
func (a *AuKit) WinGetProcess(szTitle, szText string) uint32 {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
ret, _, _ := a.au3WinGetProcess.Call(a.strPtr(szTitle), a.strPtr(szText))
|
|
return uint32(ret)
|
|
}
|
|
|
|
// WinGetProcessByHandle 获取窗口进程ID(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: PID
|
|
func (a *AuKit) WinGetProcessByHandle(hWnd uintptr) uint32 {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
ret, _, _ := a.au3WinGetProcessByHandle.Call(hWnd)
|
|
return uint32(ret)
|
|
}
|
|
|
|
// WinGetState 获取窗口状态
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 状态码
|
|
func (a *AuKit) WinGetState(szTitle, szText string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinGetState, a.strPtr(szTitle), a.strPtr(szText))
|
|
}
|
|
|
|
// WinGetStateByHandle 获取窗口状态(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 状态码
|
|
func (a *AuKit) WinGetStateByHandle(hWnd uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinGetStateByHandle, hWnd)
|
|
}
|
|
|
|
// WinGetText 获取窗口文本
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 窗口文本
|
|
func (a *AuKit) WinGetText(szTitle, szText string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3WinGetText.Call(a.strPtr(szTitle), a.strPtr(szText), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// WinGetTextByHandle 获取窗口文本(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 窗口文本
|
|
func (a *AuKit) WinGetTextByHandle(hWnd uintptr) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 65536)
|
|
a.au3WinGetTextByHandle.Call(hWnd, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// WinGetTitle 获取窗口标题
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 标题文本
|
|
func (a *AuKit) WinGetTitle(szTitle, szText string) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 4096)
|
|
a.au3WinGetTitle.Call(a.strPtr(szTitle), a.strPtr(szText), uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// WinGetTitleByHandle 获取窗口标题(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 标题文本
|
|
func (a *AuKit) WinGetTitleByHandle(hWnd uintptr) string {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
buf := make([]uint16, 4096)
|
|
a.au3WinGetTitleByHandle.Call(hWnd, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
|
|
return syscall.UTF16ToString(buf)
|
|
}
|
|
|
|
// WinKill 强制关闭窗口
|
|
// 入参: szTitle 标题, szText 文本
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinKill(szTitle, szText string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinKill, a.strPtr(szTitle), a.strPtr(szText))
|
|
}
|
|
|
|
// WinKillByHandle 强制关闭窗口(句柄)
|
|
// 入参: hWnd 窗口句柄
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinKillByHandle(hWnd uintptr) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinKillByHandle, hWnd)
|
|
}
|
|
|
|
// WinMenuSelectItem 选择菜单项
|
|
// 入参: szTitle 标题, szText 文本, items 菜单项
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinMenuSelectItem(szTitle, szText string, items ...string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
args := make([]uintptr, 0, 10)
|
|
args = append(args, a.strPtr(szTitle), a.strPtr(szText))
|
|
for _, item := range items {
|
|
args = append(args, a.strPtr(item))
|
|
}
|
|
for i := len(items); i < 8; i++ {
|
|
args = append(args, a.strPtr(""))
|
|
}
|
|
return a.getInt(a.au3WinMenuSelectItem, args...)
|
|
}
|
|
|
|
// WinMenuSelectItemByHandle 选择菜单项(句柄)
|
|
// 入参: hWnd 窗口句柄, items 菜单项
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinMenuSelectItemByHandle(hWnd uintptr, items ...string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
args := make([]uintptr, 0, 9)
|
|
args = append(args, hWnd)
|
|
for _, item := range items {
|
|
args = append(args, a.strPtr(item))
|
|
}
|
|
for i := len(items); i < 8; i++ {
|
|
args = append(args, a.strPtr(""))
|
|
}
|
|
return a.getInt(a.au3WinMenuSelectItemByHandle, args...)
|
|
}
|
|
|
|
// WinMinimizeAll 最小化所有窗口
|
|
func (a *AuKit) WinMinimizeAll() {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
a.au3WinMinimizeAll.Call()
|
|
}
|
|
|
|
// WinMinimizeAllUndo 撤销最小化所有
|
|
func (a *AuKit) WinMinimizeAllUndo() {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
a.au3WinMinimizeAllUndo.Call()
|
|
}
|
|
|
|
// WinMove 移动窗口
|
|
// 入参: szTitle 标题, szText 文本, nX, nY 坐标, nWidth, nHeight 大小
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinMove(szTitle, szText string, nX, nY, nWidth, nHeight int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinMove, a.strPtr(szTitle), a.strPtr(szText), a.intPtr(nX), a.intPtr(nY), a.intPtr(nWidth), a.intPtr(nHeight))
|
|
}
|
|
|
|
// WinMoveByHandle 移动窗口(句柄)
|
|
// 入参: hWnd 窗口句柄, nX, nY 坐标, nWidth, nHeight 大小
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinMoveByHandle(hWnd uintptr, nX, nY, nWidth, nHeight int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinMoveByHandle, hWnd, a.intPtr(nX), a.intPtr(nY), a.intPtr(nWidth), a.intPtr(nHeight))
|
|
}
|
|
|
|
// WinSetOnTop 设置窗口置顶
|
|
// 入参: szTitle 标题, szText 文本, nFlag 1置顶
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinSetOnTop(szTitle, szText string, nFlag int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinSetOnTop, a.strPtr(szTitle), a.strPtr(szText), a.intPtr(nFlag))
|
|
}
|
|
|
|
// WinSetOnTopByHandle 设置窗口置顶(句柄)
|
|
// 入参: hWnd 窗口句柄, nFlag 1置顶
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinSetOnTopByHandle(hWnd uintptr, nFlag int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinSetOnTopByHandle, hWnd, a.intPtr(nFlag))
|
|
}
|
|
|
|
// WinSetState 设置窗口状态
|
|
// 入参: szTitle 标题, szText 文本, nFlags 状态
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinSetState(szTitle, szText string, nFlags int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinSetState, a.strPtr(szTitle), a.strPtr(szText), a.intPtr(nFlags))
|
|
}
|
|
|
|
// WinSetStateByHandle 设置窗口状态(句柄)
|
|
// 入参: hWnd 窗口句柄, nFlags 状态
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinSetStateByHandle(hWnd uintptr, nFlags int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinSetStateByHandle, hWnd, a.intPtr(nFlags))
|
|
}
|
|
|
|
// WinSetTitle 设置窗口标题
|
|
// 入参: szTitle 标题, szText 文本, szNewTitle 新标题
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinSetTitle(szTitle, szText, szNewTitle string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinSetTitle, a.strPtr(szTitle), a.strPtr(szText), a.strPtr(szNewTitle))
|
|
}
|
|
|
|
// WinSetTitleByHandle 设置窗口标题(句柄)
|
|
// 入参: hWnd 窗口句柄, szNewTitle 新标题
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinSetTitleByHandle(hWnd uintptr, szNewTitle string) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinSetTitleByHandle, hWnd, a.strPtr(szNewTitle))
|
|
}
|
|
|
|
// WinSetTrans 设置窗口透明度
|
|
// 入参: szTitle 标题, szText 文本, nTrans 透明度
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinSetTrans(szTitle, szText string, nTrans int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinSetTrans, a.strPtr(szTitle), a.strPtr(szText), a.intPtr(nTrans))
|
|
}
|
|
|
|
// WinSetTransByHandle 设置窗口透明度(句柄)
|
|
// 入参: hWnd 窗口句柄, nTrans 透明度
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinSetTransByHandle(hWnd uintptr, nTrans int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinSetTransByHandle, hWnd, a.intPtr(nTrans))
|
|
}
|
|
|
|
// WinWait 等待窗口
|
|
// 入参: szTitle 标题, szText 文本, nTimeout 超时
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinWait(szTitle, szText string, nTimeout int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinWait, a.strPtr(szTitle), a.strPtr(szText), a.intPtr(nTimeout))
|
|
}
|
|
|
|
// WinWaitByHandle 等待窗口(句柄)
|
|
// 入参: hWnd 窗口句柄, nTimeout 超时
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinWaitByHandle(hWnd uintptr, nTimeout int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinWaitByHandle, hWnd, a.intPtr(nTimeout))
|
|
}
|
|
|
|
// WinWaitActive 等待窗口激活
|
|
// 入参: szTitle 标题, szText 文本, nTimeout 超时
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinWaitActive(szTitle, szText string, nTimeout int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinWaitActive, a.strPtr(szTitle), a.strPtr(szText), a.intPtr(nTimeout))
|
|
}
|
|
|
|
// WinWaitActiveByHandle 等待窗口激活(句柄)
|
|
// 入参: hWnd 窗口句柄, nTimeout 超时
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinWaitActiveByHandle(hWnd uintptr, nTimeout int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinWaitActiveByHandle, hWnd, a.intPtr(nTimeout))
|
|
}
|
|
|
|
// WinWaitClose 等待窗口关闭
|
|
// 入参: szTitle 标题, szText 文本, nTimeout 超时
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinWaitClose(szTitle, szText string, nTimeout int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinWaitClose, a.strPtr(szTitle), a.strPtr(szText), a.intPtr(nTimeout))
|
|
}
|
|
|
|
// WinWaitCloseByHandle 等待窗口关闭(句柄)
|
|
// 入参: hWnd 窗口句柄, nTimeout 超时
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinWaitCloseByHandle(hWnd uintptr, nTimeout int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinWaitCloseByHandle, hWnd, a.intPtr(nTimeout))
|
|
}
|
|
|
|
// WinWaitNotActive 等待窗口取消激活
|
|
// 入参: szTitle 标题, szText 文本, nTimeout 超时
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinWaitNotActive(szTitle, szText string, nTimeout int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinWaitNotActive, a.strPtr(szTitle), a.strPtr(szText), a.intPtr(nTimeout))
|
|
}
|
|
|
|
// WinWaitNotActiveByHandle 等待窗口取消激活(句柄)
|
|
// 入参: hWnd 窗口句柄, nTimeout 超时
|
|
// 返回: 1 成功
|
|
func (a *AuKit) WinWaitNotActiveByHandle(hWnd uintptr, nTimeout int) int {
|
|
a.lock.Lock()
|
|
defer a.lock.Unlock()
|
|
return a.getInt(a.au3WinWaitNotActiveByHandle, hWnd, a.intPtr(nTimeout))
|
|
}
|