Actions之間傳遞參數的三種方法:
- DataTable
- Environment
- Action Parameters
=============================
分別以三個例子來說明這三種方法:
DataTable
Action1:
Dim parameter
parameter="DataTable"
DataTable.Value(1,1)=parameter
Action2:
msgbox parameter // 無法得到輸出結果
msgbox DataTable.Value(1,1) //輸出結果爲DataTable
Environment
Action1:
Dim parameter
parameter="Environment"
Environment.Value("aaa")=parameter
msgbox Environment.Value("aaa")
Action2:
msgbox parameter // 無法得到輸出結果
msgbox Environment("aaa") // 輸出結果爲Environment
Action Parameter
*必須要有對象庫
Action1:
1.在Action1上點右鍵>>>Action Properties>>>Parameters
2.在OutPut parameter中添加一個參數名
3.在Keyword視圖中,在需要傳值的控件上點右鍵>>>Insert Output Value,在Type列中勾選需要傳的值,點 Modify 按鈕, Output Types中選擇 action parameter,Parameter選擇步驟2中設置的參數名
Action2:
1.在Action2上點右鍵>>>Action Properties>>>Parameters
2.在Input parameters中添加一個參數名pb
3.在Action2上點右鍵>>>Action Call Properties>>>Parameter Values
4.在Input parameters中找到步驟2添加的參數名,在Value列上點擊 Configure the value 按鈕,在Parameter中選擇action parameter,在Output from previous action call(s) 中,Action選Action1,Parameter選擇Action1中步驟2中設置的參數名
可以通過msgbox parameter("pb")輸出傳參的結果。