[AutoIT] 執行應用程式

程式語言:AutoIT

功能:執行應用程式 (開機可用)

  • 等待 Process
  • ProcessWait ( "process" [, timeout = 0] )

  • 檢查 Process 是否存在
  • ProcessExists ( "process" ) 

  • 檢查視窗是否存在
  • WinExists ( "title" [, "text"] )  

  • 執行應用程式
  • ShellExecute ( "filename" [, "parameters" [, "workingdir" [, "verb" [, showflag]]]] )
  • Run ( "program" [, "workingdir" [, show_flag [, opt_flag]]] )


建議:可寫開啟多個應用程式的程式,將之放在啟動
即會在一開機開啟需要的程式,像:固定的記帳、固定的網頁、固定的學習


範例:開啟 foobar2000.exe
If ProcessExists("foobar2000.exe") == 0 Then
    Run("C:\Program Files\foobar2000\foobar2000.exe")
    ProcessWait("foobar2000.exe")
EndIf
範例:開啟記帳 Excel
While WinExists("Microsoft Excel - " & @YEAR) == 0 Or ProcessExists("EXCEL.EXE") == 0
    ShellExecute("記帳\" & @YEAR & ".xls")
    $c = 0
    While WinExists("Microsoft Excel - " & @YEAR) == 0 and $c < 30
        Sleep(1000)
        $c += 1
    WEnd
WEnd

留言