Modify

Opened 16 years ago

Closed 16 years ago

Last modified 7 years ago

#1512 closed Bug (No Bug)

StdoutRead no correct output with german language OS

Reported by: Emiel Wieldraaijer Owned by:
Milestone: Component: AutoIt
Version: 3.3.4.0 Severity: None
Keywords: StdoutRead Cc:

Description

Hi,

StdoutRead does not produce the correct output
I've an image with the correct output.

Console Output =

"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "Z:\Proggen\CheckDisk\chktest.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams

+>13:39:42 Starting AutoIt3Wrapper v.2.0.0.3 Environment(Language:0409 Keyboard:00020409 OS:WIN_VISTA/ CPU:X64 OS:X64)

Running AU3Check (1.54.19.0) from:C:\Program Files (x86)\AutoIt3

+>13:39:42 AU3Check ended.rc:0

Running:(3.3.4.0):C:\Program Files (x86)\AutoIt3\autoit3.exe "Z:\Proggen\CheckDisk\chktest.au3"

3240
C:\Windows\system32\cmd.exe /c chkdsk c:
StdoutRead: Zugriff verweigert, das Sie nicht ber ausreichende Berechtigungen verfgen.
Sie mssen dieses Programm mit erh”hten Rechten ausfhren.

+>13:39:43 AutoIT3.exe ended.rc:0
+>13:39:44 AutoIt3Wrapper Finished

Exit code: 0 Time: 1.866

[code example] (not mine)
#include <Constants.au3>
Local $foo, $cmd
Local $line
$cmd = @ComSpec & " /c chkdsk c:"
$foo = Run($cmd, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

dbg($foo)
dbg($cmd)
While 1

$line = StdoutRead($foo)
If $line<>"" Then

dbg("StdoutRead: " & $line)

EndIf
If Not ProcessExists($foo) Then

ExitLoop

EndIf

Wend

Exit

Func dbg($msg, $error=@error, $extended=@extended, $ScriptLineNumber=@ScriptLineNumber)

Local $out = "(" & $ScriptLineNumber & ")(" & $error & ")(" & $extended & ") := " & $msg
ConsoleWrite($msg & @CRLF)
DllCall("kernel32.dll", "none", "OutputDebugString", "str", $out)

EndFunc

Thanks

Emiel

Attachments (1)

Correct.jpg (76.4 KB ) - added by ewieldra 16 years ago.

Download all attachments as: .zip

Change History (6)

by ewieldra, 16 years ago

Attachment: Correct.jpg added

comment:1 by doudou, 16 years ago

It's nothing to do with StdoutRead(): chkdsk and many other command line utilities shipped with Windows use traditionally OEM charset, while AutoIt (as primarily GUI app) uses ANSI or corr. Windows codepage.

You have to apply a charset conversion before using OEM strings in AutoIt, something like:

$ret = DllCall("user32.dll", "BOOL", "OemToCharW", "wstr", $line, "wstr", "")
If $ret[0] Then $line = $ret[2]

comment:2 by J-Paul Mesnage, 16 years ago

Resolution: No Bug
Status: newclosed

Thanks Doudou for helping Just a small typo

$ret = DllCall("user32.dll", "BOOL", "OemToCharW", "str", $line, "wstr", "")

comment:3 by Emiel Wieldraaijer, 16 years ago

Thanks,

I thought it was another unicode problem

comment:4 by anonymous, 7 years ago

$ret = DllCall("user32.dll", "BOOL", "OemToCharW", "str", $line, "wstr", "")

Didn't work with Vietnamese. Any idea ?

in reply to:  4 comment:5 by Jos, 7 years ago

Replying to anonymous:

$ret = DllCall("user32.dll", "BOOL", "OemToCharW", "str", $line, "wstr", "")

Didn't work with Vietnamese. Any idea ?

This is not a place to ask questions, please use our forum for that.

Jos

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.