dikart7 Posted March 10, 2017 Share Posted March 10, 2017 Hello my friends Sorry about my English , Why are not replaced any character to "é" #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection(False) $var = StringReplace("connect,",",","é") ; this worked MsgBox(0,"",$var) $stdoutRead = StringReplace(_CmdResult('netsh mbn show interface'),",","é") ;why not replaced MsgBox(0,"",$stdoutRead) Func _CmdResult($Commands) Local $Message Local $DOS = Run(@ComSpec & " /c "& $Commands , "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS) $Message = StdoutRead($DOS) Return $Message EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted March 10, 2017 Developers Share Posted March 10, 2017 3 minutes ago, dikart7 said: Why are not replaced any character to "é" Any character or do you mean a COMMA as that is what you have defined in the StringReplace() command? Jos dikart7 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
dikart7 Posted March 10, 2017 Author Share Posted March 10, 2017 The problem with the character é Link to comment Share on other sites More sharing options...
Developers Jos Posted March 10, 2017 Developers Share Posted March 10, 2017 Sorry, but that doesn't answer my question. what exactly are you trying to accomplish? what is the exact content of the STDOUT #include <WinAPIFiles.au3> $stdoutRead = _CmdResult('netsh mbn show interface') ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $stdoutRead = ' & $stdoutRead & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $stdoutRead = StringReplace($stdoutRead, ",", "é") ;why not replaced ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $stdoutRead = ' & $stdoutRead & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console MsgBox(0, "", $stdoutRead) Func _CmdResult($Commands) Local $Message Local $DOS = Run(@ComSpec & " /c " & $Commands, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($DOS) $Message = StdoutRead($DOS) Return $Message EndFunc ;==>_CmdResult Jos dikart7 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
dikart7 Posted March 10, 2017 Author Share Posted March 10, 2017 @@ Debug(4) : $stdoutRead = Le systŠme dispose d'une interfaceÿ: Nom : Connexion haut d‚bit mobile 13 Description : HUAWEI Mobile Connect - 3G Network Card GUID : {DD2C1976-A1DC-43F4-845F-67C6244A4CAA} Adresse physique : 00:1e:10:1f:79:c9 tat : pas connect‚ Type d'appareil : L'appareil haut d‚bit mobile est amovible. Classe cellulaire : CDMA ID de l'appareil : 802b9a56 Fabricant : HUAWEI TECHNOLOGIES CO. ModŠle : EC156 Version de micrologiciel : 11.106.33.00.000 Nom de fournisseur : CDMA Itin‚rance : pas d'itin‚rance Signal : 70% >Error code: 0 @@ Debug(6) : $stdoutRead = Le systŠme dispose d'une interfaceÿ: Nom : Connexion haut d‚bit mobile 13 Description : HUAWEI Mobile Connect - 3G Network Card GUID : {DD2C1976-A1DC-43F4-845F-67C6244A4CAA} Adresse physique : 00:1e:10:1f:79:c9 tat : pas connect‚ Type d'appareil : L'appareil haut d‚bit mobile est amovible. Classe cellulaire : CDMA ID de l'appareil : 802b9a56 Fabricant : HUAWEI TECHNOLOGIES CO. ModŠle : EC156 Version de micrologiciel : 11.106.33.00.000 Nom de fournisseur : CDMA Itin‚rance : pas d'itin‚rance Signal : 70% Link to comment Share on other sites More sharing options...
dikart7 Posted March 10, 2017 Author Share Posted March 10, 2017 Just bring Mobile Broadband information Link to comment Share on other sites More sharing options...
Developers Jos Posted March 10, 2017 Developers Share Posted March 10, 2017 This has everything to do with character encoding. I have attached the same script with 2 different StringReplace() statements. the first doesn't work and the second works and that is because the first one has an ASCII COMMA and the second an UTF8 COMMA. Give it a try. Jos test.au3 dikart7 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
dikart7 Posted March 10, 2017 Author Share Posted March 10, 2017 You're a genius brother, thank you so much for your help Link to comment Share on other sites More sharing options...
dikart7 Posted March 10, 2017 Author Share Posted March 10, 2017 Jos another problem I can't copy Comma Link to comment Share on other sites More sharing options...
Developers Jos Posted March 10, 2017 Developers Share Posted March 10, 2017 No idea what that means. what exactly do you mean or want to do? Jos dikart7 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
dikart7 Posted March 10, 2017 Author Share Posted March 10, 2017 How do you write a UTF8 COMMA Link to comment Share on other sites More sharing options...
Developers Jos Posted March 10, 2017 Developers Share Posted March 10, 2017 It actually looks like it is an ASCII highvalue character and not a UTF character. This character has an ASCII 130 value so this should work: $stdoutRead = StringReplace($stdoutRead, chr(130), "é") ;why not replaced Jos dikart7 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
dikart7 Posted March 10, 2017 Author Share Posted March 10, 2017 Thanks again my friend jos Link to comment Share on other sites More sharing options...
jguinch Posted March 10, 2017 Share Posted March 10, 2017 It should work fine with this : #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPid = Run(@ComSpec & " /c netsh mbn show interface", @SystemDir, "", $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($iPid) Local $sResult = StdoutRead($iPid) MsgBox(0, "", _OEMToAnsi($sResult) ) Func _OEMToAnsi($sOEM) Local $a_AnsiFName = DllCall('user32.dll', 'Int', 'OemToChar', 'str', $sOEM, 'str', '') If @error = 0 Then $sAnsi = $a_AnsiFName[2] Return $sAnsi EndFunc ;==>_OEMToAnsi dikart7 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
dikart7 Posted March 11, 2017 Author Share Posted March 11, 2017 On 10/03/2017 at 3:00 PM, jguinch said: It should work fine with this : #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection(False) Local $iPid = Run(@ComSpec & " /c netsh mbn show interface", @SystemDir, "", $STDERR_CHILD + $STDOUT_CHILD) ProcessWaitClose($iPid) Local $sResult = StdoutRead($iPid) MsgBox(0, "", _OEMToAnsi($sResult) ) Func _OEMToAnsi($sOEM) Local $a_AnsiFName = DllCall('user32.dll', 'Int', 'OemToChar', 'str', $sOEM, 'str', '') If @error = 0 Then $sAnsi = $a_AnsiFName[2] Return $sAnsi EndFunc ;==>_OEMToAnsi Thank you. 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