Jump to content

fixed: checking for internet aviablity


Recommended Posts

hey guys, i´m currently working on an update function.

my idea is simple:

check for internet aviablity via _GetIP() and then check if the version.ini in the script dir is the same as the one on my ftp. If not download the new .exe

Now my problem is:

$IP = "-1"
$IP2 = "0"
while $IP2 = "0"
$IP2 = _GetIP()
If $IP2 = $IP Then
    GUICtrlSetData($Edit1,"No internet available" & @CRLF,1)
Else
    GUICtrlSetData($Edit1,"Internet available" & @CRLF,1)
EndIf
GUICtrlSetData($Edit1,$time &  "Checking if program is up to date...",1)
WEnd

this would make the gui freezing until the ip changes.. if the ip changes the internet is avi.

$IP = "-1"
$IP2 = _GetIP()
sleep(3000)
If $IP2 = $IP Then
    GUICtrlSetData($Edit1,"No internet available" & @CRLF,1)
Else
    GUICtrlSetData($Edit1,"Internet available" & @CRLF,1)
EndIf
GUICtrlSetData($Edit1,$time &  "Checking if program is up to date...",1)

The 3seconds sleep is mostly enough to check if the ip has changed. Still my gui is freezing for these 3 seconds.

Is there anyway to make the gui useable while it is checking for the inet aviablity?

thanks

@edit: oh i dont even need sleep.. the getip function seems to stop the script until it checked for the ip. which only takes some milliseconds :mellow:

Edited by aphesia
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...