关于AutoIT

AutoIt设计初衷是对PC进行批量配置。后来以为其简单,轻量级的特点,多用于设计重复工作脚本。

以下是一些函数的具体用法code…

GUI界面:

;gui
#include <GUIConstantsEx.au3>
Func GetConvertXMLName()
    Local $file, $btn, $msg, $input
    GUICreate("Please select convert XML:", 390, 80, @DesktopWidth / 2 - 200, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES   
    $file = GUICtrlCreateCombo("Loader\Scripts\FullQAImportLoaderScript.xml", 20, 22, 280, 25, 0x0003) ; create first item
    GUICtrlSetData(-1, "Loader\Scripts\MDSLoaderScript.xml", "Loader\Scripts\FullQAImportLoaderScript.xml") ; add other item snd set a new default
    $btn = GUICtrlCreateButton("OK", 310, 20, 70, 25)
    GUISetState()
    $msg = 0
    While $msg <> $GUI_EVENT_CLOSE
        $msg = GUIGetMsg()
        Select
            Case $msg = $btn
                ExitLoop
        EndSelect
    WEnd
    If $msg = $GUI_EVENT_CLOSE Then Exit
    $input = GUICtrlRead($file)
    GUIDelete()
    Return $input
EndFunc

热键:

HotKeySet("{Esc}", "captureEsc")
Func captureEsc()
   If MsgBox(4,"","Do you really want to quit?") = 6 Then Exit
EndFunc

文件操作:

Local $search = FileFindFirstFile($Dir&"*")
While 1
   Local $file = FileFindNextFile($search)
   If @error Then ExitLoop
   Sleep (1000)
WEnd

正则表达式:

$file = StringRegExp($read, '<File>\\'&StringRegExpReplace($input, "Script.xml", "")&'\\(.*?)</File>', 3)
$R = StringRegExpReplace($IntanceName, ".xml", "")

对控件操作:

ControlClick("[ New ]", "", "WindowsForms10.BUTTON.app.0.2bf8098_r11_ad17")
Send($fileName[0])
Sleep (1000)
WinWait("[ New ]")
If Not WinActive("[ New ]","") Then WinActivate("[ New ]","")
ControlSetText("[ New ]", "", "WindowsForms10.RichEdit20W.app.0.2bf8098_r11_ad11", $read)

AutoIt的官方文档写的特别详细一些函数自带demo实现,特别适合新手上手。

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值