Sign in to follow this  
Followers 0
Nymphetamine

Bytes/File structure reading/ Editing in Autoit

8 posts in this topic

Hi all

I am wondering if in autoit it's possible to get the structure of a file, choose a byte and edit it directly from the autoit program. Maybe with a GUI and a box 

If for example i want to take the 4th byte of a file, is that possible to turn this 4th byte in a box and edit it easily?

Share this post


Link to post
Share on other sites



I believe it is possible, yes.

But i guess it's advanced scripting, not something that a newbie can do right :P 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

you should read help on this commands:

FileOpen

FileSetPos

FileGetPos

FileRead

p.s.

search for "Hex editor"  in autoit advanced search for some examples

edit:

>here a very simple example to use that commands

Edited by PincoPanco

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

you should read help on this commands:

FileOpen

FileSetPos

FileGetPos

FileRead

p.s.

search for "Hex editor"  in autoit advanced search for some examples

edit:

>here a very simple example to use that commands

This can really help me,i'll look into it

Isn't there an example script about it?

I need to make a tool which reads a byte of a file, then i want to transfer this byte in a box and edit it manually.

Edited by Nymphetamine

Share this post


Link to post
Share on other sites

This can really help me,i'll look into it

Isn't there an example script about it?

I need to make a tool which reads a byte of a file, then i want to transfer this byte in a box and edit it manually.

 

If you're talking about binary data you'll have to also use binarytostring() and binary() on the data before/after editing.

Share this post


Link to post
Share on other sites

This can really help me,i'll look into it

Isn't there an example script about it?

I need to make a tool which reads a byte of a file, then i want to transfer this byte in a box and edit it manually.

 

An very minimalist example to read 4° byte from any file

$File = FileOpenDialog('Please choose file', '', 'All files (*.*)', 1)

$myfile = FileOpen($File, 16) ; open file in binary mode

Local $x = 3 ; we will read 4° byte first byte is nr.0 (0 based)

FileSetPos($myfile, $x, 0) ; position "cursor" to byte nr $x

$byte = FileRead($myfile, 1) ; read 1 byte (and autoincrement position)

MsgBox(0, "", "Value of byte in position " & $x & " is " & $byte)

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

 

An very minimalist example to read 4° byte from any file

$File = FileOpenDialog('Please choose file', '', 'All files (*.*)', 1)

$myfile = FileOpen($File, 16) ; open file in binary mode

Local $x = 3 ; we will read 4° byte first byte is nr.0 (0 based)

FileSetPos($myfile, $x, 0) ; position "cursor" to byte nr $x

$byte = FileRead($myfile, 1) ; read 1 byte (and autoincrement position)

MsgBox(0, "", "Value of byte in position " & $x & " is " & $byte)

And how can i put the number of this 4th value in a box and edit it?

I would like to make a GUI window with some boxes to read a byte and make it editable from it. And then save the file with the edited byte

Edited by Nymphetamine

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