Indigo Rose Software
Indigo Rose Software
Log in to the Customer Portal Customer Login
Software Development Discussion Forums Forums
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    1,259

    TestConnection screen for Setup Factory

    If you need to check for an active and working internet connection, you would normally use the function HTTP.Connection() in your Lua script. This function, however, has a slight problem: it will block your installer until it times out or receives an answer from the remote server, not giving your customer any visual feedback about the remaining time if no connection can be established. You cannot start a timer with Screen.StartTimer() and control a progress bar, because the connection test will block the application, and the timer will not fire.

    If you need to overcome this limitation, you can use this custom screen instead. It will use a very small application (only 22 kB in size!) that performs the connection test for you instead of HTTP.TestConnection(), allowing you to give visual feedback to the user about the process. After you install this custom screen, just add it to your project, and study the provided code in Lua, changing it to fit your needs. The range of the progress bar is set to 40, and the timer will fire twice each second. A full bar represents the maximum wait time of 20 seconds.

    This solution has some limitations that may be important to you:
    • The timeout period is fixed at 20 seconds (the default value for Winsock operations);
    • The program will connect to the remote server at port 80 (the default port for web servers);
    • There is no support for proxies. This can be added later, should there be requests for this.
    Here is how the screen does look like with the default theme while the connection is being tested (of course you can change everything - after all, it is a custom screen):


    The executable to test the connection (TestConnection.exe) will be deployed into the Includes sub folder of your Setup Factory installation. Don't forget to add this program as a primer file in your project.

    You find the installer here.

    Ulrich

  2. #2
    Join Date
    Jul 2009
    Posts
    43
    I want to test connection then if connected display web site. Checked successful.

    Code:
    res = File.Run(SessionVar.Expand("%TempLaunchFolder%\\TestConnection.exe"), "http://games.mannet.ru/stat/", "", SW_HIDE, true);
    	error = Application.GetLastError();
    	-- stop timer as soon as function returns
    	Screen.StopTimer();
    -- now check the result
    	if (error == 0) then
    	if (res == 0) then
    		-- TestConnection was able to connect to URL
    		bConnected = true;
    		DlgScrollingText.SetProperties(CTRL_SCROLLTEXT_BODY_01, {Text = "http://games.mannet.ru/stat/"});
    		
    	else
    		-- TestConnection timed out or failed
    		bConnected = false;
    		DlgScrollingText.SetProperties(CTRL_SCROLLTEXT_BODY_01, {Text = "Can't connect to server"});
    		-- jump to an error screen, if you need connectivity
    	end			
    	else
    	bConnected = false;
    	DlgScrollingText.SetProperties(CTRL_SCROLLTEXT_BODY_01, {Text = "Can't connect to server"});
    	-- error while running TestConnection.exe (have you included the primer file?)
    	-- jump to appropriate screen
    	end
    But it display http://games.mannet.ru/stat/ as text only. DlgScrollingText sets to HTML mode.

  3. #3
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,609
    it's doing exactly what you're telling it to do.
    you'll want to save the webpage to disk; then load it into a variable, THEN set the Text=cMyHTMLPage


    (Click here to contact me)
    Providing Independent Professional Consulting Services for IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)
    Do you wave? Find me at josh.assing @ googlewave.com

Posting Permissions

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