Jump to content

A problem with CaseSwitch


Recommended Posts

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?

Link to comment
Share on other sites

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...