Hi Dhanalakshmi,
Hi, I need to check whether my appication which get opened with IE is in Full Screen mode or is in Maximize state. |
To check whether the browser window is maximized, I recommend using the following function to which you should pass the browser window (the IEFrame object) as a parameter:
function IsMaximized(Window)
{
return ((Window["WndStyles"] & Win32API["WS_MAXIMIZE"]) == Win32API["WS_MAXIMIZE"]);
}
// Example usage:
function Test()
{
var wmdIE = Sys["Process"]("IEXPLORE")["IEFrame"](0);
var bIsMaximized = IsMaximized(wmdIE);
Log.Message(bIsMaximized);
}
To check whether Internet Explorer is in Full Screen mode, you can try checking the native
FullScreen and
TheatreMode properties of the Page object. I'm not sure if this is a 100% solution, but it worked in the scenarios I've tried:
function IsFullScreen(Page)
{
return (Page.FullScreen || Page.TheaterMode); // Note: IE only!!!
}
// Example usage:
function Test()
{
var page = Sys.Process("IEXPLORE").Page("*");
var bIsFullScreen = IsFullScreen(page);
Log.Message(bIsFullScreen);
page.Keys("[F11]"); // Toggle Full Screen
bIsFullScreen = IsFullScreen(page);
Log.Message(bIsFullScreen);
}
Now about your language syntax questions.
1) Is there any data type should I use to get an boolean value?
e,g: Var variablename = TestObj.Focused; ( will this work in my case) |
No, you simply use the
var keyword to define a variable and don't specify the data type. All script variables are of the so-called
Variant type, which means they can hold different data types at different times. For more information about declaring variables in JScript/C#Script, see these MSDN articles:
JScript Variablesvar StatementvarBoolean w =r.Focused //scripts throws error in this line, saying " ; " expected |
It errors out on
varBoolean; the correct syntax is:
2) if..then is not working in this case..Why?
...
if (w = true)
Log.FullMode(""); |
In JScript/C#Script, you use a double equal sign == to compare values:
For boolean values (true/false), you can also use:
if (w)
// statements for true
else
// statements for false
A single equal sign = is used for variable assignments. Your original code doesn't work because it essentially sets the w variable to true, and as a result, the condition always evaluates to true.