shai Posted June 23, 2011 Share Posted June 23, 2011 i try this code: #include <String.au3> $DefaultProfile = RegRead ( "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" , "DefaultProfile") $xBin = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" & $DefaultProfile & "\0a0d020000000000c000000000000046", "1102044e") $sBinaryToString = BinaryToString(StringRegExpReplace($xBin, '\G(?i)[01][[:xdigit:]]|7f|(..)', '\1')) $sAllPSTsPath = StringTrimLeft($sBinaryToString, StringInStr($sBinaryToString, '\', 0)-3) $sAllPSTsPath = StringReplace ($sAllPSTsPath , "8¡»?¡»+*V?mspst.dllNITA?¿¸?7?n" , @CRLF) $ActivePSTs = _StringExplode($sAllPSTsPath, @CRLF) ConsoleWrite($ActivePSTs[0] & @LF) and it work perfect but if i try run it in computer with hebrew it says in console (for example): C:\Users\horn\Documents\חׁז Outlook\Outlook.pst you can see after "Documents\" unrecognized characters this Unrecognized characters it is hebrew characters. how i can convert the $xBin binary to string with hebrew characters? Link to comment Share on other sites More sharing options...
shai Posted June 24, 2011 Author Share Posted June 24, 2011 anyone? Link to comment Share on other sites More sharing options...
water Posted June 24, 2011 Share Posted June 24, 2011 You could try my OutlookEX UDF (User Defined Functions) and check function _OL_PSTGet. For download please see my signature. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
BrewManNH Posted June 24, 2011 Share Posted June 24, 2011 I believe there's a setting for SciTE that you can use to change the code page of the console window which might help with that. It's called output.code.page and it's in the Sciteglobal.properties settings. Look for the Internationalisation section in that file. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
rover Posted June 24, 2011 Share Posted June 24, 2011 As mentioned by BrewManNH , add output.code.page=65001 to SciTE Global or User Options file Although this code will seem to work without output.code.page=65001, it will fail under certain conditions to write the unicode characters, so you must uncomment output.code.page=65001. uncomment #output.code.page=65001, save the Options file , close, then Restart SciTE. create a new doc in SciTE and set the file menu Encoding option to UTF-8, then paste this code. This example will write a Unicode string to the SciTE Scintilla INSTANCE:2 console. other methods that work are _WinAPI_WideCharToMultiByte() and sending SCI_APPENDTEXT with _SendMessage() directly to the SciTE Scintilla INSTANCE:2 console (useful for sending debugging info from a child script process) ;# -*- coding: utf-8 -*- ;uncomment to use ;The above line is a UTF-8 encoding cookie - It must be on line 1 or 2 of script ;Note: directives added by the AutoIt3Wrapper will move this line further down. ;From the SciTE help file: ;UTF-8 files will also be recognised when they contain a coding cookie on one of the first two lines. ;A coding cookie looks similar to "coding: utf-8" ("coding" followed by ':' or '=', optional whitespace, ;optional quote, "utf-8") and is normally contained in a comment: ;this line borrowed from another forum thread. Local $_str = ">/'קראטוןםפ][שדגכעיחלךף,זסבהנמצתץ.qwertyuiop[]asdfghjkl;'zxcvbnm,./" ConsoleWrite(@CRLF & $_str & @CRLF) _ConsoleWriteU($_str & @CRLF & @CRLF) ConsoleWrite(">C:\Users\horn\Documents\חׁז Outlook\Outlook.pst" & @CRLF) _ConsoleWriteU("C:\Users\horn\Documents\חׁז Outlook\Outlook.pst" & @CRLF & @CRLF) ConsoleWrite(">Αυτό είναι Unicode!" & @CRLF) _ConsoleWriteU("Αυτό είναι Unicode!" & @CRLF) Func _ConsoleWriteU($sText, $sCode = "-") ;from code by Jos in this thread ;get script text in SciTE ;http://www.autoitscript.com/forum/topic/89199-get-script-text-in-scite/page__view__findpost__p__641310 ; Translate text to Binary ;$sText = _WinAPI_WideCharToMultiByte($sText, 65001) $sText = StringToBinary($sText,4);binary data is UTF8 ; Add 00 plus stuffing to have an even number of characters needed for UNICODE $sText &= StringRight("0000",Mod(StringLen($sText),4)+2) ; Translated into ANSI String $sText = BinaryToString($sText, 1) ConsoleWrite($sCode & $sText & @CRLF) EndFunc I see fascists... Link to comment Share on other sites More sharing options...
shai Posted June 25, 2011 Author Share Posted June 25, 2011 You could try my OutlookEX UDF (User Defined Functions) and check function _OL_PSTGet.For download please see my signature.it is elso dont work. see the screanshot Link to comment Share on other sites More sharing options...
shai Posted June 25, 2011 Author Share Posted June 25, 2011 As mentioned by BrewManNH , add output.code.page=65001 to SciTE Global or User Options file Although this code will seem to work without output.code.page=65001, it will fail under certain conditions to write the unicode characters, so you must uncomment output.code.page=65001. uncomment #output.code.page=65001, save the Options file , close, then Restart SciTE. create a new doc in SciTE and set the file menu Encoding option to UTF-8, then paste this code. This example will write a Unicode string to the SciTE Scintilla INSTANCE:2 console. other methods that work are _WinAPI_WideCharToMultiByte() and sending SCI_APPENDTEXT with _SendMessage() directly to the SciTE Scintilla INSTANCE:2 console (useful for sending debugging info from a child script process) ;# -*- coding: utf-8 -*- ;uncomment to use ;The above line is a UTF-8 encoding cookie - It must be on line 1 or 2 of script ;Note: directives added by the AutoIt3Wrapper will move this line further down. ;From the SciTE help file: ;UTF-8 files will also be recognised when they contain a coding cookie on one of the first two lines. ;A coding cookie looks similar to "coding: utf-8" ("coding" followed by ':' or '=', optional whitespace, ;optional quote, "utf-8") and is normally contained in a comment: ;this line borrowed from another forum thread. Local $_str = ">/'קראטוןםפ][שדגכעיחלךף,זסבהנמצתץ.qwertyuiop[]asdfghjkl;'zxcvbnm,./" ConsoleWrite(@CRLF & $_str & @CRLF) _ConsoleWriteU($_str & @CRLF & @CRLF) ConsoleWrite(">C:\Users\horn\Documents\חׁז Outlook\Outlook.pst" & @CRLF) _ConsoleWriteU("C:\Users\horn\Documents\חׁז Outlook\Outlook.pst" & @CRLF & @CRLF) ConsoleWrite(">Αυτό είναι Unicode!" & @CRLF) _ConsoleWriteU("Αυτό είναι Unicode!" & @CRLF) Func _ConsoleWriteU($sText, $sCode = "-") ;from code by Jos in this thread ;get script text in SciTE ;http://www.autoitscript.com/forum/topic/89199-get-script-text-in-scite/page__view__findpost__p__641310 ; Translate text to Binary ;$sText = _WinAPI_WideCharToMultiByte($sText, 65001) $sText = StringToBinary($sText,4);binary data is UTF8 ; Add 00 plus stuffing to have an even number of characters needed for UNICODE $sText &= StringRight("0000",Mod(StringLen($sText),4)+2) ; Translated into ANSI String $sText = BinaryToString($sText, 1) ConsoleWrite($sCode & $sText & @CRLF) EndFunc now i try this but it dosnt work for me this is a result: ConsoleWrite: C:\Users\horn\Documents\蒦٠Outlook\Outlook.pst _ConsoleWriteU -C:\Users\horn\Documents\חׁז Outlook\Outlook.pst Link to comment Share on other sites More sharing options...
jchd Posted June 25, 2011 Share Posted June 25, 2011 Try this: Local $str[10] = [ _ "Sant Julià de Lòria", _ "Skrýchov u Opařan", _ "Žíšov", _ "БОЛЬШОЕ ГРИДИНО", _ "МЫТИЩИ-ДТИ", _ "歴史的仮名遣", _ "変体仮名", _ " فرنسيّ عربيّ", _ "सभी मनुष्यों को गौरव और अधिकारों के मामले में जन्मजात स्वतन्त्रता और समानता प्राप्त है। उन्हें बुद्धि और अन्तरात्मा की देन है और परस्पर उन्हें भाईचारे के भाव से बर्ताव करना चाहिये।", _ "เขาจะได้ไปเที่ยวเมืองลาว" _ ] For $s In $str _ConsoleWrite($s & @LF) Next Func _ConsoleWrite($sString) Local $aResult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", 65001, "dword", 0, "wstr", $sString, "int", -1, _ "ptr", 0, "int", 0, "ptr", 0, "ptr", 0) If @error Then Return SetError(1, @error, 0) Local $tText = DllStructCreate("char[" & $aResult[0] & "]") $aResult = DllCall("Kernel32.dll", "int", "WideCharToMultiByte", "uint", 65001, "dword", 0, "wstr", $sString, "int", -1, _ "ptr", DllStructGetPtr($tText), "int", $aResult[0], "ptr", 0, "ptr", 0) If @error Then Return SetError(2, @error, 0) ConsoleWrite(DllStructGetData($tText, 1)) EndFuncYou need to use a font able to display the Unicode charset range you're interested with. The setting is in Scite just like the Unicode setting. 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...
shai Posted June 25, 2011 Author Share Posted June 25, 2011 i try this: #include <String.au3> $DefaultProfile = RegRead ( "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" , "DefaultProfile") $xBin = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" & $DefaultProfile & "\0a0d020000000000c000000000000046", "1102044e") $sBinaryToString = BinaryToString(StringRegExpReplace($xBin, '\G(?i)[01][[:xdigit:]]|7f|(..)', '\1')) $sAllPSTsPath = StringTrimLeft($sBinaryToString, StringInStr($sBinaryToString, '\', 0)-3) $sAllPSTsPath = StringReplace ($sAllPSTsPath , "8¡»?¡»+*V?mspst.dllNITA?¿¸?7?n" , @CRLF) $ActivePSTs = _StringExplode($sAllPSTsPath, @CRLF) _ConsoleWrite($ActivePSTs[0] & @LF) Func _ConsoleWrite($sString) Local $aResult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", 65001, "dword", 0, "wstr", $sString, "int", -1, _ "ptr", 0, "int", 0, "ptr", 0, "ptr", 0) If @error Then Return SetError(1, @error, 0) Local $tText = DllStructCreate("char[" & $aResult[0] & "]") $aResult = DllCall("Kernel32.dll", "int", "WideCharToMultiByte", "uint", 65001, "dword", 0, "wstr", $sString, "int", -1, _ "ptr", DllStructGetPtr($tText), "int", $aResult[0], "ptr", 0, "ptr", 0) If @error Then Return SetError(2, @error, 0) ConsoleWrite(DllStructGetData($tText, 1)) EndFunc and i get this: C:\Users\horn\Documents\חׁז Outlook\Outlook.pst ConsoleWrite it only for debug. what I really want it open explorer.exe in PST location something like this: $PSTsPath = StringReplace ($ActivePSTs[0] , "Outlook.pst" , "") Run("explorer.exe /e, " & $PSTsPath) by now it wont work because unrecognized characters. Link to comment Share on other sites More sharing options...
jchd Posted June 25, 2011 Share Posted June 25, 2011 Can you post what you get in $xBin "as is"? I don't use Outlook and can't go beyond wild guesses. I'll have a look (my) tomorrow. 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...
shai Posted June 25, 2011 Author Share Posted June 25, 2011 this is my output from $xBin 0x01000000980000000C0000000000000038A1BB1005E5101AA1BB08002B2A56C200006D737073742E646C6C00000000004E495441F9BFB80100AA0037D96E0000000043003A005C00550073006500720073005C0068006F0072006E005C0044006F00630075006D0065006E00740073005C00E705D105E605D90520004F00750074006C006F006F006B005C004F00750074006C006F006F006B002E007000730074000000 thanks. Link to comment Share on other sites More sharing options...
jchd Posted June 26, 2011 Share Posted June 26, 2011 I really don't get what your issue is.This:Local $b = Binary("0x01000000980000000C0000000000000038A1BB1005E5101AA1BB08002B2A56C200006D737073742E646C6C00000000004E495441F9BFB80100AA0037D96E0000000043003A005C00550073006500720073005C0068006F0072006E005C0044006F00630075006D0065006E00740073005C00E705D105E605D90520004F00750074006C006F006F006B005C004F00750074006C006F006F006B002E007000730074000000") _ConsoleWrite(BinaryToString(BinaryMid($b, 67), 2) & @LF)produces the expected result:C:\Users\horn\Documents\קבצי Outlook\Outlook.pstHebrew characters may display badly in Scite and/or message box and/or _ArrayDisplay if the fonts you use don't have them. Note that you'll need to switch Scite and your script encoding to UTF-8 to preserve them if your locale isn't hebrew aware.Beware that this method of extracting a string in the middle of binary data of unknown format is as unreliable as possible. 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...
shai Posted June 26, 2011 Author Share Posted June 26, 2011 ok. thanks jchd. this script work for me: $DefaultProfile = RegRead ( "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" , "DefaultProfile") $xBin = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\" & $DefaultProfile & "\0a0d020000000000c000000000000046", "1102044e") $sBinaryToString = BinaryToString(BinaryMid($xBin, 67), 2) $sBinaryToString = StringRegExpReplace($sBinaryToString, '\G(?i)[01][[:xdigit:]]|7f|(..)', '\1') $sAllPSTsPath = StringTrimLeft($sBinaryToString, StringInStr($sBinaryToString, '\', 0)-3) $sAllPSTsPath = StringReplace ($sAllPSTsPath , "8¡»?¡»+*V?mspst.dllNITA?¿¸?7?n" , @CRLF) $ActivePSTs = _StringExplode($sAllPSTsPath, @CRLF) $PSTsPath = StringReplace ($ActivePSTs[0] , "Outlook.pst" , "") Run("explorer.exe /e, " & $PSTsPath) 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