Jump to content

Recommended Posts

Posted

Hi guys

i need:

   if windows 7 then

        MsgBox(0,"note ","  windows 7 ")

   if windows 8 then

        MsgBox(0,"note ","  windows 8 ")

and XP and Vista

Thx.

Posted

open help file in autoit script

read macros

 

THX

....................

If @OSVersion = "WIN_81" Then
MsgBox(0,"","WIN_8.1")

ElseIf @OSVersion = "WIN_8" Then
MsgBox(0,"","WIN_8")

ElseIf @OSVersion = "WIN_7" Then
MsgBox(0,"","WIN_7")

ElseIf @OSVersion = "WIN_VISTA" Then
MsgBox(0,"","Vista")

ElseIf @OSVersion = "WIN_XP" Then
MsgBox(0,"","XP")
EndIf
  • Moderators
Posted

Or use a switch statement:

Switch @OSVersion
 Case "WIN_8.1"
  ;do something for WIN 8.1
 Case "WIN_8"
  ;do something for WIN 8
 Case "WIN_7"
  ;do something for WIN 7
 Case "WIN_Vista"
  ;do something for Vista
 Case "WIN_XP"
  ;do something for XP
EndSwitch

 

The benefit to doing it this way is if you want to have one function that covers multiple circumstances. For example, if you want your script to do one thing if the OS is below Windows 8, you could do something like this:

Switch @OSVersion
 Case "WIN_8.1"
  ;do something for WIN 8.1
 Case "WIN_8"
  ;do something for WIN 8
 Case "WIN_7", "WIN_Vista", "WIN_XP"
  ;do something for OS prior to Windows 8
EndSwitch

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
  • Recently Browsing   0 members

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