Jump to content

read out hex string and find value


jennico
 Share

Recommended Posts

hello,

i have an ini konfiguration file containing only hex data and just want to read out a certain hex value ("00") for "on" and ("01") for "off".

i dont want to change the data i just need the information given from the file for my program to go on.

in a hex editor i determined the position, its hex (214).

how can i now extract this special information bit to go on like this "if Dec($hexvalue )= 0 then.... " in my script.

i have read the informations in fileread, filereadline, dec, hex, and _HexToString nothings solves my problem.

the command "_FileCountLines" gives out the unexpected value of -685 lines, i dont know why theres a minus.

is this possible with autoit ?

thanx in advance

j.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

  • Moderators

hello,

i have an ini konfiguration file containing only hex data and just want to read out a certain hex value ("00") for "on" and ("01") for "off".

i dont want to change the data i just need the information given from the file for my program to go on.

in a hex editor i determined the position, its hex (214).

how can i now extract this special information bit to go on like this "if Dec($hexvalue )= 0 then.... " in my script.

i have read the informations in fileread, filereadline, dec, hex, and _HexToString nothings solves my problem.

the command "_FileCountLines" gives out the unexpected value of -685 lines, i dont know why theres a minus.

is this possible with autoit ?

thanx in advance

j.

Where's Gary's crystal ball when you need it?

Generally ... when someone is having as many issues as you, they make a "small" example script to show the issues, and provide as many comments as possible.

I'll try and take a wild guess to solve your issue.

1. It will work, and you'll go on.

2. It won't, and you'll come back and say it didn't. Then we start the guessing process all over again like a polish sex manual (In out ... repeat only if necessary).

$Guess = BinaryString('0x' & $yourhex)
MsgBox(64, 'Guessing', $Guess)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

okay lets do it...

your script is going in the right direction, but what stands $yourhex for and dont i need the information first which file to open "......ini" ?

sorry, i cant give you any script line because this is a theoretically problem.

ok lets go on .

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

  • Moderators

okay lets do it...

your script is going in the right direction, but what stands $yourhex for and dont i need the information first which file to open "......ini" ?

sorry, i cant give you any script line because this is a theoretically problem.

ok lets go on .

j.

monkeys

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

okay, any one else ?

can autoit read out a certain konfiguration information given in a myfile.ini (the status of the bit is either (00) or (01) and how ?

j.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

ah, u want to see the ini file, now i understand...

okay, here is the file. its a configuration script. everytime the program closes it writes the configuration down into the file, and on restart it can begin with the same values as before.

you have to open it with a hex editor when you want to see the values. the byte 0x214 is the one i want to to read. it changes from hex (00) to hex (01).

its a static file with a fixed size. maybe there is an idea how to read it out ?

j.

Edited by jennico
Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
Share on other sites

ok, here are the two different ini files, the one witn hex 0x214 = 00 and the other one 0x214 = 01.

my code :

#include <file.au3>
#include <string.au3>
$fileopen=FileOpen ( "quick.ini",0 )
$String=FileRead ($fileopen)
MsgBox(64, 'Guessing', StringLen ($String) &@lf& dec ("214") &@lf& hex(StringMid ( $String, dec ("214"),2 )))
Exit

gives out a "0001" for short.ini

and "0000" for quick.ini

could this be the solution ??????

j.

Spoiler

I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.OixB7.jpgDon't forget this IP: 213.251.145.96

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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