Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2004
    Posts
    26

    Need a second look is my syntax wrong, and how?

    proxy1 = Registry.GetValue(HKEY_CURRENT_USER, "\\Software\\Microsoft\\Windows\\CurrentVersion\\I nternet Settings", "ProxyEnable", true);
    proxy2 = Registry.GetValue(HKEY_CURRENT_USER, "\\Software\\Microsoft\\Windows\\CurrentVersion\\I nternet Settings", "ProxyServer", true);
    __________________________________________________ ________
    if (proxy1 = 1) then
    posproxyresponse1 = Dialog.Message("Scan in progress...", "It appears that you do have an active proxy", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    posproxyresponse3 = Dialog.Message("Proxy Settings",proxy2 , MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    else
    posproxyresponse2 = Dialog.Message("Scan in progress...", "It appears that you do not have an active proxy", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end



    so proxy1 return long int, how is requiring a ' near the equal statement

  2. #2
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Hi. Try this:

    Code:
    if proxy1 == 1 then
    instead of this:

    Code:
    if (proxy1 = 1) then
    Hope that helps.

  3. #3
    Join Date
    Nov 2004
    Posts
    26

    thanks

    thanks corey but I recoded it like this:

    initproxysequence = Dialog.Message("Scan in progress...", "Do you have a proxy? 0=false 1=true", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    proxy1 = 0;
    proxy2 = 0;
    proxy1 = Registry.GetValue(HKEY_CURRENT_USER, "\\Software\\Microsoft\\Windows\\CurrentVersion\\I nternet Settings", "ProxyEnable", true);
    proxy2 = Registry.GetValue(HKEY_CURRENT_USER, "\\Software\\Microsoft\\Windows\\CurrentVersion\\I nternet Settings", "ProxyServer", true);
    proxycompare = String.CompareNoCase(proxy1, "0");

    if (proxycompare ~= 0) then
    posproxyresponse1 = Dialog.Message("Scan in progress...", "It appears that you do have an active proxy", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    posproxyresponse3 = Dialog.Message("Proxy Settings",proxy2 , MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    else
    posproxyresponse2 = Dialog.Message("Scan in progress...", "No proxy detected!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end
    --------------------------------------------------------------------------------------------------------------------------------
    --Proxy sub-routine works in live environment - 6/4/05 4:59 am
    --------------------------------------------------------------------------------------------------------------------------------

    however

    the new routine it failing its the same thig but I tired the previous suggestions? what is ~= compare to ==

  4. #4
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Quote Originally Posted by slafta
    what is ~= compare to ==
    See: http://www.indigorose.com/webhelp/ams50/Scripting_Guide/Expressions_and_Operators.htm
    Intrigued

  5. #5
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    939
    Registry.GetValue() returns a STRING; not a numeric value. It is important to be aware of the returned type of value. Don't mix string variables with numeric variables.

    I'm not familiar with the Proxy values, but maybe you need omething like this:

    Code:
    proxy1 = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", "ProxyEnable", true);
    if proxy1 ~= "0" then
    	-- not equal "0"
    	bServerKeyExist = Registry.DoesKeyExist(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings");
    	if bServerKeyExist then
    		-- get the settings
    		proxy2 = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", "ProxyServer", true);
    		Dialog.Message("Proxy", "Enabled = "..proxy1..
    			"\r\nServer = "..proxy2,MB_OK, MB_ICONINFORMATION);
    	else
    		Dialog.Message("Proxy", "Enabled = "..proxy1..
    			"\r\nNo Proxy Server found", MB_OK, MB_ICONINFORMATION);
    	end
    else	
    	-- equal "0"
    	Dialog.Message("Proxy", "No proxy detected!", MB_OK, MB_ICONINFORMATION);
    end
    HTH

  6. #6
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Yes csd is right, if you look up any action in the User's Guide you will see a "Returns" section which describes what type of value any given function returns, i.e. string, table, boolean, etc...

Posting Permissions

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