码迷,mamicode.com
首页 > 其他好文 > 详细

关于AutoIT

时间:2015-05-19 21:00:52      阅读:121      评论:0      收藏:0      [点我收藏+]

标签:aotoit

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

标签:aotoit

原文地址:http://blog.csdn.net/crbrave/article/details/45848621

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!