Novell Home

Displaying Apps only if Screen Size is Right

Novell Cool Solutions: Tip
By Chris Graham

Digg This - Slashdot This

Posted: 9 Nov 2007
 

PROBLEM: We have a NAL application that we only want to be available if the screen resolution is 1024x768 or higher. We have had no luck finding anything in the registry, in a readable format, to determine the screen size.

Solution

Create a forced-run, install-only NAL app. Place the code in the Run Options|Launch Scripts|Run before Launching box. Set the Script Engine Location to wscript.exe and the file extension to .vbs

The code will determine the screen resolution, create an environment variable (ScrRes) with the value of the width of the screen and refresh NAL.

We then use the ScrRes variable to determine the availability of our other application.

Example

set oShell = wscript.createobject("wscript.shell")
set sysenv = oshell.environment("Volatile")

'*** Get width value of screen resolution
with createobject("internetexplorer.application")
    .navigate "about:blank"

'*** Set the ScrRes environment variable to equal the screen width
    with .document.parentWindow.screen
       sysenv("ScrRes") = .width
    end with
end with

'*** Wait 5 seconds and refresh NAL
wscript.sleep 5000

oShell.run "Z:\mgmt\ConsoleOne\1.2\lib\zen\autorun.exe"

If you have any questions you may contact Chris at grahamcTAKETHISOUT@tbh.net


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell