Rawox Posted August 28, 2010 Share Posted August 28, 2010 Ok, So I wrote the function displayed beneath and call it with: ConsoleWrite ( $n & ". " & GUICtrlRead ( $Folder2 ) & "\" & $FileArray[$n] & @TAB & "===>" & @TAB & GUICtrlRead ( $Folder3 ) & "\" & _convertFileName ( $FileArray[$n], GUICtrlRead ( $Folder2 ) ) & @CRLF )Func _convertFileName ( $FName, $FDir ) $CurrentFile = $FDir & "\" & $FName _PathSplit ( $CurrentFile, $szDrive, $szDir, $szFName, $szExt ) $Time = FileGetTime ( $CurrentFile, 1 ) If @error = 1 Then Msgbox ( 0,0,1 ) $NewFileName = GUICtrlRead ( $FileNames ) & $szExt $NewFileName = StringReplace ( $NewFileName, ":Y:", $Time[0] ) $NewFileName = StringReplace ( $NewFileName, ":M:", $Time[1] ) $NewFileName = StringReplace ( $NewFileName, ":D:", $Time[2] ) $NewFileName = StringReplace ( $NewFileName, ":h:", $Time[3] ) $NewFileName = StringReplace ( $NewFileName, ":m:", $Time[4] ) $NewFileName = StringReplace ( $NewFileName, ":s:", $Time[5] ) Return $NewFileName EndFuncFor the file 'Aqua Space.jpg' which I use for testing with some other files I get this returned:1. C:\ScriptTemp\Input1\IMG_0413.JPG ===> C:\ScriptTemp\Output\Vakantie Kroatië 2010-03-22 [12:03].JPG 2. C:\ScriptTemp\Input1\IMG_0417.JPG ===> C:\ScriptTemp\Output\Vakantie Kroatië 2010-03-22 [12:03].JPG 3. C:\ScriptTemp\Input1\Port.jpg ===> C:\ScriptTemp\Output\Vakantie Kroatië 2010-08-28 [14:08].jpg 4. C:\ScriptTemp\Input1\Serenity.jpg ===> C:\ScriptTemp\Output\Vakantie Kroatië 2010-08-28 [14:08].jpg 5. C:\ScriptTemp\Input2\1680x1050.jpg ===> C:\ScriptTemp\Output\Vakantie Kroatië 2010-08-28 [14:08].jpg [b]6. C:\ScriptTemp\Input2\Aqua Space.jpg ===> C:\ScriptTemp\Output\Vakantie Kroatië 2010-08-28 [14:08].jpg[/b] 7. C:\ScriptTemp\Input2\IMG_0480.JPG ===> C:\ScriptTemp\Output\Vakantie Kroatië 2010-03-22 [12:03].JPG 8. C:\ScriptTemp\Input2\IMG_0526.JPG ===> C:\ScriptTemp\Output\Vakantie Kroatië 2010-03-22 [12:03].JPG 9. C:\ScriptTemp\Input2\IMG_0527.JPG ===> C:\ScriptTemp\Output\Vakantie Kroatië 2010-03-22 [12:03].JPG 10. C:\ScriptTemp\Input2\Huge Metal Fan.gif ===> C:\ScriptTemp\Output\Vakantie Kroatië 2010-08-28 [14:08].gifWhich is wierd because the information displayed by Windows (7 64Bit) is attached and is not the same.And I don't really need the creation date I need the date a photograph was taken on (Those can be different and I really need to get the 'taken' date )Does anyone know why these values are not the same?Thanks in advance, RawoxP.S. The script moves images and changes the name to a tag and the date the picture was taken.Translations:Genomen op = Taken on <== I need that one Aanmaakdatum = Created on Gewijzigd op = Modified on Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 28, 2010 Moderators Share Posted August 28, 2010 Rawox,To get the "date taken", try reading the file properties like this: expandcollapse popup$sFile = FileOpenDialog("Choose Photo", "Your_Path\", "Images(*.jpg)") ConsoleWrite(_GetDate($sFile) & @CRLF) Func _GetDate($sPassed_File_Name) Local $iError = 0 Local $sDir_Name = StringRegExpReplace($sPassed_File_Name, "(^.*\\)(.*)", "\1") Local $sFile_Name = StringRegExpReplace($sPassed_File_Name, "^.*\\", "") Local $sDOS_Dir = FileGetShortName($sDir_Name, 1) Local $oShellApp = ObjCreate("shell.application") If IsObj($oShellApp) Then Local $oDir = $oShellApp.NameSpace($sDOS_Dir) If IsObj($oDir) Then Local $oFile = $oDir.Parsename($sFile_Name) If IsObj($oFile) Then If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_7" Then Return $oDir.GetDetailsOf($oFile, 12) ; Date Taken EndIf Else $iError = 3 EndIf Else $iError = 2 EndIf Else $iError = 1 EndIf If $iError > 0 Then Local $sMsg = "Could not read File Properties" & @CRLF & @CRLF & _ $iError & @CRLF & @CRLF & $sPassed_File_Name MsgBox(0, "Error", $sMsg) EndIf EndFuncYou have some work to do on the returned value, but that should not pose a too big a problem. I hope this helps. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 28, 2010 Share Posted August 28, 2010 (edited) Why are you using FileGetTime? It only returns: [optional] Flag to indicate which timestamp 0 = Modified (default) 1 = Created 2 = AccessedNot EXIF. So how to read EXIF then? Lazycat made a UDF for that, LINK. _GetExtProperty should also work (like Melba23 posted). The value for WinXP (I think Win2K had the same as XP) seems to be 25 or/and 31 (same thing but different formats). [25]|2010-08-03 17:22 [31]|2010:08:03 17:22:38 Edited August 28, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Rawox Posted August 29, 2010 Author Share Posted August 29, 2010 Thank you very much, both Melba and AdmiralAlkex! I thought the 'created date' was the same as the 'taken date' but it wasn't. With these examples I can finish my script! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now