2011-04-06 46 views
1

我是White的新手。有人可以告訴我如何運行一個exe文件(使用日誌密碼)並打印該exe文件中的所有元素?c#白色框架 - 代碼項目

我沒有使用

Application application = Application.Launch("exe /password)" 

,但它無法正常工作。

+4

什麼是白色的項目? – Oded 2011-04-06 14:18:43

+0

白色項目是源代碼不被盜用或從其他代碼複製的項目:-)我猜 – 2011-04-06 14:21:17

+8

白色是一個基於Win32,WinForms,WPF,Silverlight和SWT(Java)平臺的自動化富客戶端應用程序的框架。它基於.NET,不需要使用任何專有腳本語言 – 2011-04-06 14:21:23

回答

1

Elisa 我假設你想從包含listview或gridview的表單中獲取電話號碼並將它們寫入文件或其他控件。所以我的頭頂部的:)這裏有雲

//啓動該應用

應用程序= Application.Launch(「.exe文件的完整路徑」);

//啓動應用程序

窗WIN = app.GetWindow(Core.UIItems.Finders.SearchCriteria.ByAutomationId( 「Form1的」),Core.Factory.InitializeOption.NoCache)後獲得的主窗口;

//獲取列表/ GRIDVIEW類型的表及其在白

變種listOfPhonesNumbers = win.Get < Table>(SearchCriteria.ByAutomationId( 「grdPhoneNumber」));

的for(int i = 0; i 「的<」 listOfPhoneNumbers.Rows.Count;我++){ /// 印刷的電話號碼,任何文件 }

0
#region lanch App 
// source exe file path. here it is calculator exe path 
const string ExeSourceFile = @"C:\Windows\system32\calc.exe"; 
//Global Variable to for Application launch 
White.Core.Application _application; 
//Global variable to get the Main window of calculator from application. 
White.Core.UIItems.WindowItems.Window _mainWindow; 
//start process for the above exe file location 
var psi = new ProcessStartInfo(ExeSourceFile); 
// launch the process through white application 
_application = White.Core.Application.AttachOrLaunch(psi); 
//Get the window of calculator from white application 
_mainWindow = _application.GetWindow 
(SearchCriteria.ByText("Calculator"), InitializeOption.NoCache); 
#endregion