Article

grahamch's picture
article
Reads:

4310

Score:
3
3
9
 
Comments:

0

Displaying Apps only if Screen Size is Right

Author Info

10 November 2007 - 11:00pm
Submitted by: grahamch

(View Disclaimer)

By Chris Graham

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


Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

© 2013 Novell