Jump to content

Onautoitexit() And Inetget


Recommended Posts

Well, weird problem here :

I need to update a remote server file when I quit my server program, in case I forget to click on the disconnect button.

So I duplicate the function linked to this button into the OnAutoItExit() function :

Func OnAutoItExit()
  ;download the current server list
    $file_lobby = InetGet("http://myserver/lobby.txt", @ScriptDir & "\lobby.txt", 1, 0)
  ;update the server list locally
    IniWrite (@ScriptDir & "\lobby.txt", GuiCtrlRead($input_nickname), "Active","No")
  ;upload the updated server list
    $name_file = "\lobby.txt"
    $Open = _FTPOpen("MyFTP")
    $Conn = _FTPConnect($Open, "myFTP", "login", "password)
    If $Conn = 0 Then
    MsgBox(48, $txt_ftp_problem , $txt_ftp_diagnostic1)
    $Ftpc = _FTPClose($Open)
    Else
    $Ftpp = 0
    $Ftpp = _FtpPutFile($Conn, @ScriptDir & "\lobby.txt", "remote_path" )
    If  $Ftpp = 1 Then
    Else
        MsgBox(48,$txt_ftp_problem, $txt_ftp_diagnostic2)
    EndIf
    $Ftpc = _FTPClose($Open)
    EndIf
EndFunc

It seems the InetGet function is porked when called inside the OnAutoItExit function : it returns an empty file each and everytime... though the remote file is not empty at all...

Running 1.1.118 beta

Any idea?

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