gcue Posted May 20, 2015 Share Posted May 20, 2015 (edited) hello.i am using Melba's script to pull file information. The returned data shows question marks only in a consolewrite but not in a msgbox so when I was debugging was getting wrong results. (Note: to get a value back you have to chose an actual photo image that would have date taken field populated)expandcollapse popup$sFile = FileOpenDialog("Choose Photo", "Your_Path\", "Images(*.jpg)") ConsoleWrite(_GetDate($sFile) & @CRLF) MsgBox(0,"",_GetDate($sFile)) 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 $date = $oDir.GetDetailsOf($oFile, 12) ; Date Taken return $date 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 EndFuncconsolewrite?7/?10/?2012 ??5:55 AMmsgbox (same variable):7/10/2012 5:55 AMi try doing a stringreplace to get rid of the "?" but it doesn't workany thoughts?thanks in advance! Edited May 20, 2015 by gcue Link to comment Share on other sites More sharing options...
Tekk Posted May 20, 2015 Share Posted May 20, 2015 This should clear it up.$sDate = _GetDate($sFile) $sDate = StringRegExpReplace($sDate, "(\x{200E}|\x{200F})", "")They are RLM (Right-to-Left Mark) & LRM (Left-to-Right Mark) characters. Link to comment Share on other sites More sharing options...
gcue Posted May 20, 2015 Author Share Posted May 20, 2015 awesome thank youuu!!!any idea what they are there for? wonder why the stringreplace didnt work? are they not question marks? Link to comment Share on other sites More sharing options...
jchd Posted May 20, 2015 Share Posted May 20, 2015 No, ConsoleWrite convert the Unicode string to ANSI (let's call it that name) and ANSI doesn't have these characters, so they get converted (destroyed to) question marks. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
iamtheky Posted May 20, 2015 Share Posted May 20, 2015 stringtoasciiarray always helps me with garbage text, because my regex is weakexpandcollapse popup#include<array.au3> $sFile = FileOpenDialog("Choose Photo", "Your_Path\", "Images(*.jpg)") $sDate = _GetDate($sFile) $aAsc = StringToASCIIArray($sDate) for $i = ubound($aAsc) - 1 to 0 step -1 If $aAsc[$i] = "8206" then _ArrayDelete($aAsc , $i) Next for $i = 0 to ubound($aAsc) - 1 $aAsc[$i] = Chr($aAsc[$i]) Next $sFrmt = _ArrayToString($aAsc , "") consolewrite($sFrmt & @CRLF) msgbox(0, '' , $sFrmt) 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 $date = $oDir.GetDetailsOf($oFile, 12) ; Date Taken return $date 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 EndFunc ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
gcue Posted May 20, 2015 Author Share Posted May 20, 2015 thanks for the info guys 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