Jump to content

vaughner

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by vaughner

  1. Thanks notsure, I have just saved a copy of the source of that page for future reference. I hope this topic makes it clear for anyone needing hexToFloat conversions in the future. I even tried to title it so others can search it easily! Personally, I'm turning it into a UDF so I don't have to worry about it again!
  2. Changed to this for my needs. (I'm pulling the data out of a database, and it didn't work your way. :/) #include <WinAPI.au3> ; $aRow's come from a SQLite Query of my DBase Local $X = $aRow[0] ; X Position in space Local $Y = $aRow[1] ; Y Position in space Local $Z = $aRow[2] ; Z Position in space $X = Ptr($X) $Y = Ptr($Y) $Z = Ptr($Z) ConsoleWrite(_WinAPI_IntToFloat('0x' & SwapEndian($X)) & @CRLF) ConsoleWrite(_WinAPI_IntToFloat('0x' & SwapEndian($Y)) & @CRLF) ConsoleWrite(_WinAPI_IntToFloat('0x' & SwapEndian($Z)) & @CRLF) ; Thank trancexx for this baby, http://www.autoitscript.com/forum/index.php?showtopic=103630 Func SwapEndian($iValue) Return Hex(BinaryMid($iValue, 1, 4)) EndFunc Seems when you define your value in the program.. IE: Local $X = 0xf3278343 that $X represents the pointer already? But when you pull the value from an external source, it only contains the value. This forces the pointer to be returned and allows the WinAPI_IntToFloat to proceed properly. Thanks Again!
  3. Alright, I have been banging my head against a wall for days with this one and am finally breaking down and asking for help. Now before anyone asks, I HAVE searched the whole forum, up and down, for information on this problem and one of the answers provided me 'some' help, but I am still at a loss... so without further a do, here we go. Post my ideas came from... I have too convert 3x 4 byte hex values that represent floats. These floats represent a point in three dimensional space, x,y,z coordinates. 0x8D2B33C6 - X Position in space 0x698FC344 - Y Position in space 0xC5524242 - Z Position in space Now they are currently in network byte order, or Big Endian and need to be converted to Little Endian. So then we have this... 0xC6332B8D 0x44C38F69 0x424252C5 - Respectivly... NOTE: The endian converter in the code handles this with the input, so this is just for ease of reading. Now using the following code: #include <String.au3> #Include <WinAPI.au3> $start = "698FC344" $end = hexToFloat($start) MsgBox(0, '', $end) func endian_converter($value) local $byte0 = BitShift($value,24) local $byte1 = BitAND(BitShift($value,-8), 0x00FF0000) local $byte2 = BitAND(BitShift($value,8), 0x0000FF00) local $byte3 = BitShift($value,-24) local $result = BitOR($byte0,$byte1,$byte2,$byte3) return $result endfunc Func hexToFloat($hex) return StringFormat("%f",_WinAPI_IntToFloat(endian_converter(Number("0x" & $hex)))) EndFunc I get "1564.48156738281" which is correct, however when I replace the hex with this "8D2B33C6" i get "-1.#QNAN" (should be -11466.89) About HALF of my computations return this "Quiet Not A Number" and I don't know why. I use another program that does hex/binary/float conversions and they all work out correctly there, why not here? So I guess what I'm asking is why does this not work all the time and why is it returning a QNAN for some of these values? Do I need to create my own HexToFloat32 function? If so, I have run through ALL the wikipedia and google information I can find and still don't understand how to recreate these floats from the hex data. ANY help would be appreciated here! Thanks to anyone who takes the time to read this and especially anyone who responds! ~Vaughner
  4. This is possible, though I think it may be alot more work than you know. You could use "PixelChecksum" to look for a specific area, but it is not very reliable.
  5. Is there always the flickering with this UDF? Seems like the thread has died but I will ask anyways. Thanks!
  6. Man Jack, i've look for hours for that. In over 2 years, this is the first time I couldn't find something. :/ I should have realized that I needed to do the operation as binary, THANKS SO MUCH!!!
  7. Hello all, Been programming with AutoIt for a few years now mostly for work, and have never really posted here. I have always been able to find answers by searching, but I can't find an answer to this though. I am writing a program that downloads files / encrypts files / decrypts files. So I have alot of cases where I am reading or writing alot of data to the disk. I have created another .au3 that is compiled to monitor the transfer progress. IE: Main app runs progbar.exe like this: $runPath = "progbar.exe " & $sourceFile & " " & $destFile Run($runPath) So this launches my progress bar app with command line parameters. If $CmdLine[0] <> 0 Then $sourceFile = $CmdLine[1] $destFile = $CmdLine[2] EndIf The progbar.exe app takes these two file paths and runs FileGetSize on them. It then loops dividing the destination size by the source size and multiplying by 100 to get the percentage of the total file downloaded or processed. The problem is, as soon as the FileCopy starts, the destination file is registered with windows as being full size. I'm assumbing that information is part of a header string for the files or something. (I haven't had any experience with this yet) So as soon as the file download starts, the progress bar shows complete. I'm not sure what to do, as I don't know if there is any way of getting the 'actual' byte size and not what it is going to be when it's done. Any help would be greatly appreciated!! Vaughner AutoIt3 3.3.0.0 SciTE4AutoIt3 Version 1.78
  8. Its been dead for awhile, but thanks for the script. Just what I was looking for.
  9. Very possible, and I think you could do everything you need with AutoIt. Try some stuff out, it's a pretty easy language to learn. If you need help, just post back here. I will be watching this thread.
×
×
  • Create New...