USING White with Messenger (Yahoo, MSN, etc)

Jul 24, 2008 at 6:54 PM

I am having trouble implementing White for use with a messenger program. The idea is that when an event of interest happens, I would like to have White bring up a messenger and send a text message.

For some reason, White did not see the MSN messenger when searching by name. I switched to Yahoo. White will start the application fine. However, there is a lag in time because Yahoo has to login in and get connected. I tried to implement the WAIT method built in, but it has no noticeable effect:

MSGpgm = "C:/Program Files/Yahoo!/Messenger/YahooMessenger.exe";

 

 

 

Application msgApplication = Application.Launch(MSGpgm);

 

msgApplication.WaitWhileBusy();

// some other code here, which executes immediately...

WaitWhileBusy seems to get passed over immediately and the program moves on to the next line of code which will generate an error. (Invalid object error) So, I add a manual wait:

Thread.Sleep(4000);

 

 

This works, which tells me my previous errors were timing problems.
Is my idea of what a WaitWhileBusy() function incorrect? I would have thought that WHite would sit and wait until Yahoo Messenger became busy... no?

 

Coordinator
Jul 24, 2008 at 8:46 PM
Application.WaitForInputIdle is a wrapper over .NET Process object. This would start responding as soon as window can start processing window messages. but in this case it wouldn't even know that there is a window going to be displayed at the time it is called.
In any case you should npt rely on it for window to appear. If you call application.GetWindow it would wait till window appears or BusyTimeout happens.