Sign in to follow this  
Followers 0
Shafayat

Read, Search, Copy & Save Binary Data from file

7 posts in this topic

Hello guys

I'm again here to beg for help. Here is a simple flow chart of what I need to achieve.

I've a BINARY file: (e.g. $file = "C:\my.bin" )

I need to read total data in a variable (e.g. $totaldatafrmfile) (as HEX value)

Then, I've two String Values which need to be converted to HEX value. ($strv1 and $strv2 to $hexofstrv1 and $hexofstrv2)

Now, I need the position of the second occurrence of $hexofstrv1 in $totaldatafrmfile (probably with StringInStr) And the 1st occurrence of $hexofstrv2

Next, I need to copy the binary data from $totaldatafrmfile that is within $hexofstrv1 to $hexofstrv2 + Lenght of $hexofstrv2 and save to a new binary file. (e.g. C:\Cropped.bin)

Please help me out. If possible give the complete code. Error handling (in case StringInStr returns 0) not required.

Regards

Shafayat


[Not using this account any more. Using "iShafayet" instead]

Share this post


Link to post
Share on other sites



Can't someone help me?


[Not using this account any more. Using "iShafayet" instead]

Share this post


Link to post
Share on other sites

Can't someone help me?

Can you show something you have tried so far even if it fails, and give a sample file to read?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Here goes the my work. (The binary file (main.bin) is RARed because of upload extension restriction). I need to write the Blocked Part (in the attached image) to a new file.

BinTest.au3

post-23819-1223920582_thumb.jpg

Main.rar


[Not using this account any more. Using "iShafayet" instead]

Share this post


Link to post
Share on other sites

No one helped, eh. Well... I really like this forum.

Regards

Shafayat


[Not using this account any more. Using "iShafayet" instead]

Share this post


Link to post
Share on other sites

I bet, thats not the truth.

They knew I could succeed myself if I try for two hours (and I did so) :P

Regards

Shafayat


[Not using this account any more. Using "iShafayet" instead]

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