Jump to content

edit a file on FTP server


arcker
 Share

Recommended Posts

Hi evryone,

I continue my project, and i wonder if there is a way to edit a file on a ftp server

i post my code here :

#include <GUIConstants.au3>
#include <File.au3>



$int=GUICreate("Simplechat by ArCkEr",500,500,-1,-1,-1)
GUISetState  (@SW_SHOW)

global $rap="ftp:\\[ftpserver]\rapport.txt"
$edit=GUICtrlCreateEdit("",10,290,480,120)
$exec=guictrlcreatebutton("ajouter",10,450,60,30)
$raf=guictrlcreatebutton("rafraichir",100,450,60,30)
$date=guictrlcreatebutton("ajouter la date",190,450,75,30)
$heure=guictrlcreatebutton("ajouter l'heure",280,450,75,30)
$barre=guictrlcreatebutton("ajouter une barre _____",380,450,120,30)
global $rapport=fileopen("ftp:\\[ftpserver]\rapport.txt",1)
$nbligne=_filecountlines($rap)
$ligne1=GUICtrlCreateEdit(FileRead($rap),10,10,480,250)
;$ligne2=GUICtrlCreateLabel(FileReadLine($rap,$nbligne-4),10,40,480,30)
;$ligne3=GUICtrlCreateLabel(FileReadLine($rap,$nbligne-3),10,70,480,30)
;$ligne4=GUICtrlCreateLabel(FileReadLine($rap,$nbligne-2),10,100,480,30)
;$ligne5=GUICtrlCreateLabel(FileReadLine($rap,$nbligne-1),10,130,480,30)


While 1 
        GUISetState()
        $MSG = GUIGetMsg()
            select;code du programme
      ;variable globale
            case $msg = $GUI_EVENT_CLOSE
            ExitLoop
          
    
      Case $MSG = $exec 
          
         _ajout()
         
         _affich()      
         
     case $msg = $raf
         
          _affich()
          
      case $msg = $date
          _date()
          _affich()
      case $msg = $heure
          _heure()
          _affich()
      case $msg = $barre
          _barre()
          _affich()
          EndSelect
      
      WEnd   

func _ajout()
    filewrite($rapport,GUICtrlRead($edit)& @CRLF)
    
EndFunc 

func _affich()
    FileClose($rapport)
;fileopen($rap,0)
    $nbligne=_filecountlines($rap)
    GUICtrlSetData($ligne1,FileReadLine($rap,$nbligne-4))
;GUICtrlSetData($ligne2,FileReadLine($rap,$nbligne-3))
;GUICtrlSetData($ligne3,FileReadLine($rap,$nbligne-2))
;GUICtrlSetData($ligne4,FileReadLine($rap,$nbligne-1))
;GUICtrlSetData($ligne5,FileReadLine($rap,$nbligne))
    fileopen($rap,1)
endfunc

func _Date()
    filewrite($rapport,"Le " & @MDAY & "/" & @MON & @crlf)
    
EndFunc

func _heure()
    filewrite($rapport,@HOUR & "H" & @MIN & @crlf)
EndFunc

func _barre()
    filewrite($rapport,"________________________________" & @CRLF)
EndFunc

Do i have to use some ftp commands ? This file would be use by several users...

i think it's possible, but harder than i think

thx

PS : Autoit is awesome for LDAP ! i will post my scripts later

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]
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...