Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2006
    Posts
    12

    attempting to compare a variable with the contents of an array

    I am attempting to compare the variable "ResultOS" with the contents of the array/table "PossiableOS.Valid".
    any ideas?

    ResultOS = System.GetOSName();
    PossiableOS = {};
    PossiableOS.Valid = {"Windows 98 SE", "Windows 2000", "Windows XP"};
    PossiableOS.Invalid = {"Windows 95", "Windows 98", "Windows ME", "Windows NT 3", "Windows NT 4", "Windows Server 2003"};

    if ResultOS == PossiableOS.Valid{} then

    do this

    else

    do this

    end

  2. #2
    Join Date
    Jul 2003
    Posts
    712
    Hello,

    Something like this may work for you:
    Code:
    Valid_OS = {"Windows 98 SE", "Windows 2000", "Windows XP"};
    sSystemOS = System.GetOSName();
    
    for nIndex, sOS in Valid_OS do
    	if (sSystemOS == sOS) then
    		bValidOS = true;
    		break;
    	end
    end
    
    if bValidOS then
    	-- The OS is valid
    	Dialog.Message("", "Valid OS");
    else
    	-- The OS is invalid
    	Dialog.Message("", "Invalid OS");
    end

  3. #3
    Join Date
    Jul 2006
    Posts
    12

    sorry in advance for the lengthy post...

    MGT wanted it to look for the reverse Desmond, thanks for your help. (GRUMBLE, GRUMBLE) I am still having a slight problem. Maybe it is just me. I do not understand how you went from the table PossiableOS.Invalid to boolean bPossiableOS.Invalid:

    for nIndex, sOS in PossiableOS.Invalid do
    if (sResultOS == sOS) then
    bPossiableOS.Invalid = true;
    break;
    end
    end

    if bPossiableOS.Invalid then


    --[This script is designed to first check the user's Operating System and display a dialog stating
    --what it is. If the Operating System is "Windows 95", "Windows 98", "Windows ME", "Windows NT 3",
    --"Windows NT 4", or "Windows Server 2003", then the Autorun will display a message stating that
    --the AccuShade software will not install and close the autorun application.]--
    --Get the system information

    sResultOS = System.GetOSName();
    ResultMEM = System.GetMemoryInfo(TotalRAM);
    ResultVER = System.GetOSVersionInfo(BuildNumber);
    PossiableOS = {"Windows 95", "Windows 98", "Windows ME", "Windows NT 3", "Windows NT 4", "Windows Server 2003", "Windows 98 SE", "Windows 2000", "Windows XP"};
    PossiableOS.Valid = {"Windows 98 SE", "Windows 2000", "Windows XP"};
    PossiableOS.Invalid = {"Windows 95", "Windows 98", "Windows ME", "Windows NT 3", "Windows NT 4", "Windows Server 2003"};

    -- initialize variable
    content=""

    message="Information about your system"
    strlen = String.Length(message);

    for count = 1, strlen do
    content = String.Left(message, count);
    Label.SetText("Label3", content);
    end

    --Set the label texts by concatenating some text
    --with the variables and then show them


    Label.SetText("OSLabel", "Your Operating System is - "..sResultOS);
    Label.SetText("RAMLabel", "Your Total RAM in Megabytes is - "..ResultMEM.TotalRAM);
    Label.SetVisible("OSLabel", true);
    Label.SetVisible("RAMLabel", true);


    PossiableOS.Invalid = {"Windows 95", "Windows 98", "Windows ME", "Windows NT 3", "Windows NT 4", "Windows Server 2003"};
    sResultOS = System.GetOSName();

    for nIndex, sOS in PossiableOS.Invalid do
    if (sResultOS == sOS) then
    bPossiableOS.Invalid = true;
    break;
    end
    end

    if bPossiableOS.Invalid then
    Label.SetText("Label5", "FAIL!")
    Label.SetVisible("Label5",] [COLOR="Blue"]true[/COLOR);
    Label.SetText("Label4", "PASS!")
    Label.SetVisible("Label4", false);
    Dialog.Message("WARNING!", "Your computer does not meet the minimum operating system specifications for the AccuShade Color Retrieval Software. There is no guarantee that the software will install sucessfully. Do you want to continue?",
    MB_YESNO, MB_ICONEXCLAMATION, MB_DEFBUTTON10);
    else
    Label.SetText("Label5", "FAIL!")
    Label.SetVisible("Label5", false);
    Label.SetText("Label4", "PASS!")
    Label.SetVisible("Label4", true);
    end[/QUOTE][/QUOTE]

  4. #4
    Join Date
    Jul 2003
    Posts
    712
    Hello,

    bValidOS was set in this block of my example, and only if the user's OS was on your allowed list:
    Code:
    for nIndex, sOS in Valid_OS do
    	if (sSystemOS == sOS) then
    		bValidOS = true;
    		break;
    	end
    end
    I'm simply setting a variable to true so I can check it later.

    Does that answer your question?

  5. #5
    Join Date
    Jul 2006
    Posts
    12
    yes, thanks

Similar Threads

  1. Creating a Table of Contents
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 10-03-2003, 11:35 AM
  2. How to clear the contents of a variable
    By RobbyH in forum AutoPlay Media Studio 4.0
    Replies: 4
    Last Post: 01-12-2003, 10:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts