Code : Tout sélectionner
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.12.1
Author: SurPriseS
Script Function:
Sauvegarde automatique via commande SCP
#ce ----------------------------------------------------------------------------
#include <Process.au3>
#include <GUIConstants.au3>
#include <Date.au3>
; GUI
GuiCreate ( " Backup facture " , 270 , 230 ) ; fenêtre principale
GUISetState ( @SW_SHOW )
GUICtrlCreateGroup ( " Synchro " , 10 , 10 , 250 , 100 ) ; groupe synchronisation
$Button_synchro = GUICtrlCreateButton ( " Synchronisation " , 20 , 30 , 100 ) ; bouton synchronisation
GUICtrlCreateLabel( "Synchronisation : ",130,35)
GUICtrlCreateGroup ( " Clé USB " , 10 , 120 , 250 , 100 )
$label_synchro = GUICtrlCreateLabel("NOK",220,35)
GuiCtrlSetColor ( $label_synchro , 0xFF0000 ) ;rouge
list_lecteur()
last_file()
While 1
$msg = GUIGetMsg ( )
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
;synchronisation
Case $msg = $Button_synchro
synchro()
EndSelect
WEnd
; - - - - - - - - - - - - - - - - - - - - - Fonctions
; - - - - - - - - - - Synchronisation
Func synchro()
_RunDOS("winscp /console /script=maj.txt login:passwd@ip")
$label_synchro = GUICtrlCreateLabel("OK",220,35)
GuiCtrlSetColor ( $label_synchro , 0x1eff00 ) ;vert
$label_fichier1 = GUICtrlCreateLabel("Fichier 1 : " & "var",20,60)
$label_fichier2 = GUICtrlCreateLabel("Fichier 2 : " & "var",20,80)
EndFunc
; - - - - - - - - - - Liste des lecteurs
Func list_lecteur()
$test =""
$var = DriveGetDrive( "REMOVABLE" );"ALL", "CDROM", "REMOVABLE", "FIXED", "NETWORK", "RAMDISK", or "UNKNOWN"
If NOT @error Then
;MsgBox(4096,"", "Found " & $var[0] & " drives")
For $i = 1 to $var[0]
;MsgBox(4096,"Drive " & $i, $var[$i])
$combo_1 = GUICtrlCreateCombo("Clé USB", 20, 140,100)
$combo_1 = GUICtrlSetData(-1, $var[$i], "Clé USB")
Next
Else
$label_cle = GUICtrlCreateLabel("PAS DE CLE USB DETECTEE",20,140)
EndIf
EndFunc
; - - - - - - - - - - Backup
Func backup()
EndFunc
; - - - - - - - - - - Dernier fichier
Func last_file()
FileChangeDir("c:\saveqle")
$test12 = FileGetTime("script.mars31(UTC+0200).tar.bz2",0,1)
MsgBox(1,"test",$test12)
EndFunc