Code : Tout sélectionner
#include <GUIConstants.au3>
#include <File.au3>
Opt("GUIOnEventMode", 1);
Opt("TrayIconHide", 1)
guicreate(" ")
GUISetState () ;
guictrlcreatelabel("indiquer le chemin du serveur",10,103)
guictrlcreatelabel("Nom de la station ",35,18)
guictrlcreatelabel("profil utilisateur ",35,140)
guictrlcreatelabel("notes ",35,160)
$pc_name = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName", "ComputerName")
GUICtrlCreateInput($pc_name,170, 15, 140, 20)
$tsap=RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\DGI\COMMUN\TSAP", "TSAP_MMA")
$chemin =""
$cmdParcourir = GUICtrlCreateButton("Parcourir...",313,95,80)
GuiCtrlSetOnEvent($cmdParcourir,"parcourir")
$serverpath=GUICtrlCreateInput($chemin,170,97,140,20)
$QUITTER = GUICtrlCreateButton("Sortir",98,350,120,20)
guictrlsetonevent($QUITTER,"quitter");
$COPIER = GUICtrlCreateButton("copier",230,350,120,20)
GUICtrlSetOnEvent($COPIER,"copier")
$search = FileFindFirstFile("ADSL")
$search2=FileFindFirstFile("temp")
$search3=FileFindFirstFile("notes")
; Check if the search was successful
If $search = -1 Then
MsgBox(0, "Error", "No files/directories matched the search pattern")
Exit
EndIf
While 1
$file = FileFindNextFile($search) ;
If @error Then ExitLoop
$result=MsgBox(4096, "File:", $file);
$S =String($file);
$TestPath = _PathFull($file);
$file = FileFindNextFile($search2);
If @error Then ExitLoop
$result=MsgBox(4096, "File:", $file);
$S =String($file);
$TestPath2 = _PathFull($file);
$file = FileFindNextFile($search3);
If @error Then ExitLoop
$result=MsgBox(4096, "File:", $file);
$S =String($file);
$TestPath3 = _PathFull($file)
WEnd
; Close the search handle
FileClose($search)
GUICtrlCreateInput($testpath,170, 140, 140, 20)
GUICtrlCreateInput($testpath2,170, 160, 140, 20)
GUICtrlCreateInput($testpath3,170, 180, 140, 20)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;FONCTION PARCOURIR............................................................
Func parcourir()
$chemin = FileSelectFolder("Sélectionnez le dossier de sauvegarde", "","","")
guictrlread($chemin)
GUICtrlSetData($serverpath,$chemin)
;~ While StringLeft($chemin,2) <> "\\" And $chemin <> ""
;~ MsgBox(64,"Erreur de chemin","Le chemin sélectionné doit correspondre à un dossier réseau")
;~ $chemin = FileSelectFolder("Sélectionnez un dossier réseau partagé", "::{208D2C60-3AEA-1069-A2D7-08002B30309D}","",$chemin)
;~ Wend
;~ $serverpath=GUICtrlCreateInput($allez,225,97,107,20)
EndFunc
func quitter()
Exit
endfunc
func copier()
dircreate($chemin &$pc_name)
if FileExists ("C:\windows\favoris") Then
_FileCopy("C:\windows\favoris",$chemin &$pc_name)
endif
if FileExists ("C:\windows\profiles") Then
_FileCopy("C:\windows\profiles",$chemin &$pc_name)
EndIf
if FileExists ("C:\cfir\sauvegarde") Then
_FileCopy("C:\cfir\sauvegarde",$chemin &$pc_name)
endif
if FileExists ("C:\mes documents") Then
_FileCopy("C:\mes documents",$chemin &$pc_name)
endif
if FileExists ("d:\notes") Then
_FileCopy("d:\notes",$chemin &$pc_name)
endif
if FileExists ("d:\bureau") Then
_FileCopy("d:\bureau",$chemin &$pc_name)
endif
ENDFUNC
Func _FileCopy($fromFile,$tofile)
Local $FOF_RESPOND_YES = 16
Local $FOF_SIMPLEPROGRESS = 256
$winShell = ObjCreate("shell.application")
$winShell.namespace($tofile).CopyHere($fromFile,$FOF_RESPOND_YES)
EndFunc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BOUCLE...............................................................
while 1
$msg = GUIGetMsg()
select
case $msg = $GUI_EVENT_CLOSE
case $msg=$QUITTER
ExitLoop
;~ CASE $msg = $INSTALLER
endselect
Wend