Sign in to follow this  
Followers 0
arcker

DOS formatted string...

18 posts in this topic

#1 ·  Posted (edited)

hi evry1,

i continue to work on WinPE (no i dont' use BartPE because it's illegal.....grrrrr)

i want to retrieve some dos command

i've worked with randallc on another projects, but the string always contain bad characters when using dos commands

so, do you have any solution ?

to better undersant, when i run :

www.google.com

it ' s sent :

Envoi d'une requte 'ping' sur www.l.google.com [66.249.91.147] avec 32 octets de donnesÿ:


Dlai d'attente de la demande dpass.

Dlai d'attente de la demande dpass.

Dlai d'attente de la demande dpass.

Dlai d'attente de la demande dpass.



Statistiques Ping pour 66.249.91.147:

    Paquetsÿ: envoys = 4, reus = 0, perdus = 4 (perte 100%),

do you see what i mean ?

Oem => Ansi if you prefer

Edited by arcker

-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites



hi evry1,

i continue to work on WinPE (no i dont' use BartPE because it's illegal.....grrrrr)

i want to retrieve some dos command

i've worked with randallc on another projects, but the string always contain bad characters when using dos commands

so, do you have any solution ?

to better undersant, when i run :

www.google.com

it ' s sent :

Envoi d'une requte 'ping' sur www.l.google.com [66.249.91.147] avec 32 octets de donnesÿ:
Dlai d'attente de la demande dpass.

Dlai d'attente de la demande dpass.

Dlai d'attente de la demande dpass.

Dlai d'attente de la demande dpass.
Statistiques Ping pour 66.249.91.147:

    Paquetsÿ: envoys = 4, reus = 0, perdus = 4 (perte 100%),

do you see what i mean ?

Oem => Ansi if you prefer

I don't read French. What's wrong with what you got there, unless you don't read Frech either?

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

no, i mean that the ponctuation is not the same

i know it's in a inherent problem of windows <>ms-dos, but is search for a solution

i'm making an autoUDF to convert the characters, but maybe there is a better solution...


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

ok i've tried this :

http://www.microsoft.com/resources/documen...y.mspx?mfr=true

but does'n change anything, even the dates, so i may be wrong...


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

I'm not sure I fully understand your problem...

Are you trying to browse to www.google.com, or ping www.google.com? If pinging, why not use the AutoIt Ping function?

If the problem is that www.google.com is being replaced by www.l.google.com, this is normal behavior, based on google's dns tables.

Is it that the command prompt is giving unicode output? If so, have you tried CMD /A?

Hope this helps!


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

hi skruge,

i've tried your CMD /A to have a unicode output, but still the same problem

but now i let this project...i will continue to show the dos WIndow as usual


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

Edit.com is used for creating bat\cmd files for non ansi chars. It tends to save the file as strange chars but does apparently work. I do not have 1st hand experience at this (as use english), so maybe I am wrong and it is another CLI that does it.

Share this post


Link to post
Share on other sites

Edit.com is used for creating bat\cmd files for non ansi chars. It tends to save the file as strange chars but does apparently work. I do not have 1st hand experience at this (as use english), so maybe I am wrong and it is another CLI that does it.

Hello, Bonjour ...

OEM to ANSI ?

It's very easy .... c'est simple !!!

Daniel

Func OEM2ANSI($aString)

Local $OEM[256]

$OEM[000]="00"

$OEM[001]="01"

$OEM[002]="02"

$OEM[003]="03"

$OEM[004]="04"

$OEM[005]="05"

$OEM[006]="06"

$OEM[007]="07"

$OEM[008]="08"

$OEM[009]="09"

$OEM[010]="0A"

$OEM[011]="0B"

$OEM[012]="0C"

$OEM[013]="0D"

$OEM[014]="0E"

$OEM[015]="0F"

$OEM[016]="10"

$OEM[017]="11"

$OEM[018]="12"

$OEM[019]="13"

$OEM[020]="14"

$OEM[021]="15"

$OEM[022]="16"

$OEM[023]="17"

$OEM[024]="18"

$OEM[025]="19"

$OEM[026]="1A"

$OEM[027]="1B"

$OEM[028]="1C"

$OEM[029]="1D"

$OEM[030]="1E"

$OEM[031]="1F"

$OEM[032]="20"

$OEM[033]="21"

$OEM[034]="22"

$OEM[035]="23"

$OEM[036]="24"

$OEM[037]="25"

$OEM[038]="26"

$OEM[039]="27"

$OEM[040]="28"

$OEM[041]="29"

$OEM[042]="2A"

$OEM[043]="2B"

$OEM[044]="2C"

$OEM[045]="2D"

$OEM[046]="2E"

$OEM[047]="2F"

$OEM[048]="30"

$OEM[049]="31"

$OEM[050]="32"

$OEM[051]="33"

$OEM[052]="34"

$OEM[053]="35"

$OEM[054]="36"

$OEM[055]="37"

$OEM[056]="38"

$OEM[057]="39"

$OEM[058]="3A"

$OEM[059]="3B"

$OEM[060]="3C"

$OEM[061]="3D"

$OEM[062]="3E"

$OEM[063]="3F"

$OEM[064]="40"

$OEM[065]="41"

$OEM[066]="42"

$OEM[067]="43"

$OEM[068]="44"

$OEM[069]="45"

$OEM[070]="46"

$OEM[071]="47"

$OEM[072]="48"

$OEM[073]="49"

$OEM[074]="4A"

$OEM[075]="4B"

$OEM[076]="4C"

$OEM[077]="4D"

$OEM[078]="4E"

$OEM[079]="4F"

$OEM[080]="50"

$OEM[081]="51"

$OEM[082]="52"

$OEM[083]="53"

$OEM[084]="54"

$OEM[085]="55"

$OEM[086]="56"

$OEM[087]="57"

$OEM[088]="58"

$OEM[089]="59"

$OEM[090]="5A"

$OEM[091]="5B"

$OEM[092]="5C"

$OEM[093]="5D"

$OEM[094]="5E"

$OEM[095]="5F"

$OEM[096]="60"

$OEM[097]="61"

$OEM[098]="62"

$OEM[099]="63"

$OEM[100]="64"

$OEM[101]="65"

$OEM[102]="66"

$OEM[103]="67"

$OEM[104]="68"

$OEM[105]="69"

$OEM[106]="6A"

$OEM[107]="6B"

$OEM[108]="6C"

$OEM[109]="6D"

$OEM[110]="6E"

$OEM[111]="6F"

$OEM[112]="70"

$OEM[113]="71"

$OEM[114]="72"

$OEM[115]="73"

$OEM[116]="74"

$OEM[117]="75"

$OEM[118]="76"

$OEM[119]="77"

$OEM[120]="78"

$OEM[121]="79"

$OEM[122]="7A"

$OEM[123]="7B"

$OEM[124]="7C"

$OEM[125]="7D"

$OEM[126]="7E"

$OEM[127]="7F"

$OEM[128]="C7"

$OEM[129]="FC"

$OEM[130]="E9"

$OEM[131]="E2"

$OEM[132]="E4"

$OEM[133]="E0"

$OEM[134]="E5"

$OEM[135]="E7"

$OEM[136]="EA"

$OEM[137]="EB"

$OEM[138]="E8"

$OEM[139]="EF"

$OEM[140]="EE"

$OEM[141]="EC"

$OEM[142]="C4"

$OEM[143]="C5"

$OEM[144]="C9"

$OEM[145]="E6"

$OEM[146]="C6"

$OEM[147]="F4"

$OEM[148]="F6"

$OEM[149]="F2"

$OEM[150]="FB"

$OEM[151]="F9"

$OEM[152]="FF"

$OEM[153]="D6"

$OEM[154]="DC"

$OEM[155]="F8"

$OEM[156]="A3"

$OEM[157]="D8"

$OEM[158]="D7"

$OEM[159]="83"

$OEM[160]="E1"

$OEM[161]="ED"

$OEM[162]="F3"

$OEM[163]="FA"

$OEM[164]="F1"

$OEM[165]="D1"

$OEM[166]="AA"

$OEM[167]="BA"

$OEM[168]="BF"

$OEM[169]="AE"

$OEM[170]="AC"

$OEM[171]="BD"

$OEM[172]="BC"

$OEM[173]="A1"

$OEM[174]="AB"

$OEM[175]="BB"

$OEM[176]="A6"

$OEM[177]="A6"

$OEM[178]="A6"

$OEM[179]="A6"

$OEM[180]="A6"

$OEM[181]="C1"

$OEM[182]="C2"

$OEM[183]="C0"

$OEM[184]="A9"

$OEM[185]="A6"

$OEM[186]="A6"

$OEM[187]="2B"

$OEM[188]="2B"

