檢視 AutoIt 的原始碼
←
AutoIt
跳至導覽
跳至搜尋
由於下列原因,您沒有權限進行編輯此頁面的動作:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
'''AutoIt''',{{wikipedia|AutoIt|lang=en}} *[https://www.autoitscript.com/site/autoit/downloads/ AutoIt] ==技術文件== *[https://www.autoitscript.com/autoit3/docs/ AutoIt3 docs] ==應用== ===Hello world=== <source lang="autoit"> ; Make available a library of constant values. #include <MsgBoxConstants.au3> ; Displays "Hello, world!" in a messagebox. MsgBox($MB_SYSTEMMODAL, "Title", "Hello, world!") </source> ===Automating the Windows Calculator=== <source lang="autoit"> ; Make available a library of constant values. #include <MsgBoxConstants.au3> ; Display a message box with a timeout of 6 seconds. MsgBox($MB_OK, "Attention", "Avoid touching the keyboard or mouse during automation.", 6) ; Run the Windows Calculator. Run("calc.exe") ; Wait for the calculator to become active with a timeout of 10 seconds. WinWaitActive("[CLASS:CalcFrame]", "", 10) ; If the calculator did not appear after 10 seconds then exit the script. If WinExists("[CLASS:CalcFrame]") = 0 Then Exit ; Automatically type the current year into the calculator. Send(@YEAR) ; Let's slow the script down a bit so we can see what's going on. Sleep(600) ; Automatically type in 'divide by 4', and then sleep 600 ms. Send("/4") Sleep(600) ; Hit the return key to display the result, and sleep 600 ms. Send("{ENTER}") Sleep(600) ; Copy the result to the clipboard using the Windows shortcut Ctrl+C. Send("^c") ; Declare, and assign the contents of the clipboard to, a variable. Local $fResult = ClipGet() ; Check to see if the variable contains a decimal point or not. If StringInStr($fResult, ".") Then ; Display a message box with a timeout of 5 seconds. MsgBox($MB_OK, "Leap Year", @YEAR & " is not a leap year.", 5) Else ; This message will only display if the current year is a leap year. MsgBox($MB_OK, "Leap Year", @YEAR & " is a leap year.", 5) EndIf ; Close the Windows calculator - always tidy up afterwards. WinClose("[CLASS:CalcFrame]") </source> ===Find average=== <source lang="autoit"> ; Find Average by JohnOne, modified by czardas #include <MsgBoxConstants.au3> _Example() ; Run the example. Func _Example() ; Display an input box and ask the user to enter some numbers separated by commas. Local $sInput = InputBox("Find Average", "Enter some numbers separated by commas: 1,2,42,100,3") ; If an error occurred then exit the script. If @error Then Exit ; Populate an array with the user's input. Local $aSplit = StringSplit($sInput, ",") ; Pass the array to the function _Find_Average() and then check for errors. Local $fAverage = _Find_Average($aSplit) If @error Then Exit ; Display the result in a message box. MsgBox($MB_OK, "Find Average", "Result: " & $fAverage) EndFunc ;==>_Example Func _Find_Average($aArray) ; If the input is not of the correct type (an array), then return an error along with the details. If Not IsArray($aArray) Then Return SetError(1, 0, VarGetType($aArray)) ; More detailed checks are possible, but for brevity just one is performed here. ; Declare a variable to store the sum of the numbers. Local $iArraySum = 0 ; Loop through the array. For $i = 1 To $aArray[0] ; Increment the sum by the number in each array element. $iArraySum += Number($aArray[$i]) Next ; Return the average rounded to 2 decimal places. Return Round($iArraySum / $aArray[0], 2) EndFunc ;==>_Find_Average </source> [[Category:BASIC程式語言家族]] [[分類:Script語言]]
此頁面使用了以下模板:
模板:Wikipedia
(
檢視原始碼
)
返回「
AutoIt
」頁面
導覽選單
個人工具
登入
命名空間
頁面
討論
變體
視圖
閱讀
檢視原始碼
檢視歷史
更多
搜尋
導覽
首頁
社群入口
新聞動態
新聞直播
近期變更
Online IDE
分類
程式語言
資料結構
演算法
技術
軟體
SQL資料庫
網站套件
免費資源
副檔名
檔案格式
分類
其他
動畫
漫畫
小說
小說導讀
驅動程式
購物用
求職網站
推薦書單
線上學習
技術類News或部落格
Microsoft devblogs
網頁技術News
資料技術News
安全性相關News
MS-MVP
藍色小舖認證專家
經營行銷類部落格
工具
連結至此的頁面
相關變更
特殊頁面
頁面資訊