Jump to content

Recommended Posts

Posted (edited)

I need to do this fast.

So fair iv not even got to finish it cause it takes to long.

I know il find a way soon enuff.

Heres my code.

O yea its not 40 mb its 4 mb but it still takes while.

$i=0
    $files = FileOpen($location&$file, 0)
; Check if file opened for reading OK
If $files = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in 1 character at a time until the EOF is reached
While 1
    $i=$i+1
    ToolTip("Bytes: "&$i)
    $chars = FileRead($files,1)
    If @error = -1 Then ExitLoop
    $hex=Asc ( $chars )
    If $out<>"" Then
    $out=$out&" "&$hex
    EndIf
    If $out="" Then
    $out=$hex
EndIf
Wend
MsgBox(0,0,$out)
FileClose($files)
Edited by kcd-clan
Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone()
Posted (edited)

FileRead the whole File

StringSplit with a '' parameter in delimiters parameter

Hex it, and store it as a string with &=

Edit: This will take long, no matter what. Only i think my way is the fastest way of doing this..

Edited by Manadar
Posted (edited)

Try opening it in raw mode (4) and then doing FileRead() with no extra paramters. This will load the whole file in one command which is faster than byte by byte

Edit: curses...my post was foiled agian :D

Edited by evilertoaster
Posted

That is when one is unabled or too lazy too open the helpfile to look up FileOpen.

When using the mode=4 (Raw Read) the filename is defined as "\\.\A:" for reading sector on a floppy disk the count must be a multiple of sector size(512).

I still don't know what it is though.. :D
Posted (edited)

You need the beta verion of autoit i think for raw mode. When you have it, use file open with a 4 as the second parameter.

Edit: also what raw mode does is read direct hex from the file so you won't have to manually convert it later

Edited by evilertoaster
Posted (edited)

$path=FileOpenDialog("Choose a file",@ScriptDir,"All (*.*)")
$File=FileOpen($path,4)
$read=FileRead($file,FileGetSize($path))
;MsgBox(0,"",String($read))
MsgBox(0,"",StringReplace(String($read),"0x",""))

This will load a whole file and show it's hex string in a message box. Uncomment the first msgbox if you want the "0x" hex identifier to be there also

Edit: BTW there's no error checking on this so dont do anything foolish :D

Edited by evilertoaster
Posted

I may be misunderstanding what you want.

This will read the raw Hex data from a file (for instance if you opened it in a hex editor) if you use this on a .txt file i dont see what the point is but it should still work (i've now tried this on 3 computers).

Is this not want you want?

Posted

no

I am geting alot of problems with this il probly ahve to write it all and define all hex values.

When im reading hex in autoit it comes to a number when hex go from 0-f and autoit dose 0-9 because a declerations

If i have to i can get it cause i have the way to read it and know the number on autoit of the hex code.

Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone()
Posted

When im reading hex in autoit it comes to a number when hex go from 0-f and autoit dose 0-9 because a declerations

If i have to i can get it cause i have the way to read it and know the number on autoit of the hex code.

I can't really tell what you're talking about...anyone want to translate?

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...