$OEM[189]="A2"

$OEM[190]="A5"

$OEM[191]="2B"

$OEM[192]="2B"

$OEM[193]="2D"

$OEM[194]="2D"

$OEM[195]="2B"

$OEM[196]="2D"

$OEM[197]="2B"

$OEM[198]="E3"

$OEM[199]="C3"

$OEM[200]="2B"

$OEM[201]="2B"

$OEM[202]="2D"

$OEM[203]="2D"

$OEM[204]="A6"

$OEM[205]="2D"

$OEM[206]="2B"

$OEM[207]="A4"

$OEM[208]="F0"

$OEM[209]="D0"

$OEM[210]="CA"

$OEM[211]="CB"

$OEM[212]="C8"

$OEM[213]="69"

$OEM[214]="CD"

$OEM[215]="CE"

$OEM[216]="CF"

$OEM[217]="2B"

$OEM[218]="2B"

$OEM[219]="A6"

$OEM[220]="5F"

$OEM[221]="A6"

$OEM[222]="CC"

$OEM[223]="AF"

$OEM[224]="D3"

$OEM[225]="DF"

$OEM[226]="D4"

$OEM[227]="D2"

$OEM[228]="F5"

$OEM[229]="D5"

$OEM[230]="B5"

$OEM[231]="FE"

$OEM[232]="DE"

$OEM[233]="DA"

$OEM[234]="DB"

$OEM[235]="D9"

$OEM[236]="FD"

$OEM[237]="DD"

$OEM[238]="AF"

$OEM[239]="B4"

$OEM[240]="AD"

$OEM[241]="B1"

$OEM[242]="3D"

$OEM[243]="BE"

$OEM[244]="B6"

$OEM[245]="A7"

$OEM[246]="F7"

$OEM[247]="B8"

$OEM[248]="B0"

$OEM[249]="A8"

$OEM[250]="B7"

$OEM[251]="B9"

$OEM[252]="B3"

$OEM[253]="B2"

$OEM[254]="A6"

$OEM[255]="A0"

$anArray = StringSplit($aString,"")

$var = ""

For $i = 1 to $anArray[0]

$var = $var & Chr(dec($OEM[Asc($anArray[$i])]))

Next

return $var

EndFunc

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Wonderful, many thanks, this one did the trick for me, took me some hours to find this solution.

Just to give the forums search-engine some keywords, i'll add a snippet of code and some search-words i used.

$foo = Run(@ComSpec & ' /c ' & 'dir "' & $Temp_Dir & "\*" & $fileextensioncurrent & '" /a :h /b /s', '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
    While 1
        $line = StdoutRead($foo)
        If @error Then ExitLoop
        $array = StringSplit($line, @CR, 1)
        $q = 0
        FOR $filefound IN $array
            if $q > 0 Then
                FileWrite($file, OEM2ANSI($filefound))
            EndIf
            $q = $q + 1
        Next
    Wend
    While 1
        $line = StderrRead($foo)
        If @error Then ExitLoop
;MsgBox(0, "STDERR read:", $line)
    Wend

The trick was to read the stdout, transform it with your function and then write it to the output-file. search-terms i used (maybe wrong, but nevertheless somebody has the same problem and searchs with the same wrong keywords :P ) were msdos, ms-dos, unicode, ansi, codepage, chcp, german special characters (umlaut, umlaute), parse output...

Thanks again :D...

Edited by Polyphem

This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

waou, excellent

i've done the trick by using stringreplace (look in my wmi remote project) for the accent and more

and another thing is to set the police in your edit control to "lucida console"

and you're done


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

That dll-call works like a charm too, thanks a lot :P...


This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post


Link to post
Share on other sites

$currentRead = StdoutRead($ourProcess)
$currentRead = DllCall('user32.dll','Int','OemToChar','str',$currentRead,'str','') ; translate from OEM to ANSI
$currentRead = $currentRead[2]

Look here for more

omg....it's just....too great

thx a lot


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

It's simple, use Search and you will learn a lot of usefull stuff here :P

i always search on the forum before to post, but sometime, we just don't use the good keyword...


-- Arck System _ Soon -- Ideas make everything

"La critique est facile, l'art est difficile"

Projects :

[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list]

Share this post


Link to post
Share on other sites

i always search on the forum before to post, but sometime, we just don't use the good keyword...

I like helping so no problem

but as you can see not only learning AutoIt but also learning how to Search is important :P

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0