windows自动化-脚本案例

; Script Start - Add your code below here
Run("D:\Navicat Premium\navicat.exe")
Sleep(1000)

;~ 获取窗口句柄
$handle=WinGetHandle("Navicat Premium", "")
Sleep(1000)

;~ 最大化
WinSetState($handle, "", @SW_MAXIMIZE)
Sleep(1000)

;~ 激活窗口
WinActivate($handle)
Sleep(1000)

; 定位控件——获取窗口句柄,根据classnameNN为TVirtualStringTree1
$control_handle = ControlGetHandle($handle,"","TVirtualStringTree1")
Sleep(1000)

;~ 右击控件
ControlClick($handle,"",$control_handle,"right")
Sleep(1000)


Send("{DOWN 3}")
Sleep(1000)

Send("{ENTER}")
Sleep(1000)

Send("{DOWN 5}")
Sleep(1000)

Send("{ENTER}")
Sleep(1000)

;~ 获取窗口句柄
$handle_mariadb_newconf=WinGetHandle("MariaDB - 新建连接", "")
Sleep(1000)


;~ 激活窗口
WinActivate($handle_mariadb_newconf)
Sleep(1000)

; 定位控件——获取窗口句柄,根据classnameNN为TVirtualStringTree1
$control_handle_new_name = ControlGetHandle($handle,"","TEdit5")
Sleep(1000)
Send("mariadb_2")


$control_handle_ip = ControlGetHandle($handle_mariadb_newconf,"","TEdit1")
ControlClick($handle_mariadb_newconf,"",$control_handle_ip,"left")
Sleep(1000)
Send("^a")
Send("120.24.25.71")

$control_handle_port = ControlGetHandle($handle_mariadb_newconf,"","TEdit4")
Sleep(1000)
ControlClick($handle_mariadb_newconf,"",$control_handle_port,"left")
Sleep(1000)
Send("^a")
Send("3306")

$control_handle_user = ControlGetHandle($handle_mariadb_newconf,"","TEdit3")
Sleep(1000)
ControlClick($handle_mariadb_newconf,"",$control_handle_user,"left")
Sleep(1000)
Send("^a")
Send("USER")

$control_handle_mm = ControlGetHandle($handle_mariadb_newconf,"","TEdit2")
Sleep(1000)
ControlClick($handle_mariadb_newconf,"",$control_handle_mm,"left")
Sleep(1000)
Send("^a")
Send("mmmmmmm")

Sleep(1000)
Send("{ENTER}")

  

windows自动化-脚本案例

上一篇:C# 自定义特性(Attribute)详解


下一篇:[UWP]用Win2D和CompositionAPI实现文字的发光效果,并制作动画