Jump to content
Sign in to follow this  
jammzhentai450

A problem with CaseSwitch

Recommended Posts

jammzhentai450

I am making an information viewer that tells the user about their system. The OS part bugs me as it says, $OS is not linked to the CaseSwitch.

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ScrollBarConstants.au3>
#include <array.au3>
#include <GuiStatusBar.au3>
#include <GuiEdit.au3>
#include <GuiButton.au3>
#include <Misc.au3>
#include <String.au3>
#Include <File.au3>
Opt("TrayIconHide", 1)
 
 
GUICreate("Computer Settings", 600, 250, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetBkColor(0xFFFFFF)

$Username2 = GUICtrlCreateLabel(@UserName, 10,15,180,35)
GUICtrlSetFont(-1, 20, 400, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x000000)
 
$Username1 = GUICtrlCreateLabel("Username:", 10,5,90,15)
GUICtrlSetFont(-1, 10, 400, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x000000)

$desk2 = GUICtrlCreateLabel(@DesktopWidth & "x" & @DesktopHeight, 10,65,180,35)
GUICtrlSetFont(-1, 20, 400, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x000000)
 
$desk1 = GUICtrlCreateLabel("Resolution:", 10,55,90,15)
GUICtrlSetFont(-1, 10, 400, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x000000)

$OSVerify = GUICtrlCreateLabel( "Windows " & $OS , 10, 115, 180, 35)
GUICtrlSetFont(-1, 20, 400, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x000000)
 
$os1 = GUICtrlCreateLabel("Windows Version:", 10,105,90,15)
GUICtrlSetFont(-1, 10, 400, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x000000)

$ButtonExit = GUICtrlCreateButton ("Close" 550, 170, 40, 20)
GUICtrlSetOnEvent($ButtonExit,"_Close")

GUISetState(@SW_SHOW)

While 1
    Sleep ( 20 )
WEnd
 
Func _Close ( )
Sleep ( 10 )
Exit
EndFunc

Switch @OSVersion
Case "WIN_2008R2"
  $OS = "Server 2008 R2"
Case "WIN_7"
  $OS = "Seven"
Case "WIN_2008"
  $OS = "Server 2008"
Case "WIN_VISTA"
  $OS = "Vista"
Case "WIN_2003"
  $OS = "Server 2003"
Case "WIN_XP"
  $OS = "XP"
Case "WIN_XPe"
  $OS = "XP Embedded"
Case Else
  $OS = "Unknown/Too Old!"
EndSwitch

Can anyone help?

Share this post


Link to post
Share on other sites
JFX

You use $OS before you assign it! Put your Switch .. EndSwitch section before GUI creation.

Also read remarks GUICtrlSetOnEvent , if you use it.

Share this post


Link to post
Share on other sites
water

Before you re-invent the wheel. There is already a available.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×