Currently you cannot know the screen size directly from a JavaScript script in PixInsight. I am considering a new core JavaScript object to provide information like display metrics, system folders, memory limits, etc. This could be a System object.
On X11 (FreeBSD and Linux) you can use xrandr to find the current screen geometry. For example:
xrandr -q | grep Screen
which on my workstation gives:
Screen 0: minimum 320 x 200, current 2560 x 1440, maximum 2560 x 2560
Using the ExternalProcess object it is very easy to get xrandr's output, where one can find the required information:
var X = new ExternalProcess( "xrandr", ["-q"] );
console.writeln( "<raw>" + X.standardOutput + "</raw>" );
I don't know if similar commands exist on Windows or Mac OS X.
Besides that, if you need to know screen dimensions, that's probably because you're trying to do something nonportable. If you design your script's dialog to fit well in a reasonable screen resolution, such as 1280x960 for example, there should be no problems.