在智慧工人中每個動作指令都會有一個相對應的VBScript函數,這此函數的執行效果完全一樣,利用這些函數來撰寫VBScript,能對於流程控制有更大自由度,甚至能夠設計出一個小型的程式。
|
|
|
開啟我的電腦: |
Window.OpenMyComputer( [傳入至物件的名稱 = ""] ) |
call Window.OpenMyComputer("Object1") |
開啟我的電腦到某位置: |
Window.OpenMyComputerTo( 路徑 , [傳入至物件的名稱 = ""] ) |
call Window.OpenMyComputerTo("C:\Folder1" , "Object1") |
執行程式/檔案: |
Window.Execute( 路徑 , [傳入至物件的名稱 = ""] ) |
call Window.Execute("C:\Windows\Notepad.exe" , "Object1") |
執行提示命令字元: |
Window.Run( 字串, [是否隱藏 = False] ) |
call Window.Run("Regedit") |
改變視窗狀態(由視窗標題): |
Window.SetWinStatusFromTitle( 視窗標題 , 視窗狀態)
視窗狀態:
設定成焦點視窗 = 5
隱藏視窗 = 0
顯示視窗 = 1
最大化視窗 = 3
最小化視窗 = 2
關閉視窗 = 4
|
call Window.SetWinStatusFromTitle("未命名 - 記事本" , 3) |
改變視窗狀態(由視窗物件): |
Window.SetWinStatusFromObject( 物件名稱 , 視窗狀態)
視窗狀態:
設定成焦點視窗 = 5
隱藏視窗 = 0
顯示視窗 = 1
最大化視窗 = 3
最小化視窗 = 2
關閉視窗 = 4 |
call Window.SetWinStatusFromObject("Object1",3) |
改變視窗屬性(由視窗標題): |
Window.SetWinPropertyFromTitle( 視窗標題 , X軸 , Y軸 , 長 , 高 , 新標題 ) |
call Window.SetWinPropertyFromTitle("未命名 - 記事本", 500,300,600,500,"新標題") |
改變視窗屬性(由視窗物件): |
Window.SetWinPropertyFromObject( 物件名稱 , X軸 , Y軸 , 長 , 高 , 新標題 ) |
call Window.SetWinPropertyFromObject("Object1", 500,300,600,500,"新標題") |
由位置抓取視窗: |
Window.GetWinFromXY ( X軸 , Y軸 ,傳入至物件的名稱) |
call Window.GetWinFromXY(300,200,"Object1") |
由標題抓取視窗: |
Window.GetWinFromTitle ( 視窗標題 ,傳入至物件的名稱) |
call Window.GetWinFromTitle("未命名 - 記事本","Object1") |
抓取焦點中的視窗: |
Window.GetWinFromFocus (傳入至物件的名稱) |
call Window.GetWinFromFocus("Object1") |
|
|
|
開啟光碟機門: |
Media.OpenCdRom() |
call Media.OpenCdRom() |
關閉光碟機門: |
Media.CloseCdRom() |
call Media.CloseCdRom() |
顯示圖像: |
Media.PictureShow( 圖像檔案路徑 , [隱藏滑鼠=False] ) |
call Media.PictureShow("C:\pic.bmp") |
聲音播放: |
Media.PlaySound( 音效檔案路徑 , [播放次數=1] ) |
call Media.PlaySound("C:\sound.mp3") |
設定主音量: |
Media.SetVolume( 音量百分比 ) |
call Media.SetVolume(50) |
螢幕抓圖(全螢幕): |
Media.PrintScreen( 圖像存儲路徑 ) |
call Media.PrintScreen("C:\PrtScr.bmp") |
螢幕抓圖(焦點中的視窗): |
Media.PrintActiveScreen( 圖像存儲路徑 ) |
call Media.PrintActiveScreen("C:\PrtScr.bmp") |
|
|
|
由顏色抓取坐標(整個螢幕)(v3.01新加入): |
Color.GetCoordInFullScn( 顏色值 , 把X位置傳入變數的名稱 , 把Y位置傳入變數的名稱 )
此函式會傳回坐標字串(如 "350,250" ) |
call Color.GetCoordInFullScn(14872561,"VarX","VarY") |
由顏色抓取坐標(特定某個範圍)(v3.01新加入): |
Color.GetCoordInCusArea( 顏色值 , 把X位置傳入變數的名稱 , 把Y位置傳入變數的名稱 , X1 , Y1 , X2 , Y2)
此函式會傳回坐標字串(如 "350,250" ) |
call Color.GetCoordInCusArea(14872561,"VarX","VarY",0,0,500,500) |
由坐標抓取顏色值(v3.01新加入): |
Color.GetColorByCoord( X位置 , Y位置 , [傳入變數的名稱] )
此函式會傳回顏色值 |
ColorValue = Color.GetColorByCoord(450,250) |
|
|
|
下載檔案: |
Internet.DownloadFile( 檔案網址 , 存儲位置 , [逾時時間(秒)=60] ) |
call Internet.DownloadFile("Http://www.cleverworkerpro.com/cw30.zip","C:\cw30.zip") |
傳送郵件: |
Internet.SendEmail(收件人電郵 , 標題 , 內容) |
call Internet.SendEmail("admin@cleverworkerpro.com","Title","Text Body") |
開啟網頁: |
Internet.OpenURL( 網址 , [傳入至物件的名稱=""] , [等待網頁載入完成= False] ) |
call Internet.OpenURL("Http://www.cleverworkerpro.com","",True) |
設定IE動作: |
Internet.SetIEAction( IE物件名稱 , 動作 , [新網址=""] , [等待網頁載入完成= False] )
動作:
重新整理 = 0
停止 = 1
上一頁 = 2
下一頁 = 3
首頁 = 4
瀏覽網址 = 5
|
call Internet.SetIEAction("IEObject",0) |
|
|
|
建立資料夾: |
IO.CreateFolder ( 新資料夾位置 ) |
call IO.CreateFolder("C:\Folder1") |
刪除資料夾: |
IO.DeleteFolder( 資料夾位置 ) |
call IO.DeleteFolder("C:\Folder1") |
複製資料夾: |
IO.CopyFolder( 來源地資料夾 , 目的地資料夾 ) |
call IO.CopyFolder("C:\Folder1","C:\Folder2") |
重新命名/移動 資料夾: |
IO.RenameFolder(來源地資料夾 , 目的地資料夾) |
call IO.RenameFolder("C:\Folder1","C:\Folder2") |
複製檔案: |
IO.CopyFiles( 來源地檔案 ,目的地資料夾 ) |
call IO.CopyFiles("C:\File1.txt|File2.txt","C:\Folder1") |
移動檔案: |
IO.MoveFile( 來源地檔案 ,目的地資料夾 ) |
call IO.MoveFile("C:\File1.txt|File2.txt","C:\Folder1") |
檔案重新命名: |
IO.RenameFile( 檔案來源名稱 , 檔案目的名稱) |
call IO.RenameFile("C:\Source.txt","C:\Location.txt") |
刪除檔案: |
IO.DeleteFiles( 檔案位置 ) |
call IO.DeleteFiles("C:\File1.txt") |
寫入檔案: |
IO.WriteFile( 檔案位置 , 要寫入的文字 , [是否覆蓋=False] ) |
call IO.WriteFile("C:\File1.txt","Text Body") |
讀入檔案(v3.01新加入): |
IO.ReadFile( 檔案位置 , 要傳入變數的名稱 )
此函式會傳回檔案內容 |
str = IO.ReadFile("C:\File1.txt") |
檢查檔案是否存在(v3.01新加入): |
IO.IsFileExist( 檔案位置 ) |
IsExist = IO.IsFileExist("C:\File1.txt") |
檢查資料夾是否存在(v3.01新加入): |
IO.IsFolderExist( 資料夾位置 ) |
IsExist = IO.IsFolderExist("C:\Folder1") |