如何在執行期間改變目前使用者?
主要軟體:
主要軟體版本: 3.5
主要軟體修正版本:
次要軟體: N/A
問題: 在執行期間改變目前使用者的唯一辦法是退出再重新登錄TestStand。在一個序列執行期間,我需要一個開發員以管理員的身份登錄,執行一些操作然後回到正常的作業員(operator)權限繼續運行系統以保持校正功能。我該如何進行?
解答: 為了在執行過程中改變使用者,您必須通過ActiveX/COM的Action步驟,利用TestStand API程式來進行。首先,您必須為您想要登錄的使用者找到使用者物件。然後您必須將該使用者設置為目前使用者。依照下列步驟撰寫程式進行改變目前使用者:
1. 建立一個名為NewUser的局部變數,類型為物件,以保存使用者物件reference。
2. 為您希望登錄的使用者取得使用者物件:
- Object Reference: RunState.Engine
- Automation Server: NI TestStand API 3.5 (Ver 1.0)
- Object Class: Engine (IEngine)
- Action: Call Method
- Method: GetUser
- Param (Return Value): Locals.NewUser
- Param (LoginName): 您希望登錄的使用者名稱
3. 將目前使用者改變為我們希望登錄的使用者
- Object Reference: RunState.Engine
- Automation Server: NI TestStand API 3.5 (Ver 1.0)
- Object Class: Engine (IEngine)
- Action: Set Property
- Property: CurrentUser
- Param (newValue): Locals.NewUser
相關連結: KnowledgeBase 3V6JBTO8: How do I Disable All User Management in TestStand?
附加檔案:
報告日期: 04/14/2006
最後更新: 12/26/2007
文件偏號: 3WDCJAO8
Other Support Options
Ask the NI Community
Collaborate with other users in our discussion forums
Request Support from an Engineer
A valid service agreement may be required, and support options vary by country.