Jump to content

olivertwistcoder

Members
  • Posts

    17
  • Joined

  • Last visited

About olivertwistcoder

  • Birthday 02/18/1971

Profile Information

  • Location
    France

olivertwistcoder's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. As always, i wrote this program because i was bored to authenticate to each server each i need to reach it to work. So, when i open my session on windows, it launch this program (task scheduler) to authenticate on a list of servers (with a same password) in UNC mode. A ini file is build at the first time, the password is crypted in file, and a file contain the list of servers. I've already posted something like this but now it's all in English. To verify it works well, don't sign in your servers, then launch this prog, and then just navigate on servers directly. #include <file.au3> #NoTrayIcon If FileExists("cfgconst.ini") Then ;on fait rien Else MsgBox(64,"Reference File Creation", "Beware !" & @CRLF & @CRLF & "You're going to create the configuration file" & @CRLF & @CRLF & "In case of problem, you can modify cfgconst.ini after the creation") $usercfg=InputBox("UserName/admin","Please enter a username authorized on servers : ","Administrator") IniWrite("cfgconst.ini","User","Key",$usercfg) $nbservers=InputBox("Servers number","Please indicate the servers number : " & @CRLF & @CRLF & "(Beware ! same user, same password)","") IniWrite("cfgconst.ini","NbServers","Key",$nbservers) $sharecfg=InputBox("Share Name","Please enter the default share name : ","c$") IniWrite("cfgconst.ini","Share","Key",$sharecfg) EndIf $user = IniRead("cfgconst.ini", "User", "key", "NotFound") $nb = IniRead("cfgconst.ini", "NbServers", "key", "NotFound") If FileExists("serverslist.ini") Then ;on fait rien Else MsgBox(64,"Creation of servers list", "Your'e going to create the servers list to access to" & @CRLF & @CRLF & "In case of problem, you can modify serverlist.ini after the creation") MsgBox(48,"Beware", " - The server name must be resolved in DNS" & @CRLF & @CRLF & " - You can put an IP address" & @CRLF & @CRLF & " - Do not put any \ or \\ before or after the name or IP address " & @CRLF & @CRLF & " example : server911 " & @CRLF) For $d=1 to $nb $servername=InputBox("Server Name","Please enter the server name " & $d & " on " & $nb,"") IniWrite("serverslist.ini","Server" & $d,"Key", "\\" & $servername & "\" & @CRLF) Next EndIf $share = IniRead("cfgconst.ini", "Share", "key", "NotFound") $user = IniRead("cfgconst.ini", "User", "key", "NotFound") $nb = IniRead("cfgconst.ini", "NbServers", "key", "NotFound") $replog = IniRead("cfgconst.ini", "Replogs", "key", "NotFound") If FileExists("cryptage.ini") Then $PASSKEY = "PASSWORD" $M_PASSWORD =IniRead("cryptage.ini","program","password","") $M_PASSWORD = Crypt($PASSKEY,Hex2Str($M_PASSWORD)) Else MsgBox(48,"Password Warning", "Beware !" & @CRLF & @CRLF & "You're going to pu the password of user : " & $user) $PASSKEY = "PASSWORD" $PASSWORD=InputBox("Password of " & $user,"Enter the password to register : " & @CRLF & @CRLF & "(You must confirm it once more but not by the future)","","*") $TEMP = Str2Hex(Crypt($PASSKEY,$PASSWORD)) IniWrite("cryptage.ini","program","password",$TEMP) $PASSWORD=InputBox("Password","Enter password to verify : ","","*") $M_PASSWORD =IniRead("cryptage.ini","program","password","") $M_PASSWORD = Crypt($PASSKEY,Hex2Str($M_PASSWORD)) If $M_PASSWORD == $PASSWORD Then MsgBox(0,'Ok', "Passwords are the same.") Else MsgBox(16,'Houlala !!!', "Password are different !!!") FileDelete("cryptage.ini") Exit EndIf EndIf Func Crypt($PASS, $STRG) $A = 1 $N_STRG = "" For $I = 1 To StringLen($STRG) $B = Asc(StringMid($PASS, $A, 1)) $A = $A + 1 If $A > StringLen($PASS) Then $A = 1 $N_STRG = $N_STRG & Chr(BitXOR(Asc(StringMid($STRG, $I, 1)),$B)) Next Return $N_STRG EndFunc Func Str2Hex($STRG) $H = "" For $I = 1 To StringLen($STRG) $H = $H & String(Hex(Asc(StringMid($STRG, $I, 1)),2)) Next Return $H EndFunc Func Hex2Str($H) $STRG = "" For $I = 1 To StringLen($H) Step 2 $STRG = $STRG & Chr(Dec(StringMid($H, $I, 2))) Next Return $STRG EndFunc main() Func main() Local $cmd Local $result Local $msg For $i=1 to $nb Local $serv $serv = IniRead("serverslist.ini", "Server" & $i, "key", "NotFound") Run('net use ' & $serv & $share & ' /USER:' & $user & " " & $M_PASSWORD, @tempDir, @SW_HIDE) $result = RunWait(@ComSpec & " /c " & $cmd, "") If $result <> 0 Then ConsoleWriteError("Error : RunWait() returned an error code : " & $result & @CRLF) EndIf ConsoleWrite($cmd & @CRLF) Next EndFunc
  2. I worked a little around this code and made this finally : #Include <date.au3> #include <file.au3> $log = FileOpen("softwarelist.txt", 2) FileWrite($log, "================================================" & @CRLF) FileWrite($log, "Software List " & @YEAR & "/" & @MON & "/" & @MDAY & " - at " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF) FileWrite($log, "================================================" & @CRLF & @CRLF) FileWrite($log, "------------------------------------------------------------------------------") Dim $Product Dim $string = "" Dim $table = WMI("127.0.0.1","SELECT * FROM Win32_Product") For $Product in $table $string = $string & @CRLF & "Description. " & $Product.Description & @CRLF & "Ver. " & $Product.Version & @CRLF & "Vendor. " & $Product.Vendor & @CRLF & "------------------------------------------------------------------------------" Next FileWrite($log, $string) FileWrite($log, @CRLF & @CRLF & "================================================" & @CRLF & "End of all treatments." & @CRLF & "================================================") FileClose($log) Func WMI($strComputer,$Query) Dim $objLocator = ObjCreate("WbemScripting.SWbemLocator") dim $objService = $objLocator.ConnectServer($strComputer, "root\cimv2") Dim $table = $objService.ExecQuery($Query) return $table EndFunc The includes were to add some requests to ini files in a first time. As date include. Anyway, the primary code was great. I just added some work around.
  3. And INI example : [Font] Key=Courrier [Program_Folder] Key=C:\admintools\exifsorter [Default_Folder] Key=C:\perso\images [Folder_Exif] Key=Exif [Folder_NoExif] Key=NoExif [Folder_ToSort] Key=ToSort [Duplicated_Deep] Key=20 [CopyRighted_Folder] Key=CopyRighted [Picture_Size] Key=250000 [Size_Folder] Key=LittleSizes [Shoots_Folder] Key=Shoots [Folder_SortYearMonth] Key=SortYearMonth [ExifSorter_Log] Key=ExifSorter_Log.txt [DuplicatedSorter_Log] Key=DuplicatedSorter_Log.txt [SizeSorter_Log] Key=SizeSorter_Log.txt [CopyRightSorter_Log] Key=CopyRightSorter_Log.txt [Prog_1] Key=ExifSorter.exe [Prog_2] Key=DupliCatKiller.exe [Prog_3] Key=CopyRightSorter.exe [Prog_4] Key=SizeSorter.exe [Prog_5] Key=SortYearMonth.exe [TextButton_Prog_1] Key=1. Exif / No Exif Sorter [TextButton_Prog_2] Key=2. Duplicated Management [TextButton_Prog_3] Key=3. CopyRight Sorter [TextButton_Prog_4] Key=4. Size Sorter [TextButton_Prog_5] Key=5. Sort in "YearMonth" [TextButton_Verify] Key=Verify Temporary Folders [Extension_Nb] Key=4 [Extension_1] Key=jpg [Extension_2] Key=gif [Extension_3] Key=png [Extension_4] Key=jpeg
  4. I should add the rest of the code. For external programs in .EXE, they are made from the master one, extracted from the functions, and convert in .exe. Ini maker : (you must convert it in .exe to launch it from the ExifManager panel) #Include <date.au3> #include <file.au3> #Include <GUIconstants.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ProgressConstants.au3> #include "image_get_info.au3" #include <ScreenCapture.au3> ;AutoItSetOptionOpt("GUICloseOnESC", 1) If FileExists("ExifManager.ini") Then MsgBox(64,"Already Exists", "An ExifManager.ini already exists." & @CRLF & @CRLF & "To create a new one, you must the old one before.") Else Call("Creation_ini") EndIf Func Creation_ini() MsgBox(64,"Reference File Creation", "Attention !" & @CRLF & @CRLF & "You are creating the parameters of this program" & @CRLF & @CRLF & "You will have to do it just one time..." & @CRLF & @CRLF & "In case of problem, you can change the file 'ExifManager.ini'") $Font = InputBox("Font","Enter the Font : ", "Courrier") IniWrite("ExifManager.ini", "Font", "Key", $Font & @CRLF) $Program_Folder = InputBox("Program_Folder","Enter the Program Folder : ", "C:\admintools\ExifSorter") IniWrite("ExifManager.ini", "Program_Folder", "Key", $Program_Folder & @CRLF) $Default_Folder = InputBox("Default_Folder","Enter the Medias Folder : ", "C:\rep_oltr\perso\images\flickr") IniWrite("ExifManager.ini", "Default_Folder", "Key", $Default_Folder & @CRLF) $Folder_Exif = InputBox("Folder_Exif","Enter the Exif temporary Folder : " & @CRLF & @CRLF & "(Used by this program for treatments)", "Exif") IniWrite("ExifManager.ini", "Folder_Exif", "Key", $Folder_Exif & @CRLF) $Folder_NoExif = InputBox("Folder_NoExif","Enter the NoExif temporary Folder : " & @CRLF & @CRLF & "(Used by this program for treatments)", "NoExif") IniWrite("ExifManager.ini", "Folder_NoExif", "Key", $Folder_NoExif & @CRLF) $Folder_ToSort = InputBox("Folder_ToSort","Enter the Folder where the medias will have to be stocked : ", "ToSort") IniWrite("ExifManager.ini", "Folder_ToSort", "Key", $Folder_ToSort & @CRLF) $Duplicated_Deep = InputBox("Duplicated_Deep","Enter the number of 'try to name' the file : " & @CRLF & @CRLF & "The program will try 'x' incrementaions" & @CRLF & "(example : 20 incrementations by default)", "20") IniWrite("ExifManager.ini", "Duplicated_Deep", "Key", $Duplicated_Deep & @CRLF) $CopyRighted_Folder = InputBox("CopyRighted_Folder","Enter the Folder where to stock the Copyrighted medias : ", "CopyRighted") IniWrite("ExifManager.ini", "CopyRighted_Folder", "Key", $CopyRighted_Folder & @CRLF) $Picture_Size = InputBox("Picture_Size","Enter the resolution to sort medias : " & @CRLF & @CRLF & "by default 500x500 is used" & @CRLF & "(equals to 250.000)", "250000") IniWrite("ExifManager.ini", "Picture_Size", "Key", $Picture_Size & @CRLF) $Size_Folder = InputBox("Size_Folder","Enter the Folder where to stock the little sized medias : " & @CRLF & @CRLF & "by default LittleSizes is used", "LittleSizes") IniWrite("ExifManager.ini", "Size_Folder", "Key", $Size_Folder & @CRLF) $Shoots_Folder = InputBox("Shoots_Folder","Enter the Folder where to stock the screens shots : " & @CRLF & @CRLF & "by default Shoots is used", "Shoots") IniWrite("ExifManager.ini", "Shoots_Folder", "Key", $Shoots_Folder & @CRLF) $Shoots_Folder = InputBox("Folder_SortYearMonth","Enter the Folder where to move the medias sorted by Year & Month : " & @CRLF & @CRLF & "by default SortYearMonth is used", "SortYearMonth") IniWrite("ExifManager.ini", "Folder_SortYearMonth", "Key", $Shoots_Folder & @CRLF) $ExifSorter_Log = InputBox("ExifSorter_Log","Enter the Log name for ExifSorter.exe : ", "ExifSorter_Log.txt") IniWrite("ExifManager.ini", "ExifSorter_Log", "Key", $ExifSorter_Log) $DuplicatedSorter_Log = InputBox("DuplicatedSorter_Log","Enter the Log name for DuplicatKiller.exe : ", "DuplicatedSorter_Log.txt") IniWrite("ExifManager.ini", "DuplicatedSorter_Log", "Key", $DuplicatedSorter_Log) $SizeSorter_Log = InputBox("SizeSorter_Log","Enter the Log name for SizeSorter.exe : ", "SizeSorter_Log.txt") IniWrite("ExifManager.ini", "SizeSorter_Log", "Key", $SizeSorter_Log) $CopyRightSorter_Log = InputBox("CopyRightSorter_Log","Enter the Log name for CopyRightSorter.exe : ", "CopyRightSorter_Log.txt") IniWrite("ExifManager.ini", "CopyRightSorter_Log", "Key", $CopyRightSorter_Log) IniWrite("ExifManager.ini", "Prog_1", "Key", "ExifSorter.exe") IniWrite("ExifManager.ini", "Prog_2", "Key", "DupliCatKiller.exe") IniWrite("ExifManager.ini", "Prog_3", "Key", "CopyRightSorter.exe") IniWrite("ExifManager.ini", "Prog_4", "Key", "SizeSorter.exe") IniWrite("ExifManager.ini", "Prog_5", "Key", "SortYearMonth.exe") $TextButton_Prog_1 = InputBox("TextButton_Prog_1","Enter a button name for 'ExifSorter' : ", "1. Exif / No Exif Sorter") IniWrite("ExifManager.ini", "TextButton_Prog_1", "Key", $TextButton_Prog_1 & @CRLF) $TextButton_Prog_2 = InputBox("TextButton_Prog_2","Enter a button name for 'DupliCatKiller' : ", "2. Duplicated Management") IniWrite("ExifManager.ini", "TextButton_Prog_2", "Key", $TextButton_Prog_2 & @CRLF) $TextButton_Prog_3 = InputBox("TextButton_Prog_3","Enter a button name for 'CopyRightSorter' : ", "3. CopyRight Sorter") IniWrite("ExifManager.ini", "TextButton_Prog_3", "Key", $TextButton_Prog_3 & @CRLF) $TextButton_Prog_4 = InputBox("TextButton_Prog_4","Enter a button name for 'SizeSorter' : ", "4. Resolution Sorter") IniWrite("ExifManager.ini", "TextButton_Prog_4", "Key", $TextButton_Prog_4 & @CRLF) $TextButton_Prog_5 = InputBox("TextButton_Prog_5","Enter a button name for 'SortYearMonth' : ", "5. Sort in 'YearMonth'") IniWrite("ExifManager.ini", "TextButton_Prog_5", "Key", $TextButton_Prog_5 & @CRLF) $TextButton_Verify = InputBox("TextButton_Verify","Enter a button name for Temporary Folders checking : ", "Verify Temporary Folders") IniWrite("ExifManager.ini", "TextButton_Verify", "Key", $TextButton_Verify & @CRLF) $Extension_Nb = InputBox("ExtensionNb","Enter the number of extension to sort : ", "5") IniWrite("ExifManager.ini", "Extension_Nb", "Key", $Extension_Nb & @CRLF) For $First_Extension = 1 to $Extension_Nb $Extension_Name = InputBox("Extension_Name", "Enter the extension " & $First_Extension & " sur " & $Extension_Nb, "") IniWrite("ExifManager.ini", "Extension_" & $First_Extension, "Key", $Extension_Name) Next EndFunc
  5. That's okay with the UDF version
  6. Hello People, I made a program based on 6 different programs. 5 use Exif to manage all sort of medias, like jpg, gif, mov, etc. The 6st is used to shot the screen and make a picture fil in JPG format. For one of my pics manager, there is a problem : i can't get the width and height of a picture. So simple, no ? I spent lot of times around those programs, and now, i'm blocked with this little fu... thing I would have preferred to post an entire and beautiful prog but, anyway, i can't go through and i'm angry about it. The Function called is "SizeSorter", based on an include of "image_get_info.au3" (thanks for all this work that helped me so much). If i change the "_IntR" call in this marvellous image_get_info, i get the good width of the pic. _IntR convert the pixel width in integer data, and i just want to use the data in pixel. My function work on pixel data to calculate a if the multiplication of width and height are less than a level (example : 500 x 500 = 250.000). In this case, all pics result calculation under this value are moved to a folder like size folder. Do someone have any idea to help me ? Don't pay attention to ";" testing sections... See the code below (and you can get it to ameliorate and use for yourself) #Include <date.au3> #include <file.au3> #Include <GUIconstants.au3> #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ProgressConstants.au3> #include "image_get_info.au3" #include <ScreenCapture.au3> If FileExists("ExifManager.ini") Then ;do nothing Else Call("ExifManagerIniCreator.exe") EndIf ;Variables Declaration $Font = IniRead("ExifManager.ini", "Font", "key", "NotFound") $Program_Folder = IniRead("ExifManager.ini", "Program_Folder", "key", "NotFound") $Default_Folder = IniRead("ExifManager.ini", "Default_Folder", "key", "NotFound") $Folder_Exif = IniRead("ExifManager.ini", "Folder_Exif", "key", "NotFound") $Folder_NoExif = IniRead("ExifManager.ini", "Folder_NoExif", "key", "NotFound") $Folder_ToSort = IniRead("ExifManager.ini", "Folder_ToSort", "key", "NotFound") $Shoots_Folder = IniRead("ExifManager.ini", "Shoots_Folder", "key", "NotFound") $Extension_Nb = IniRead("ExifManager.ini", "Extension_Nb", "key", "NotFound") $Prog_1 = IniRead("ExifManager.ini", "Prog_1", "key", "NotFound") $Prog_2 = IniRead("ExifManager.ini", "Prog_2", "key", "NotFound") $Prog_3 = IniRead("ExifManager.ini", "Prog_3", "key", "NotFound") $Prog_4 = IniRead("ExifManager.ini", "Prog_4", "key", "NotFound") $Prog_5 = IniRead("ExifManager.ini", "Prog_5", "key", "NotFound") $TextButton_Prog_1 = IniRead("ExifManager.ini", "TextButton_Prog_1", "key", "NotFound") $TextButton_Prog_2 = IniRead("ExifManager.ini", "TextButton_Prog_2", "key", "NotFound") $TextButton_Prog_3 = IniRead("ExifManager.ini", "TextButton_Prog_3", "key", "NotFound") $TextButton_Prog_4 = IniRead("ExifManager.ini", "TextButton_Prog_4", "key", "NotFound") $TextButton_Prog_5 = IniRead("ExifManager.ini", "TextButton_Prog_5", "key", "NotFound") $TextButton_Verify = IniRead("ExifManager.ini", "TextButton_Verify", "key", "NotFound") ;GUI Creation of the work window GUICreate("ExifManager - " & @MDAY & "/" & @MON & "/" & @YEAR & " at " & @HOUR & ":" & @MIN , 300, 510) GUISetState (@SW_SHOW) GUICtrlCreateGroup ("Direct launch", 10, 10, 280, 280) GUICtrlSetFont(-1, 12, 600, $Font) GUICtrlSetColor(-1,0x008000) GUICtrlCreateLabel($Default_Folder, 20, 40, 260) GUICtrlSetFont(-1, 8, 400, $Font) $Button_1 = GUICtrlCreateButton($TextButton_Prog_1, 20, 80, 260) $Button_2 = GUICtrlCreateButton($TextButton_Prog_2, 20, 120, 260) $Button_3 = GUICtrlCreateButton($TextButton_Prog_3, 20, 160, 260) $Button_4 = GUICtrlCreateButton($TextButton_Prog_4, 20, 200, 260) $Button_5 = GUICtrlCreateButton($TextButton_Prog_5, 20, 240, 260) GUICtrlCreateGroup ("", 10, 300, 280, 50) $CheckBoxButton = GUICtrlCreateCheckbox("Choose the folder", 20, 320, 200, 20) GUICtrlSetFont(-1, 12, 600, $Font) GUICtrlSetColor(-1,0xFF0000) GUICtrlCreateGroup ("Verify", 10, 360, 280, 60) $Button_Verif = GUICtrlCreateButton($TextButton_Verify, 20, 380, 260) GUICtrlSetColor(-1,0x0000FF) GUICtrlCreateGroup ("Screen Capture", 10, 440, 280, 60) $Button_Shoot = GUICtrlCreateButton("Shoot It Now", 20, 460, 260) GUICtrlSetColor(-1,0xFF0000) GUISetState() While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE ExitLoop Case $Msg = $Button_1 If BitAnd(GUICtrlRead($CheckBoxButton),$GUI_UNCHECKED) Then Call("ExifSorter") Else Run($Prog_1) EndIf Case $Msg = $Button_2 If BitAnd(GUICtrlRead($CheckBoxButton),$GUI_UNCHECKED) Then Call("DupliCatKiller") Else Run($Prog_2) EndIf Case $Msg = $Button_3 If BitAnd(GUICtrlRead($CheckBoxButton),$GUI_UNCHECKED) Then Call("CopyRightSorter") Else Run($Prog_3) EndIf Case $Msg = $Button_4 If BitAnd(GUICtrlRead($CheckBoxButton),$GUI_UNCHECKED) Then Call("SizeSorter") Else Run($Prog_4) EndIf Case $Msg = $Button_5 If BitAnd(GUICtrlRead($CheckBoxButton),$GUI_UNCHECKED) Then Call("YearMonthSorter") Else run($Prog_5) EndIf Case $Msg = $Button_verif Call("VerifReps") Case $Msg = $Button_Shoot Call("CapturIt") EndSelect WEnd ;Functions to call Func ExifSorter() $ExifSorter_Log = IniRead("ExifManager.ini", "ExifSorter_Log", "key", "NotFound") $Duplicated_Deep = IniRead("ExifManager.ini", "Duplicated_Deep", "key", "NotFound") $Begin_Time = TimerInit() TrayTip("'ExifSorter'", "Launched at " & _NowTime(), 20, 1) $Log = FileOpen($Program_Folder & "\" & $ExifSorter_Log, 1) FileWrite($Log, "================================================================================================ ============================================================" & @CRLF) FileWrite($Log, "ExifSorter Launch : ") FileWrite($Log, _NowCalcDate() & " " & _DateTimeFormat( _NowCalc(),5) & @CRLF) FileWrite($Log, "==============================================================================" & @CRLF) FileClose($Log) For $i=1 to $Extension_Nb $LookFor = IniRead("ExifManager.ini", "Extension_" & $i, "Key", "NotFound") $Search = FileFindFirstFile($Default_Folder & "\" & "*." & $LookFor) If $Search = -1 Then $Log = FileOpen($Program_Folder & "\" & $ExifSorter_Log, 1) FileWrite($Log, @CRLF & "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF) FileWrite($Log, "No File '" & $LookFor & "' found in " & $Default_Folder & @CRLF) FileWrite($Log, "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF & @CRLF) FileClose($Log) Else $Log = FileOpen($Program_Folder & "\" & $ExifSorter_Log, 1) While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If Not @error Then $aInfo = _ImageGetInfo($Default_Folder & "\" & $File) $FileDate = _ImageGetParam($aInfo, "DateTimeOriginal") $ReplaceIt = StringReplace($FileDate, ":", "") $Final = StringReplace($ReplaceIt, " ", "") $t = FileGetTime($Default_Folder & "\" & $File, 1) EndIf If $Final > 0 Then FileWrite($Log, " " & $File & " --->>> " & $Final & "." & $LookFor & " -> " & $Folder_Exif & "\" & @CRLF) If FileExists($Default_Folder & "\" & $Folder_Exif & "\" & $Final & "." & $LookFor) Then If FileExists($Default_Folder & "\" & $Folder_Exif & "\" & $Final & "." & $LookFor) Then FileWrite($Log, " " & $Final & "." & $LookFor & " already exists in " & $Folder_Exif & "\" & @CRLF) FileWrite($Log, " " & $Final & "." & $LookFor & " renamed only" & @CRLF & @CRLF) FileMove($Default_Folder & "\" & $File, $Default_Folder & "\" & $Final & "." & $LookFor, 8) Else FileMove($Default_Folder & "\" & $File, $Default_Folder & "\" & $Folder_Exif & "\" & $Final & "." & $LookFor, 8) FileWrite($Log, " " & $Final & "." & $LookFor & " renamed and moved" & @CRLF & @CRLF) EndIf Else FileMove($Default_Folder & "\" & $File, $Default_Folder & "\" & $Folder_Exif & "\" & $Final & "." & $LookFor, 8) EndIf Else $Total = $t[0] & $t[1] & $t[2] & $t[3] & $t[4] & $t[5] If Not FileExists($Default_Folder & "\" & $Folder_NoExif & "\" & $Total & "." & $LookFor) Then For $v=1 to $Duplicated_Deep $Mr_More = ($v+1) If Not FileExists($Default_Folder & "\" & $Folder_NoExif & "\" & $Total & $Mr_More & "." & $LookFor) Then FileMove($Default_Folder & "\" & $File, $Default_Folder & "\" & $Folder_NoExif & "\" & $Total & $Mr_More & "." & $LookFor, 8) FileWrite($Log, " " & $File & " --->>> " & $Total & "." & $LookFor & @CRLF) ExitLoop EndIf Next EndIf EndIf WEnd FileClose($Search) FileClose($Log) EndIf Next $Log = FileOpen($Program_Folder & "\" & $ExifSorter_Log, 1) Sleep(1000) FileMove($Default_Folder & "\" & $Folder_Exif & "\" & "*.*", $Default_Folder & "\" & $Folder_ToSort & "\" & "*.*", 8) FileMove($Default_Folder & "\" & $Folder_NoExif & "\" & "*.*", $Default_Folder & "\" & $Folder_ToSort & "\" & "*.*", 8) $Difference = TimerDiff($Begin_Time) $Period = Round(($Difference)/1000) FileWrite($Log, "================================================================================================ ============================================================" & @CRLF) FileWrite($Log, "All treatments realized in " & $Period & " sec." & @CRLF & @CRLF & @CRLF) FileClose($Log) MsgBox(64, "End of treatment ExifSorter", "All files founds moved to folder " & @CRLF & $Default_Folder & "\" & $Folder_ToSort & "\" & @CRLF & @CRLF & "in " & $Period & " sec.") TrayTip("Clears any Tray Tip","",0) EndFunc Func DupliCatKiller() $DuplicatedSorter_Log = IniRead("ExifManager.ini", "DuplicatedSorter_Log", "key", "NotFound") $Duplicated_Deep = IniRead("ExifManager.ini", "Duplicated_Deep", "key", "NotFound") $begintime = TimerInit() TrayTip("'DupliCatKiller'", "Launched at " & _NowTime(), 20, 1) $Log = FileOpen($Program_Folder & "\" & $DuplicatedSorter_Log, 1) FileWrite($Log, "================================================================================================ ============================================================" & @CRLF) FileWrite($Log, "DupliCatKiller Launch : ") FileWrite($Log, _NowCalcDate() & " " & _DateTimeFormat( _NowCalc(),5) & @CRLF) FileWrite($Log, "==============================================================================" & @CRLF) FileClose($Log) For $i=1 to $Extension_Nb $LookFor = IniRead("ExifManager.ini", "Extension_" & $i, "Key", "NotFound") $Search = FileFindFirstFile($Default_Folder & "\" & "*." & $LookFor) If $Search = -1 Then $Log = FileOpen($Program_Folder & "\" & $DuplicatedSorter_Log, 1) FileWrite($Log, @CRLF & "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF) FileWrite($Log, "No File '" & $LookFor & "' found in " & $Default_Folder & @CRLF) FileWrite($Log, "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF & @CRLF) FileClose($Log) Else $Log = FileOpen($Program_Folder & "\" & $DuplicatedSorter_Log, 1) While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If Not @error Then $aInfo = _ImageGetInfo($Default_Folder & "\" & $File) $FileDate = _ImageGetParam($aInfo, "DateTimeOriginal") $ReplaceIt = StringReplace($FileDate, ":", "") $Final = StringReplace($ReplaceIt, " ", "") $t = FileGetTime($Default_Folder & "\" & $File, 1) EndIf If $Final > 0 Then FileWrite($Log, " " & $File & " --->>> " & $Final & "." & $LookFor & " -> " & $Folder_Exif & "\" & @CRLF) If FileExists($Default_Folder & "\" & $Folder_Exif & "\" & $Final & "." & $LookFor) Then FileWrite($Log, $Final & "." & $LookFor & " already exists in " & $Folder_Exif & "\" & @CRLF) For $v=1 to $Duplicated_Deep $Mr_More = ($v+1) If Not FileExists($Default_Folder & "\" & $Folder_Exif & "\" & $Final & "_0" & $Mr_More & "." & $LookFor) Then FileWrite($Log, "Okay - " & $Final & "_0" & $Mr_More & "." & $LookFor & @CRLF) FileMove($Default_Folder & "\" & $File, $Default_Folder & "\" & $Folder_Exif & "\" & $Final & "_0" & $Mr_More & "." & $LookFor, 8) ExitLoop EndIf Next EndIf Else $Total = $t[0] & $t[1] & $t[2] & $t[3] & $t[4] & $t[5] FileWrite($Log, " " & $File & " --->>> " & $Total & "." & $LookFor & @CRLF) If FileExists($Default_Folder & $Folder_NoExif & $Total & "." & $LookFor) Then FileWrite($Log, "This name already exists : " & $Total & "." & $LookFor & @CRLF) For $v=1 to $Duplicated_Deep $Mr_More = ($v+1) If Not FileExists($Default_Folder & $Folder_NoExif & $Total & "_0" & $Mr_More & "." & $LookFor) Then FileWrite($Log, "Okay - " & $Total & "_" & $Mr_More & "." & $LookFor & @CRLF) FileMove($Default_Folder & "\" & $File, $Default_Folder & "\" & $Folder_NoExif & "\" & $Total & "_0" & $Mr_More & "." & $LookFor, 8) ExitLoop EndIf Next Else FileMove($Default_Folder & "\" & $File, $Default_Folder & $Folder_NoExif & $Total & "." & $LookFor, 8) FileWrite($Log, " " & $File & " --->>> " & $Total & "." & $LookFor & @CRLF) EndIf EndIf WEnd FileClose($Search) FileClose($Log) EndIf Next $dif = TimerDiff($begintime) $Period = round(($dif)/1000) $Log = FileOpen($Program_Folder & "\" & $DuplicatedSorter_Log, 1) Sleep(1000) FileMove($Default_Folder & "\" & $Folder_Exif & "\" & "*.*", $Default_Folder & "\" & $Folder_ToSort & "\" & "*.*", 8) FileMove($Default_Folder & "\" & $Folder_NoExif & "\" & "*.*", $Default_Folder & "\" & $Folder_ToSort & "\" & "*.*", 8) FileWrite($Log, "================================================================================================ ============================================================" & @CRLF) FileWrite($Log, "All treatments realized in " & $Period & " sec." & @CRLF & @CRLF & @CRLF) FileClose($Log) MsgBox(64, "End of treatment DupliCatKiller", "All files founds moved to folder " & @CRLF & $Default_Folder & "\" & $Folder_ToSort & "\" & @CRLF & @CRLF & "in " & $Period & " sec.") TrayTip("clears any tray tip","",0) EndFunc Func CopyRightSorter() $CopyRightSorter_Log = IniRead("ExifManager.ini", "CopyRightSorter_Log", "key", "NotFound") $CopyRighted_Folder = IniRead("ExifManager.ini", "CopyRighted_Folder", "key", "NotFound") $begintime = TimerInit() TrayTip("'CopyRightSorter'", "Launched at " & _NowTime(), 20, 1) $Log = FileOpen($Program_Folder & "\" & $CopyRightSorter_Log, 1) FileWrite($Log, "================================================================================================ ============================================================" & @CRLF) FileWrite($Log, "CopyRightSorter Launch : ") FileWrite($Log, _NowCalcDate() & " " & _DateTimeFormat( _NowCalc(),5) & @CRLF) FileWrite($Log, "==============================================================================" & @CRLF) FileClose($Log) For $i=1 to $Extension_Nb $LookFor = IniRead("ExifManager.ini", "Extension_" & $i, "Key", "NotFound") $Search = FileFindFirstFile($Default_Folder & "\" & $Folder_ToSort & "\" & "*." & $LookFor) If $search = -1 Then $Log = FileOpen($Program_Folder & "\" & $CopyRightSorter_Log, 1) FileWrite($Log, @CRLF & "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF & @CRLF) FileWrite($Log, "No File '" & $LookFor & "' found in " & $Default_Folder & "\" & $Folder_ToSort & @CRLF) FileWrite($Log, "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF) FileClose($Log) Else $Log = FileOpen($Program_Folder & "\" & $CopyRightSorter_Log, 1) While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If Not @error Then $aInfo = _ImageGetInfo($Default_Folder & "\" & $Folder_ToSort & "\" & $File) $CopyRight = _ImageGetParam($aInfo, "Copyright") If $CopyRight > 0 Then FileWrite($Log, "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF) FileWrite($Log, " Files " & $LookFor & " found : " & @CRLF & @CRLF) FileWrite($Log, "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF) FileWrite($Log, $File & " -->> get a copyright" & @CRLF) If FileExists($Default_Folder & "\" & $Folder_ToSort & "\" & $CopyRighted_Folder & "\" & $File) Then FileWrite($Log, " " & $File & " -->> Already exists in folder - Please use DupliCatKiller. " & @CRLF & @CRLF) Else FileWrite($Log, $Default_Folder & "\" & $Folder_ToSort & "\" & $CopyRighted_Folder & "\" & $File & " -->> copyrighted" & @CRLF) EndIf Else EndIf EndIf WEnd FileClose($Search) FileClose($Log) EndIf Next $dif = TimerDiff($begintime) $Period = round(($dif)/1000) Sleep(1000) $Log = FileOpen($Program_Folder & "\" & $CopyRightSorter_Log, 1) FileWrite($Log, "================================================================================================ ============================================================" & @CRLF) FileWrite($Log, "All treatments realized in " & $Period & " sec." & @CRLF & @CRLF & @CRLF) FileClose($Log) MsgBox(64, "End of treatment CopyRightSorter", "A Log File has been created. Take time to read it please." & @CRLF & @CRLF & "in " & $Period & " sec.") TrayTip("clears any tray tip","",0) EndFunc Func SizeSorter() $SizeSorter_Log = IniRead("ExifManager.ini", "SizeSorter_Log", "key", "NotFound") $Picture_Size = IniRead("ExifManager.ini", "Picture_Size", "key", "NotFound") $Size_Folder = IniRead("ExifManager.ini", "Size_Folder", "key", "NotFound") $begintime = TimerInit() TrayTip("'SizeSorter'", "Launched at " & _NowTime(), 20, 1) $Log = FileOpen($Program_Folder & "\" & $SizeSorter_Log, 1) FileWrite($Log, "================================================================================================ ============================================================" & @CRLF) FileWrite($Log, "SizeSorter Launch : ") FileWrite($Log, _NowCalcDate() & " " & _DateTimeFormat( _NowCalc(),5) & @CRLF) FileWrite($Log, "==============================================================================" & @CRLF) FileClose($Log) For $i=1 to $Extension_Nb $LookFor = IniRead("ExifManager.ini", "Extension_" & $i, "Key", "NotFound") $Search = FileFindFirstFile($Default_Folder & "\" & $Folder_ToSort & "\" & "*." & $LookFor) If $Search = -1 Then $Log = FileOpen($Program_Folder & "\" & $SizeSorter_Log, 1) FileWrite($Log, @CRLF & "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF & @CRLF) FileWrite($Log, "No File '" & $LookFor & "' found in " & $Default_Folder & "\" & $Folder_ToSort & @CRLF) FileWrite($Log, "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF) FileClose($Log) Else $Log = FileOpen($Program_Folder & "\" & $SizeSorter_Log, 1) FileWrite($Log, " Files " & $LookFor & " found : " & @CRLF & @CRLF) FileWrite($Log, "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF) While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If Not @error Then $aInfo = _ImageGetInfo($Default_Folder & "\" & $Folder_ToSort & "\" & $File) $Width = _ImageGetParam($aInfo, "Width") $Height = _ImageGetParam($aInfo, "Height") $Calculate = $Width*$Height MsgBox(64, "SizeSorter", $File & @CRLF & "Width : " & $Width & " & " & "Height : " & $Height & @CRLF & @CRLF & "Calcul : " & $Calculate) If $Calculate < $Picture_Size Then If FileExists($Default_Folder & "\" & $Folder_ToSort & "\" & $Size_Folder & "\" & $File) Then FileWrite($Log, " " & $File & " -->> Already exists in folder - Please use DupliCatKiller." & @CRLF & @CRLF) Else ; FileWrite($Log, $File & " -->> Little pic -> so moved" & @CRLF) MsgBox(64, "SizeSorter", " -->> Little pic -> so moved") EndIf Else EndIf EndIf WEnd FileClose($search) FileClose($Log) EndIf Next $dif = TimerDiff($begintime) $Period = round(($dif)/1000) Sleep(1000) $Log = FileOpen($Program_Folder & "\" & $SizeSorter_Log, 1) FileWrite($Log, "================================================================================================ ============================================================" & @CRLF) FileWrite($Log, "All treatments realized in " & $Period & " sec." & @CRLF & @CRLF & @CRLF) FileClose($Log) MsgBox(64, "End of treatment SizeSorter", "All files founds moved to folder " & @CRLF & $Default_Folder & "\" & $Folder_ToSort & "\" & @CRLF & @CRLF & "in " & $Period & " sec.") TrayTip("clears any tray tip","",0) EndFunc Func VerifReps() $Folder_a = FileFindFirstFile($Default_Folder & "\" & $Folder_Exif & "\*.*") If $Folder_a = 1 Then MsgBox(48,"Folder is not empty", "The Folder " & $Folder_Exif & @CRLF & " is not empty !") Else MsgBox(64,"Folder is empty", "The Folder " & $Folder_Exif & " is empty ") EndIf FileClose($Folder_a) $Folder_b = FileFindFirstFile($Default_Folder & "\" & $Folder_NoExif & "\*.*") If $Folder_b = 1 Then MsgBox(48,"Folder is not empty", "The Folder " & $Folder_NoExif & @CRLF & " is not empty !") Else MsgBox(64,"Folder is empty", "The Folder " & $Folder_NoExif & " is empty") EndIf FileClose($Folder_b) $Folder_c = FileFindFirstFile($Default_Folder & "\" & $Shoots_Folder & "\*.*") If $Folder_c = 1 Then MsgBox(48,"Folder is not empty", "The Folder " & $Shoots_Folder & @CRLF & " is not empty !") Else MsgBox(64,"Folder is empty", "The Folder " & $Shoots_Folder & " is empty") EndIf FileClose($Folder_c) EndFunc Func CapturIt() If FileExists($Default_Folder & "\" & $Shoots_Folder) Then _ScreenCapture_Capture($Default_Folder & "\" & $Shoots_Folder & "\" & "shoot_" & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & ".jpg") TrayTip("CapturIt", "File created", 1, 1) Else DirCreate($Default_Folder & "\" & $Shoots_Folder) _ScreenCapture_Capture($Default_Folder & "\" & $Shoots_Folder & "\" & "shoot_" & @YEAR & @MON & @MDAY & @HOUR & @MIN & @SEC & ".jpg") TrayTip("CapturIt", "File created", 1, 1) EndIf Sleep(2000) TrayTip("clears any tray tip","",0) EndFunc Func YearMonthSorter() $Duplicated_Deep = IniRead("ExifManager.ini", "Duplicated_Deep", "key", "NotFound") $Folder_SortYearMonth = IniRead("ExifManager.ini", "Folder_SortYearMonth", "key", "NotFound") $begintime = TimerInit() TrayTip("'YearMonthSorter'", "Launched at " & _NowTime(), 20, 1) ;en test au delà de cette section For $i=1 to $Extension_Nb $LookFor = IniRead("ExifManager.ini", "Extension_" & $i, "Key", "NotFound") $Search = FileFindFirstFile($Default_Folder & "\" & $Folder_ToSort & "\" & "*." & $LookFor) If $Search = -1 Then MsgBox(64, "End of treatment YearMonthSorter", "No file found") Else While 1 $File = FileFindNextFile($Search) If @error Then ExitLoop If Not @error Then $aInfo = _ImageGetInfo($Default_Folder & "\" & $Folder_ToSort & "\" & $File) $FileDate = _ImageGetParam($aInfo, "DateTimeOriginal") $ReplaceIt = StringReplace($FileDate, ":", "") $Final = StringReplace($ReplaceIt, " ", "") $t = FileGetTime($Default_Folder & "\" & $Folder_ToSort & "\" & $File, 1) EndIf If $Final > 0 Then ; MsgBox(64,"$Final", $Final) $variable = StringMid($Final, 1, 6) ; MsgBox(64,"$6 premiers caractères", $variable) If FileExists($Default_Folder & "\" & $Folder_SortYearMonth & "\" & $Final & "." & $LookFor) Then If FileExists($Default_Folder & "\" & $Folder_SortYearMonth & "\" & $Final & "." & $LookFor) Then ;rien Else ; DirCreate($Default_Folder & "\" & $Folder_SortYearMonth & "\" & $variable) ; FileMove($Default_Folder & "\" & $Folder_ToSort "\" & $File, $Default_Folder & "\" & $Folder_ToSort & "\" & $Final & "." & $LookFor, 8) EndIf Else DirCreate($Default_Folder & "\" & $Folder_SortYearMonth & "\" & $variable) ; FileMove($Default_Folder & "\" & $File, $Default_Folder & "\" & $Folder_Exif & "\" & $Final & "." & $LookFor, 8) EndIf Else $Total = $t[0] & $t[1] & $t[2] & $t[3] & $t[4] & $t[5] $YearMonth = $t[0] & $t[1] If Not FileExists($Default_Folder & "\" & $Folder_ToSort & "\" & $Total & "." & $LookFor) Then For $v=1 to $Duplicated_Deep $Mr_More = ($v+1) If Not FileExists($Default_Folder & "\" & $Folder_SortYearMonth & "\" & $Total & $Mr_More & "." & $LookFor) Then DirCreate($Default_Folder & "\" & $Folder_SortYearMonth & "\" & $YearMonth) ; FileMove($Default_Folder & "\" & $File, $Default_Folder & "\" & $Folder_NoExif & "\" & $Total & $Mr_More & "." & $LookFor, 8) ExitLoop EndIf Next EndIf EndIf WEnd FileClose($Search) EndIf Next ; FileMove($Default_Folder & "\" & $Folder_ToSort & "\" & "*.*", $Default_Folder & "\" & $Folder_SortYearMonth & "\" & "*.*", 8) ;fin de la section en test $dif = TimerDiff($begintime) $Period = round(($dif)/1000) Sleep(1000) MsgBox(64, "End of treatment YearMonthSorter", "All Treatments done" & @CRLF & @CRLF & "in " & $Period & " sec.") TrayTip("clears any tray tip","",0) EndFunc
  7. Hi all, I've tried an other way for realize the thing and i've found this code that works well. Some of the text is in French, but that's not a problem because it's only text. I use some INI files and encryption too. #Include <date.au3> #include <file.au3> #Include <GUIconstants.au3> $replog = IniRead("cfgconst.ini", "replog", "key", "NotFound") $adminlog = IniRead("cfgconst.ini", "adminlog", "key", "NotFound") If FileExists("cfgconst.ini") Then ;on fait rien Else MsgBox(64,"Création du fichier de référence", "Attention !" & @CRLF & @CRLF & "Vous allez créer le fichier de référence des constantes de configuration" & @CRLF & @CRLF & "En cas de problème, vous pouvez modifier le fichier cfgconst.ini") $usercfg=InputBox("Nom de l'utilisateur/admin","Veuillez entrer le nom de l'utilisateur ayant accès aux machines : ","Administrateur") IniWrite("cfgconst.ini","User","Key",$usercfg) $nbservers=InputBox("Nombre de serveurs","Veuillez indiquer le nombre de serveurs : " & @CRLF & @CRLF & "(Attention ! Ayant le même mot de passe pour le même utilisateur)","") IniWrite("cfgconst.ini","NbServeurs","Key",$nbservers) EndIf $user = IniRead("cfgconst.ini", "User", "key", "NotFound") $nb = IniRead("cfgconst.ini", "NbServeurs", "key", "NotFound") If FileExists("serverslist.ini") Then ;on fait rien Else MsgBox(64,"Création de la liste de serveurs", "Vous allez créer le fichier liste de référence des serveurs auxquels vous voulez accéder" & @CRLF & @CRLF & "En cas de problème, vous pouvez modifier le fichier serverlist.ini") MsgBox(48,"Consigne d'écriture", " - Le nom du serveur doit être indiqué tel qu'il puisse être résolu en DNS" & @CRLF & @CRLF & " - Vous pouvez entrer une adresse IP" & @CRLF & @CRLF & " - N'entrez aucun \ ou \\ avant ou après le nom de la machine " & @CRLF & @CRLF & " exemple : s4500120 " & @CRLF) For $d=1 to $nb $servername=InputBox("Nom du serveur","Veuillez entrer le nom du serveur " & $d & " sur " & $nb,"") IniWrite("serverslist.ini","Serveur" & $d,"Key", "\\" & $servername & "\" & @CRLF) Next EndIf If FileExists("cryptage.ini") Then $PASSKEY = "PASSWORD" $M_PASSWORD =IniRead("cryptage.ini","program","password","") $M_PASSWORD = Crypt($PASSKEY,Hex2Str($M_PASSWORD)) Else MsgBox(48,"Avertissement mot de passe", "Attention !" & @CRLF & @CRLF & "Vous allez créer le mot de passe de voter utilisateur : " & $user) $PASSKEY = "PASSWORD" $PASSWORD=InputBox("Mot de passe de " & $user,"Tapez le mot de passe à enregistrer : " & @CRLF & @CRLF & "(Il vous sera demandé de le confirmer mais ne sera plus demandé au prochain lancement)","","*") $TEMP = Str2Hex(Crypt($PASSKEY,$PASSWORD)) IniWrite("cryptage.ini","program","password",$TEMP) $PASSWORD=InputBox("Vérification","Tapez le mot de passe pour vérification avec la version enregistrée : ","","*") $M_PASSWORD =IniRead("cryptage.ini","program","password","") $M_PASSWORD = Crypt($PASSKEY,Hex2Str($M_PASSWORD)) If $M_PASSWORD == $PASSWORD Then MsgBox(0,'Ok', "Les mots de passe correspondent.") Else MsgBox(16,'Houlala !!!', "Les mots de passe correspondent pas !!!") FileDelete("cryptage.ini") Exit EndIf EndIf Func Crypt($PASS, $STRG) $A = 1 $N_STRG = "" For $I = 1 To StringLen($STRG) $B = Asc(StringMid($PASS, $A, 1)) $A = $A + 1 If $A > StringLen($PASS) Then $A = 1 $N_STRG = $N_STRG & Chr(BitXOR(Asc(StringMid($STRG, $I, 1)),$B)) Next Return $N_STRG EndFunc Func Str2Hex($STRG) $H = "" For $I = 1 To StringLen($STRG) $H = $H & String(Hex(Asc(StringMid($STRG, $I, 1)),2)) Next Return $H EndFunc Func Hex2Str($H) $STRG = "" For $I = 1 To StringLen($H) Step 2 $STRG = $STRG & Chr(Dec(StringMid($H, $I, 2))) Next Return $STRG EndFunc $log = FileOpen($replog & $adminlog, 2) FileWrite($log, "Serveur " & "Date Reboot " & "Heures " & "Heure locale" & @CRLF) For $i=1 to $nb $serv = IniRead("serverslist.ini", "Serveur" & $i, "key", "NotFound") $repserv = StringReplace($serv, "\", "") $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = $repserv $Output = "" $Output = $Output & "Ordinateur : " & $strComputer & @CRLF FileWrite($log, $strComputer & " ") $Output = $Output & "================================" & @CRLF $wmiLocator = ObjCreate("WbemScripting.SWbemLocator") $objWMIService = $wmiLocator.ConnectServer($strComputer, "root\cimv2", $user, $M_PASSWORD) $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $LastBootUp = WMIDateStringToDate($objItem.LastBootUpTime) $LocalDateTime = WMIDateStringToDate($objItem.LocalDateTime) $Output = $Output & "Dernier Reboot : " & $LastBootUp & @CRLF FileWrite($log, $LastBootUp & " ") $Output = $Output & "================================" & @CRLF ; $Output = $Output & "En années : " & _DateDiff("Y", $LastBootUp, $LocalDateTime) & @CRLF ; $Output = $Output & "En mois : " & _DateDiff("M", $LastBootUp, $LocalDateTime) & @CRLF ; $Output = $Output & "En semaines : " & _DateDiff("W", $LastBootUp, $LocalDateTime) & @CRLF $Output = $Output & "En jours : " & _DateDiff("D", $LastBootUp, $LocalDateTime) & @CRLF $Output = $Output & "En heures : " & _DateDiff("h", $LastBootUp, $LocalDateTime) & @CRLF FileWrite($log, _DateDiff("h", $LastBootUp, $LocalDateTime) & " ") $Output = $Output & "En Minutes : " & _DateDiff("n", $LastBootUp, $LocalDateTime) & @CRLF ; $Output = $Output & "En Secondes : " & _DateDiff("s", $LastBootUp, $LocalDateTime) & @CRLF & @CRLF $Output = $Output & "----------------------------------------------------------------" & @CRLF $Output = $Output & "Heure locale de " & $strComputer & " : " & $LocalDateTime & @CRLF FileWrite($log, $LocalDateTime & @CRLF) ;If MsgBox(1, "Extraction WMI - Dernier reboot machine", $Output) = 2 Then ExitLoop $Output = "" Next Else MsgBox(0, "WMI Output", "Pas d'objets WMI trouvés pour cette classe : " & "Win32_OperatingSystem") EndIf Next FileClose($log) Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 1, 4) & "/" & StringMid($dtmDate, 5, 2) & "/" & StringMid($dtmDate, 7, 2) & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2)) EndFunc
  8. hello, Your code was interesting. I tried it and found another response to it, more fluent in a way. With the small changes i've done, you can use each value in a csv. In my case, it's 3 values separated by a ";" separator. See below. $Line=1 $path="file.csv" While 1 $String=FileReadLine($path,$Line) If $String="" Then Exit $Snam=StringSplit($String, ";") MsgBox(0,"","Serveur : " & $Snam[1] & @CRLF & " Disque : " & $Snam[2] & @CRLF & " Valeur : " & $Snam[3]) $Line+=1 WEnd
  9. i've tried to realize something like you want. See it : #Include <date.au3> #include <file.au3> #Include <GUIconstants.au3> $share = IniRead("cfgconst.ini", "Partage", "key", "NotFound") $letter = IniRead("cfgconst.ini", "Lettre", "key", "NotFound") $user = IniRead("cfgconst.ini", "User", "key", "NotFound") $nb = IniRead("cfgconst.ini", "NbServeurs", "key", "NotFound") $replog = IniRead("cfgconst.ini", "Replogs", "key", "NotFound") If FileExists("cryptage.ini") Then $PASSKEY = "PASSWORD" $M_PASSWORD =IniRead("cryptage.ini","program","password","") $M_PASSWORD = Crypt($PASSKEY,Hex2Str($M_PASSWORD)) Else $PASSKEY = "PASSWORD" $PASSWORD=InputBox("Prompt","Tapez le mot de passe à sauvegarder : ","","*") $TEMP = Str2Hex(Crypt($PASSKEY,$PASSWORD)) IniWrite("cryptage.ini","program","password",$TEMP) $PASSWORD=InputBox("Prompt","Tapez le mot de passe pour vérification avec la version enregistrée : ","","*") $M_PASSWORD =IniRead("cryptage.ini","program","password","") $M_PASSWORD = Crypt($PASSKEY,Hex2Str($M_PASSWORD)) If $M_PASSWORD == $PASSWORD Then MsgBox(0,'Ok', "Les mots de passe correspondent.") Else MsgBox(16,'Houlala !!!', "Les mots de passe correspondent pas !!!") FileDelete("cryptage.ini") Exit EndIf EndIf Func Crypt($PASS, $STRG) $A = 1 $N_STRG = "" For $I = 1 To StringLen($STRG) $B = Asc(StringMid($PASS, $A, 1)) $A = $A + 1 If $A > StringLen($PASS) Then $A = 1 $N_STRG = $N_STRG & Chr(BitXOR(Asc(StringMid($STRG, $I, 1)),$B)) Next Return $N_STRG EndFunc Func Str2Hex($STRG) $H = "" For $I = 1 To StringLen($STRG) $H = $H & String(Hex(Asc(StringMid($STRG, $I, 1)),2)) Next Return $H EndFunc Func Hex2Str($H) $STRG = "" For $I = 1 To StringLen($H) Step 2 $STRG = $STRG & Chr(Dec(StringMid($H, $I, 2))) Next Return $STRG EndFunc $serv = IniRead("serverslist.ini", "Serveur1", "key", "NotFound") $repserv = StringReplace($serv, "\", "") $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = $repserv $Output = "" $Output = $Output & "Ordinateur : " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $wmiLocator = ObjCreate("WbemScripting.SWbemLocator") $objWMIService = $wmiLocator.ConnectServer($strComputer, "root\cimv2", $user, $M_PASSWORD) $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $LastBootUp = WMIDateStringToDate($objItem.LastBootUpTime) $LocalDateTime = WMIDateStringToDate($objItem.LocalDateTime) $Output = $Output & "En années : " & _DateDiff("Y", $LastBootUp, $LocalDateTime) & @CRLF $Output = $Output & "En mois : " & _DateDiff("M", $LastBootUp, $LocalDateTime) & @CRLF $Output = $Output & "En semaines : " & _DateDiff("W", $LastBootUp, $LocalDateTime) & @CRLF $Output = $Output & "En jours : " & _DateDiff("D", $LastBootUp, $LocalDateTime) & @CRLF $Output = $Output & "En heures : " & _DateDiff("h", $LastBootUp, $LocalDateTime) & @CRLF $Output = $Output & "En Minutes : " & _DateDiff("n", $LastBootUp, $LocalDateTime) & @CRLF $Output = $Output & "En Secondes : " & _DateDiff("s", $LastBootUp, $LocalDateTime) & @CRLF $Output = $Output & "Dernier Reboot : " & $LastBootUp & @CRLF $Output = $Output & "Heure locale machine : " & $LocalDateTime & @CRLF If MsgBox(1, "WMI Output", $Output) = 2 Then ExitLoop $Output = "" Next Else MsgBox(0, "WMI Output", "Pas d'objets WMI trouvés pour cette classe : " & "Win32_OperatingSystem") EndIf Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 1, 4) & "/" & StringMid($dtmDate, 5, 2) & "/" & StringMid($dtmDate, 7, 2) & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2)) EndFunc ;==>WMIDateStringToDate So you need 2 ini files : cfgconst.ini [Partage] Key=c$ [Lettre] Key=X: [User] Key=administrateur [NbServeurs] Key=8 [Replogs] Key=admintoolslogs and the second will be created when launch the au3 : cryptage.ini, to encrypt your admin pwd. And at this time, i'm working on a multiple connection to several servers to get their own launch time. Help you ?
  10. This script is fun and easy using on a local host, but it doesn't work for any remote machine. I mean that you can't ask a remote server, no answer come back (object is empty). Any idea on it ?
  11. For my part, i made this : #Include <date.au3> #include <file.au3> #Include <GUIconstants.au3> #include "image_get_info.au3" $replog = IniRead("sizesorter.ini", "replog", "key", "NotFound") $adminlog = IniRead("sizesorter.ini", "adminlog", "key", "NotFound") $folderdft = IniRead("sizesorter.ini", "Repertoire", "key", "NotFound") $finalfolder = FileSelectFolder("Choisir un dossier", "", 2, $folderdft) $sizeref = IniRead("sizesorter.ini", "sizeref", "key", "NotFound") $repsizeless = "sizelessthan" & $sizeref & "\" $repsizeup = "sizemorethan" & $sizeref & "\" $multiplic = $sizeref*$sizeref $target = $finalfolder & "\" $nb = IniRead("sizesorter.ini", "NbExtense", "key", "NotFound") $deep = IniRead("sizesorter.ini", "DupliDeep", "key", "NotFound") $sNewDate = _DateAdd( 'n',-1, _NowCalc()) TrayTip("'SizeSorter'", "Lancement à " & _NowTime(), 20, 1) $log = FileOpen($replog & $adminlog, 1) FileWrite($log, "==============================================================================" & @CRLF) FileWrite($log, "Lancement de SizeSorter - " & _NowCalcDate() & " " & _DateTimeFormat( _NowCalc(),5) & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileWrite($log, "Cible : " & $target & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileWrite($log, "Nom initial -->> Calcul" & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileClose($log) For $i=1 to $nb $look = IniRead("sizesorter.ini", "ext" & $i, "Key", "NotFound") $assembl = "*." & $look $search = FileFindFirstFile($target & $assembl) If $search = -1 Then $log = FileOpen($replog & $adminlog, 1) FileWrite($log, @CRLF & "------------------------------------------------------------------------------" & @CRLF & @CRLF) FileWrite($log, "Aucun fichier '" & $look & "' trouvé." & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileClose($log) Else $log = FileOpen($replog & $adminlog, 1) While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If Not @error Then $aInfo = _ImageGetInfo($target & $file) $Width = _ImageGetParam($aInfo, "Width") $Height = _ImageGetParam($aInfo, "Height") $calcul = $Width*$Height If $calcul < $multiplic Then FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileWrite($log, " Fichiers " & $look & " trouvés : " & @CRLF & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) ;FileWrite($log, $file & " -->> " & $Width & " x " & $Height & " = " & $calcul & @CRLF) FileWrite($log, $file & " -->> petite taille -> déplacer" & @CRLF) If FileExists($target & $repsizeless & $file) Then FileWrite($log, " " & $file & " -->> Existe déjà dans le répertoire cible !!!" & @CRLF & @CRLF) Else FileMove($target & $file, $target & $repsizeless & $file, 8) EndIf Else ;FileWrite($log, $file & " -->> pas petite taille." & @CRLF) ;FileMove($target & $file, $target & $repsizeup & $file, 8) EndIf EndIf WEnd FileClose($search) FileClose($log) EndIf Next $log = FileOpen($replog & $adminlog, 1) FileWrite($log, "==============================================================================" & @CRLF) FileWrite($log, "Fin du traitement - " & _NowCalcDate() & " " & _DateTimeFormat( _NowCalc(),5) & @CRLF & @CRLF & @CRLF) FileClose($log) MsgBox(4096, "Fin du traitement SizeSorter", "Tous les fichiers ont été triés et copiés selon leur taille" & @CRLF) TrayTip("clears any tray tip","",0) It works well. Need this ini file. Your size reference is sizeref=500, like 500x500 pixels. [replog] Key=C:\admintools\exifsorter\ [adminlog] Key=sorterlog.txt [Repertoire] Key=C:\rep_oltr\perso\images\flickr\Trieur [multiplication] Key=250000 [sizeref] Key=500 [DupliDeep] Key=20 [NbExtense] Key=6 [ext1] Key=jpg [ext2] Key=gif [ext3] Key=bmp [ext4] Key=tif [ext5] Key=jpe [ext6] Key=jpeg
  12. Oh. Yah, euh. I made a code last time, to sort some of my more than 10 000 pics at home. It sorts with the Exif datas, if exist, renaming pics with their original date time. If not, all pics are put in "nonexif" folder. #Include <date.au3> #include <file.au3> #Include <GUIconstants.au3> #include "image_get_info.au3" $replog = IniRead("exifsorter.ini", "replog", "key", "NotFound") $adminlog = IniRead("exifsorter.ini", "adminlog", "key", "NotFound") $defaultfolder = IniRead("exifsorter.ini", "Repertoire", "key", "NotFound") $sortrep = IniRead("exifsorter.ini", "sortrep", "key", "NotFound") $sorted = $sortrep & "\" $namedrep = IniRead("exifsorter.ini", "namedrep", "key", "NotFound") $named = $namedrep & "\" ;$select = FileSelectFolder("Sélection du dossier", "", 2, $defaultfolder) $select = IniRead("exifsorter.ini", "Repertoire", "key", "NotFound") $target = $select & "\" $nb = IniRead("exifsorter.ini", "NbExtense", "key", "NotFound") $deep = IniRead("exifsorter.ini", "DupliDeep", "key", "NotFound") $lastfolder = IniRead("exifsorter.ini", "lastfolder", "key", "NotFound") $finalfolder = $lastfolder & "\" $sNewDate = _DateAdd( 'n',-1, _NowCalc()) TrayTip("'ExifSorter'", "Lancement à " & _NowTime(), 20, 1) $log = FileOpen($replog & $adminlog, 1) FileWrite($log, "==============================================================================" & @CRLF) FileWrite($log, "Lancement d'ExifSorter: ") FileWrite($log, _NowCalcDate() & " " & _DateTimeFormat( _NowCalc(),5) & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileWrite($log, "Fichiers trouvés : " & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileWrite($log, "Nom initial --->>> Date EXIF ou de fichier -> Destination" & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileClose($log) For $i=1 to $nb $look = IniRead("exifsorter.ini", "ext" & $i, "Key", "NotFound") $assembl = "*." & $look $search = FileFindFirstFile($target & $assembl) If $search = -1 Then $log = FileOpen($replog & $adminlog, 1) FileWrite($log, @CRLF & "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF) FileWrite($log, "Aucun fichier '" & $look & "' trouvé dans " & $target & @CRLF) FileWrite($log, "------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF & @CRLF) FileClose($log) Else $log = FileOpen($replog & $adminlog, 1) While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If Not @error Then $aInfo = _ImageGetInfo($target & $file) $datefichier = _ImageGetParam($aInfo, "DateTimeOriginal") $remplace = StringReplace($datefichier, ":", "") $final = StringReplace($remplace, " ", "") $t = FileGetTime($target & $file, 1) $anneemois = $t[0] & $t[1] EndIf If $final > 0 Then FileWrite($log, " " & $file & " --->>> " & $final & "." & $look & " -> " & $sorted & @CRLF) If FileExists($target & $sorted) Then If FileExists($target & $sorted & "\" & $final & "." & $look) Then FileWrite($log, " " & $final & "." & $look & " existe déjà dans " & $sorted & @CRLF) FileWrite($log, " " & $final & "." & $look & " uniquement renommé" & @CRLF & @CRLF) FileMove($target & $file, $target & $final & "." & $look, 8) Else FileMove($target & $file, $target & $sorted & "\" & $final & "." & $look, 8) EndIf Else FileWrite($log, @CRLF & "Création du répertoire : " & $sorted & @CRLF & @CRLF) FileMove($target & $file, $target & $sorted & "\" & $final & "." & $look, 8) EndIf Else $totale = $t[0] & $t[1] & $t[2] & $t[3] & $t[4] & $t[5] FileWrite($log, " " & $file & " --->>> " & $totale & "." & $look & @CRLF) If Not FileExists($target & $named & $totale & "." & $look) Then FileWrite($log, "Essai d'écriture nouveau nom : " & $totale & "." & $look & @CRLF) For $v=1 to $deep $mrplus = ($v+1) If Not FileExists($target & $named & $totale & $mrplus & "." & $look) Then FileMove($target & $file, $target & $named & $totale & $mrplus & "." & $look, 8) ExitLoop EndIf Next EndIf EndIf WEnd FileClose($search) FileClose($log) EndIf Next $log = FileOpen($replog & $adminlog, 1) Sleep(1000) FileMove($target & $sorted & "*.*", $target & $finalfolder & "*.*", 8) FileMove($target & $named & "*.*", $target & $finalfolder & "*.*", 8) FileWrite($log, "==============================================================================" & @CRLF) FileWrite($log, "Fin du traitement" & @CRLF & @CRLF & @CRLF) FileClose($log) MsgBox(4096, "Fin du traitement", "Tous fichiers trouvés triés et déplacés dans " & $finalfolder & @CRLF & @CRLF & "Voilà, voilà...") TrayTip("clears any tray tip","",0) You just need a ini file like this : (all my codes are ina "C:\admintools\" folder. [replog] Key=C:\admintools\exifsorter\ [adminlog] Key=exifsorterlog.txt [adminlogdoublons] Key=DupliCatKillerlog.txt [Repertoire] Key=C:\rep_oltr\perso\images\flickr [sortrep] Key=Exif [namedrep] Key=NonExif [lastfolder] Key=Trieur [DupliDeep] Key=20 [NbExtense] Key=10 [ext1] Key=jpg [ext2] Key=gif [ext3] Key=bmp [ext4] Key=tif [ext5] Key=jpe [ext6] Key=jpeg [ext7] Key=wmv [ext8] Key=avi [ext9] Key=mov [ext10] Key=mpeg
  13. Hello, i tried to find a way to get some Wmi informations, but it doesn't work. i got a code in this forum and upgraded it to become a multiple servers connector. See this. It need 2 files : cfgconst.ini and serverslist.ini. Just creat them before launch the Au3. #include <file.au3> #NoTrayIcon $share = IniRead("cfgconst.ini", "Partage", "key", "NotFound") $user = IniRead("cfgconst.ini", "User", "key", "NotFound") ;$pwd = IniRead("cfgconst.ini", "Pwd", "key", "NotFound") $nb = IniRead("cfgconst.ini", "NbServeurs", "key", "NotFound") $replog = IniRead("cfgconst.ini", "Replogs", "key", "NotFound") If FileExists("cryptage.ini") Then $PASSKEY = "PASSWORD" $M_PASSWORD =IniRead("cryptage.ini","program","password","") $M_PASSWORD = Crypt($PASSKEY,Hex2Str($M_PASSWORD)) Else $PASSKEY = "PASSWORD" $PASSWORD=InputBox("Prompt","Password to register ? : ","","*") $TEMP = Str2Hex(Crypt($PASSKEY,$PASSWORD)) IniWrite("cryptage.ini","program","password",$TEMP) $PASSWORD=InputBox("Prompt","Password again to verify : ","","*") $M_PASSWORD =IniRead("cryptage.ini","program","password","") $M_PASSWORD = Crypt($PASSKEY,Hex2Str($M_PASSWORD)) If $M_PASSWORD == $PASSWORD Then MsgBox(0,'Ok', "Passwords match !") Else MsgBox(16,'Waouw !!!', "Passwords don't match !") FileDelete("cryptage.ini") Exit EndIf EndIf Func Crypt($PASS, $STRG) $A = 1 $N_STRG = "" For $I = 1 To StringLen($STRG) $B = Asc(StringMid($PASS, $A, 1)) $A = $A + 1 If $A > StringLen($PASS) Then $A = 1 $N_STRG = $N_STRG & Chr(BitXOR(Asc(StringMid($STRG, $I, 1)),$B)) Next Return $N_STRG EndFunc Func Str2Hex($STRG) $H = "" For $I = 1 To StringLen($STRG) $H = $H & String(Hex(Asc(StringMid($STRG, $I, 1)),2)) Next Return $H EndFunc Func Hex2Str($H) $STRG = "" For $I = 1 To StringLen($H) Step 2 $STRG = $STRG & Chr(Dec(StringMid($H, $I, 2))) Next Return $STRG EndFunc Opt("RunErrorsFatal", 1) Opt("MustDeclareVars", 1) main() Func main() Local $cmd Local $result Local $msg For $i=1 to $nb Local $serv $serv = IniRead("serverslist.ini", "Server" & $i, "key", "NotFound") Run('net use ' & $serv & $share & ' /USER:' & $user & " " & $M_PASSWORD, @tempDir, @SW_HIDE) $result = RunWait(@ComSpec & " /c " & $cmd, "") If $result <> 0 Then ConsoleWriteError("Erreur : RunWait() returned error code : " & $result & @CRLF) EndIf ConsoleWrite($cmd & @CRLF) Next EndFunc
  14. Hi all, i tried this code and it works well on my workstation. But, in my need, it tried to adapt it to call the uptime from a server and it don't works anyway. By the past i realized some connexions to remote servers and workstations, but not with this code. Do someone have any idea about it ? Thks.
  15. Update of this script. Include the FileSelectFolder. #Include <date.au3> #include <file.au3> #Include <GUIconstants.au3> #include "image_get_info.au3" $replog = IniRead("mediasfinder.ini", "replog", "key", "NotFound") $adminlog = IniRead("mediasfinder.ini", "adminlog", "key", "NotFound") $defaultfolder = IniRead("mediasfinder.ini", "Repertoire", "key", "NotFound") $select = FileSelectFolder("Sélection du dossier", "C:\", $defaultfolder) $target = $select & "\" $nb = IniRead("mediasfinder.ini", "NbLogs", "key", "NotFound") $sNewDate = _DateAdd( 'n',-1, _NowCalc()) $look = IniRead("mediasfinder.ini", "extension", "Key", "NotFound") $log = FileOpen($replog & $adminlog, 2) FileWrite($log, "Lancement : ") FileWrite($log, _NowCalcDate() & " " & _DateTimeFormat( _NowCalc(),5) & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileWrite($log, "Fichiers " & $look & " trouvés : " & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileWrite($log, "Nom initial --->>> Date EXIF ou de fichier -> Destination" & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileClose($log) For $i=1 to $nb $search = FileFindFirstFile($target & $look) If $search = -1 Then $log = FileOpen($replog & $adminlog, 1) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileWrite($log, "Le programme n'a pas trouvé de fichiers dans " & $target & @CRLF) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileClose($log) MsgBox(4096, "Aucun fichier", "Aucun fichier trouvé dans " & $target & @CRLF) Else $log = FileOpen($replog & $adminlog, 1) While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If Not @error Then $aInfo = _ImageGetInfo($target & $file) $datefichier = _ImageGetParam($aInfo, "DateTimeOriginal") $remplace = StringReplace($datefichier, ":", "") $final = StringReplace($remplace, " ", "") $t = FileGetTime($target & $file, 1) $anneemois = $t[0] & $t[1] EndIf If $final > 0 Then FileWrite($log, " " & $file & " --->>> " & $final & ".jpg" & " -> " & $anneemois & @CRLF) If FileExists($target & $anneemois) Then FileMove($target & $file, $target & $anneemois & "\" & $final & ".jpg", 8) Else FileWrite($log, @CRLF & "Création du répertoire : " & $anneemois & @CRLF & @CRLF) FileMove($target & $file, $target & $anneemois & "\" & $final & ".jpg", 8) EndIf Else $totale = $t[0] & $t[1] & $t[2] & $t[3] & $t[4] & $t[5] FileWrite($log, " " & $file & " --->>> " & $totale & ".jpg" & " -> " & $anneemois & @CRLF) If FileExists($target & $anneemois) Then FileMove($target & $file, $target & $anneemois & "\" & $totale & ".jpg", 8) Else FileWrite($log, @CRLF & "Création du répertoire : " & $anneemois & @CRLF & @CRLF) FileMove($target & $file, $target & $anneemois & "\" & $totale & ".jpg", 8) EndIf EndIf WEnd FileClose($search) FileClose($log) EndIf $log = FileOpen($replog & $adminlog, 1) FileWrite($log, "------------------------------------------------------------------------------" & @CRLF) FileWrite($log, "Fin du traitement" & @CRLF & @CRLF & @CRLF) Next MsgBox(4096, "Fin du traitement", "Tous fichiers trouvés déplacés" & @CRLF & @CRLF & "Et si aucun fichier n'avait été trouvé..." & @CRLF & "eh bien keepcool : rien !")
×
×
  • Create New...