Jump to content

Help! I'm trying to read sequence of chars with number


Recommended Posts

Hi All,

I was wondering if you could help me

Besically I'm reading in a file

it contains a 4-char ASCII field with a number "8   "......

I want to convert that 8 in ASCII to an AutoIt variable so I can do other tests

So far I've got

$IDcomputer = FileRead($file, 4)
MsgBox(4096,$sAppName,"i can confirm IDcomputer is " & $IDcomputer)

which outputs 

     "I can confirm IDcomputer is 0x38202020"

what am I supposed to make AutoIt take this 4-byte char field as such instead of this integer 0x38202020?

Thanks in advance!

:)

Pablo.

 

Link to comment
Share on other sites

  • Moderators

Pablos544,

Use BinaryToString on the value read from the file:

#include <MsgBoxConstants.au3>

$sValue = "0x38202020"

$iValue = BinaryToString($sValue)

MsgBox($MB_SYSTEMMODAL, "Result", $iValue)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Pablos544,

Those functions are not often needed - but they are very handy when they are!

But when you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - I know what I wrote and it just pads the thread unnecessarily.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Ok it was not clear to me how to reply without quoting!!  I agree it adds noise to the topic and ideally what you want is to see the discussion.  I did not really want to quote your comment of course you knew what it was.  But of course from now on I will reply straight out that is no problem.  Thanks for the help.

Pablo

Link to comment
Share on other sites

Hi Melba23,

And may I take this opportunity to wish you and your family a lovely Easter Weekend.

I am really thankful for all the help I've received in this forum.  Specially this

Binary Variant / FileRead

I still can't work out AutoIt's use of Binary Variant instead of string.

If you hand't helped me I think I'd have been finished there :sweating:

Cheers,

Pablo.

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...