Pablos544 Posted April 8, 2017 Share Posted April 8, 2017 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 More sharing options...
Moderators Melba23 Posted April 8, 2017 Moderators Share Posted April 8, 2017 Pablos544, Use BinaryToString on the value read from the file: #include <MsgBoxConstants.au3> $sValue = "0x38202020" $iValue = BinaryToString($sValue) MsgBox($MB_SYSTEMMODAL, "Result", $iValue) M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Pablos544 Posted April 8, 2017 Author Share Posted April 8, 2017 1 hour ago, Melba23 said: Pablos544, Use BinaryToString on the value read from the file: #include <MsgBoxConstants.au3> $sValue = "0x38202020" $iValue = BinaryToString($sValue) MsgBox($MB_SYSTEMMODAL, "Result", $iValue) M23 so that's what all those BinaryXXX functions were!! DOH!! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 8, 2017 Moderators Share Posted April 8, 2017 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Pablos544 Posted April 10, 2017 Author Share Posted April 10, 2017 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 More sharing options...
Pablos544 Posted April 13, 2017 Author Share Posted April 13, 2017 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 Cheers, Pablo. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now