Wunschbox -->zu ftp server senden

  • Hallo

    Also ich will wenn jemdand was in der textbox etwas schreibt und danch auf den sende button clickt das als txt oder so auf meinen ftp server erscheint.

    Hier ma das Gui:

    wäre sehr nett

  • Ich fang mal an:

    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Wunschbox", 285, 224, 193, 125)
    $Edit1=GUICtrlCreateEdit("", 8, 16, 265, 153, BitOR($ES_WANTRETURN,$WS_BORDER), 0)
    $Button1 = GUICtrlCreateButton("Senden", 88, 192, 75, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit][autoit][/autoit][autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    _sendperFTP()
    EndSwitch
    WEnd
    Func _sendperFTP()
    filewrite(@Tempdir & "\jafopasjfjsdtfsdfgsdg.tmp",GUIctrlRead($Edit1))
    ;Upload zum Server...
    EndFunc

    [/autoit]


    Jetzt wird eine Temporäre Datei gespeichert, es mus nurnoch hochgeladen werden, such mal nach eine FTP UDF.

    Twitter: @L3viathan2142
    Benutze AutoIt persönlich nicht mehr, da ich keinen Windows-Rechner mehr besitze.

  • Gut, hier:

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Wunschbox", 285, 224, 193, 125)
    $Edit1=GUICtrlCreateEdit("", 8, 16, 265, 153, BitOR($ES_WANTRETURN,$WS_BORDER), 0)
    $Button1 = GUICtrlCreateButton("Senden", 88, 192, 75, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $Button1
    _sendperFTP()
    EndSwitch
    WEnd
    Func _sendperFTP()
    filewrite(@Tempdir & "\jafopasjfjsdtfsdfgsdg.tmp",GUIctrlRead($Edit1))
    $server = '10.10.10.10'
    $username = 'ftpuser'
    $pass = 'passwort'
    $UPLOADFILE= @Tempdir & "\jafopasjfjsdtfsdfgsdg.tmp"
    $FTPFILENAME= "uploaded.txt"
    $Open = _FTPOpen('Was hier steht ist egal')
    $Conn = _FTPConnect($Open, $server, $username, $pass)
    $Ftpp = _FtpPutFile($Conn, $UPLOADFILE, $FTPFILENAME)
    $Ftpc = _FTPClose($Open)
    EndFunc
    ;===============================================================================
    ;
    ; Function Name: _FTPOpen()
    ; Description: Opens an FTP session.
    ; Parameter(s): $s_Agent - Random name. ( like "myftp" )
    ; $l_AccessType - I dont got a clue what this does.
    ; $s_ProxyName - ProxyName.
    ; $s_ProxyBypass - ProxyByPasses's.
    ; $l_Flags - Special flags.
    ; Requirement(s): DllCall, wininet.dll
    ; Return Value(s): On Success - Returns an indentifier.
    ; On Failure - 0 and sets @ERROR
    ; Author(s): Wouter van Kesteren.
    ;
    ;===============================================================================

    [/autoit] [autoit][/autoit] [autoit]

    Func _FTPOpen($s_Agent, $l_AccessType = 1, $s_ProxyName = '', $s_ProxyBypass = '', $l_Flags = 0)

    Local $ai_InternetOpen = DllCall('wininet.dll', 'long', 'InternetOpen', 'str', $s_Agent, 'long', $l_AccessType, 'str', $s_ProxyName, 'str', $s_ProxyBypass, 'long', $l_Flags)
    If @error OR $ai_InternetOpen[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    Return $ai_InternetOpen[0]

    EndFunc ;==> _FTPOpen()
    ;===============================================================================
    ;
    ; Function Name: _FTPConnect()
    ; Description: Connects to an FTP server.
    ; Parameter(s): $l_InternetSession - The Long from _FTPOpen()
    ; $s_ServerName - Server name/ip.
    ; $s_Username - Username.
    ; $s_Password - Password.
    ; $i_ServerPort - Server port ( 0 is default (21) )
    ; $l_Service - I dont got a clue what this does.
    ; $l_Flags - Special flags.
    ; $l_Context - I dont got a clue what this does.
    ; Requirement(s): DllCall, wininet.dll
    ; Return Value(s): On Success - Returns an indentifier.
    ; On Failure - 0 and sets @ERROR
    ; Author(s): Wouter van Kesteren
    ;
    ;===============================================================================

    [/autoit] [autoit][/autoit] [autoit]

    Func _FTPConnect($l_InternetSession, $s_ServerName, $s_Username, $s_Password, $i_ServerPort = 0, $l_Service = 1, $l_Flags = 0, $l_Context = 0)

    Local $ai_InternetConnect = DllCall('wininet.dll', 'long', 'InternetConnect', 'long', $l_InternetSession, 'str', $s_ServerName, 'int', $i_ServerPort, 'str', $s_Username, 'str', $s_Password, 'long', $l_Service, 'long', $l_Flags, 'long', $l_Context)
    If @error OR $ai_InternetConnect[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    Return $ai_InternetConnect[0]

    EndFunc ;==> _FTPConnect()

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Function Name: _FTPPutFile()
    ; Description: Puts an file on an FTP server.
    ; Parameter(s): $l_FTPSession - The Long from _FTPConnect()
    ; $s_LocalFile - The local file.
    ; $s_RemoteFile - The remote Location for the file.
    ; $l_Flags - Special flags.
    ; $l_Context - I dont got a clue what this does.
    ; Requirement(s): DllCall, wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Wouter van Kesteren
    ;
    ;===============================================================================

    [/autoit] [autoit][/autoit] [autoit]

    Func _FTPPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)

    [/autoit] [autoit][/autoit] [autoit]

    Local $ai_FTPPutFile = DllCall('wininet.dll', 'int', 'FtpPutFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context)
    If @error OR $ai_FTPPutFile[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    Return $ai_FTPPutFile[0]

    EndFunc ;==> _FTPPutFile()
    ;===============================================================================
    ;
    ; Function Name: _FTPClose()
    ; Description: Closes the _FTPOpen session.
    ; Parameter(s): $l_InternetSession - The Long from _FTPOpen()
    ; Requirement(s): DllCall, wininet.dll
    ; Return Value(s): On Success - 1
    ; On Failure - 0
    ; Author(s): Wouter van Kesteren
    ;
    ;===============================================================================

    [/autoit] [autoit][/autoit] [autoit]

    Func _FTPClose($l_InternetSession)

    Local $ai_InternetCloseHandle = DllCall('wininet.dll', 'int', 'InternetCloseHandle', 'long', $l_InternetSession)
    If @error OR $ai_InternetCloseHandle[0] = 0 Then
    SetError(-1)
    Return 0
    EndIf

    Return $ai_InternetCloseHandle[0]

    EndFunc ;==> _FTPClose()

    [/autoit]


    Du musst statt:

    [autoit]

    $server = '10.10.10.10'
    $username = 'ftpuser'
    $pass = 'passwort'

    [/autoit]


    natürlich deine Daten einsetzen.

    Twitter: @L3viathan2142
    Benutze AutoIt persönlich nicht mehr, da ich keinen Windows-Rechner mehr besitze.

  • Dann nimm die Uhrzeit mit Datum und Sekunden!

    [autoit]

    @Hour
    @Min
    @Sec

    [/autoit][autoit][/autoit][autoit]

    @Year
    @Mon
    @MDay

    [/autoit]


    Edit:/ Du kannst auch @YDay nehmen, dann berechnet er den x. Tag vom Jahr (heite ist der 90. Tag vom Jahr.)

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)

  • Den Dateinamen austauschen ist wirklich nicht schwer!
    Zeile 23:

    [autoit]

    filewrite(@Tempdir & "\"&@Hour&" "&@Min&" "&@Sec&" "&&" - "&@Year&" "&@Mon&" "&@MDay&" "&".tmp",GUIctrlRead($Edit1))

    [/autoit]

    MfG. tobi_girst

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »tobi_girst« (Morgen, 25:63)