Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Close osdText window
#1
For some reason, I need to close the osdText window when a certain window is not visible. The following code will prompt an error when executed. Why?

Code:
Copy      Help
//.
script.setup(trayIcon: true, sleepExit: true);
//..

var w = wnd.find(1, "LibreAutomate", "HwndWrapper[Au.Editor;*");

int _M = 0; //Line18 ERR
//int _M = 1; //Line18 OK


osdText osd = null;
if (_M == 1)
{

    osd = osdText.showText("hello", -1);
}


wait.until(3, () => !w.IsVisible); 

if (osd != null) osd.Close(); osd.Dispose();
#2
osd.Dispose called with osd null.

You can run the script with debugger. It stops on exception at osd.Dispose, and in the Variables panel you can see osd=null.

Don't need Dispose here, because osd.Close just calls Dispose. You can press F12 and to see the source code.
#3
thank you!


Forum Jump:


Users browsing this thread: 1 Guest(s)