Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 20:04

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Autoit FTP problem!

Discussion on Autoit FTP problem! within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
Trøjan's Avatar
 
elite*gold: 1
Join Date: Feb 2009
Posts: 834
Received Thanks: 803
Autoit FTP problem!

Hab jetzt schon in zwei Foren gefragt....

Warum läd er die Datei nicht hoch, nachdem er Meldungen +1 gerechnet hat???

Trøjan is offline  
Thanks
1 User
Old 01/05/2011, 14:12   #2



 
Asuramaru's Avatar
 
elite*gold: 20
The Black Market: 110/0/0
Join Date: Nov 2009
Posts: 2,255
Received Thanks: 1,570
hihi :P

mit _FTP_PUT kannst du nur Dateien im Selben Ordner hochladen
müsstest also die .txt in @ScriptDir kopieren und dann hochladen (danach evtl. wieder löschen)

InetGet brauchst du keine Ftp daten benutzen, geht auch so

Und unten mit dem Datum hats bei mir nicht geklappt^^ da kam immer ..2011 oder .1.2011 raus
(auch wenn nur Test später in der Reports.txt steht )

Code:
#include <Array.au3>
#Include <String.au3>
#include <IE.au3>
#include <file.au3>
#Include <FTPEx.au3>
;#Include <FTP.au3>
#RequireAdmin

Dim $aRecords
Global $Month
$Name = "Hans1"
$Submit = $Name&"|1|"&OnlineDate()
$FTP_open = _FTP_Open("MY FTP")
$FTP_Connect = _FTP_Connect($FTP_open,"ftp.autoitbotftp.au.funpic.de","autoitbotftp","123456789")
$Found = 0
InetGet("http://autoitbotftp.au.funpic.de/Reports.txt",@TempDir&"\Reports.txt")

$file = FileOpen(@TempDir&"\Reports.txt", 0)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf


If Not _FileReadToArray(@TempDir&"\Reports.txt",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $x = 1 to $aRecords[0]
    $Read = StringSplit($aRecords[$x],"|")
     If  $Read[1] = $Name Then
$Read[2] = $Read[2]+1
$Read[3] = OnlineDate()
$OldFileRead = FileRead($file)
$OldFileRead = StringReplace($OldFileRead,$aRecords[$x],$Name&"|"&$Read[2]&"|"&$Read[3])
$Found = 1
$file_flush = FileOpen(@TempDir&"\Reports.txt", 2)
$OldFileRead = "Test"
FileWrite($file_flush,$OldFileRead)
Filecopy(@Tempdir & "\Reports.txt",@ScriptDir & "\Reports.txt")
$Ftpp = _FTP_FilePut($FTP_Connect,"Reports.txt","Reports.txt")
FileDelete(@TempDir&"/Reports.txt")
FileDelete("Reports.txt")
MsgBox(0,"","Aufgerechenet!"& $Ftpp)
 EndIf
Next

If $Found = 0 Then
_FileReadToArray(@TempDir&"\Reports.txt",$aRecords)
Dim $NewFileWrite[$aRecords[0]+1]
$i = 0
For $x = 1 To $aRecords[0]
    $NewFileWrite[$i] = $aRecords[$x]
    $i = $i + 1
Next
$x = UBound($NewFileWrite)


$NewFileWrite[$i] = $Submit
_ArrayDisplay($NewFileWrite)
_FileWriteFromArray(@TempDir&"\Reports.txt",$NewFileWrite)
FileCopy(@TempDir & "\Reports.txt",@ScriptDir & "\Reports.txt")
_FTP_FilePut($FTP_Connect,"Reports.txt","Reports.txt")
   EndIf

FileClose($file)
FileDelete("Reports.txt")
FileDelete(@TempDir &"\Reports.txt")
_FTP_Close($FTP_open)
_FTPClose($Open)









Func OnlineDate()
$sRead = BinaryToString(InetRead("http://www.uhrzeit.org/atomuhr.html",1))

$sRegRead =  _StringBetween($sRead,'<div id="anzeige_datum">','</div>')
$sSplitRead = StringSplit ( $sRegRead[0], " ")
Local $Monat[13] = ["Platzhalter","Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","Nobember","Dezember"]
for $i = 0 to 12
If $sSplitRead[4] = $Monat[$i] Then
    $Month = $i
Endif
next

$DayArray = StringSplit($sSplitRead[3],".")
$Day = $DayArray[1]

$Year = $sSplitRead[5]

$Date = $Day&"."&$Month&"."&$Year
Return $Date
EndFunc
Asuramaru is offline  
Reply




All times are GMT +1. The time now is 20:04.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.