Разрешение экрана (AFL+VBScript)
Потребовалось узнать разрешение экрана в скрипте AFL. К моему удивлению, функция Status разрешение экрана не выдает. Пришлось написать самому.
Включим в текст скрипта вставку на VBScript. Чтобы не создавать объект htmlfile на каждой итерации, закешируем результаты работы.
EnableScript("vbscript");
// Получение размера рабочего стола
function Get_Screen_Resolution()
{ local Width,Height;
<%
set document = CreateObject("htmlfile")
With document.parentWindow.screen
AFL("Width") = .availWidth
AFL("Height") = .availHeight
End With
%>
StaticVarSet("Screen_Width",Width);
StaticVarSet("Screen_Height",Height);
}
function Screen_Width()
{ local Width;
Width = Nz(StaticVarGet("Screen_Width"));
if (Width == 0)
{ Get_Screen_Resolution();
Width = StaticVarGet("Screen_Height");
}
return Width;
}
function Screen_Height()
{ local Height;
Height = Nz(StaticVarGet("Screen_Height"));
if (Height == 0)
{ Get_Screen_Resolution();
Height = StaticVarGet("Screen_Height");
}
return Height;
}
Что мы имеем с гуся?
_TRACE("" + Screen_Width() + "*" + Screen_Height());
на моем рабочем ноутбуке выдает совершенно ожидаемый результат:
1600*900
