Hostage Posted August 2, 2007 Share Posted August 2, 2007 Anybody know of a DLL that will do large decimal to hex conversions? The number I'm trying to convert is an Int64. MS Fax returns a decimal job id when you submit a job to it, but all of the functions you use to check up on it require the number in hex. The built in functions don't work on numbers that large. $faxServer = ObjCreate("FAXCOMEX.FaxServer") $faxDoc = OBjCreate("FAXCOMEX.FaxDocument") $objFaxOutgoingQueue = $FaxServer.Folders.OutgoingQueue $faxServer.Connect("FWPSRV") $frtMail = 0x0001 $faxDoc.Body = @TempDir & "\PO Print.xml" $faxDoc.DocumentName = "Test" $FaxDoc.Recipients.Add ("1515xxxxxxx", "Test Recipient") $FaxDoc.ReceiptType = $frtMAIL $FaxDoc.AttachFaxToReceipt = 1 $FaxDoc.ReceiptAddress = "xxxxx@FletcherWoodProducts.Com" $JobIDArray = $FaxDoc.ConnectedSubmit($FaxServer) $jobId = $jobIdArray[0];job id is in decimal $objFaxOutgoingJob = $objFaxOutgoingQueue.GetJob($jobID);getJob needs a hex input filedelete("test.tiff") $objFaxOutgoingJob.CopyTiff ("Test.tiff") $objFaxOutgoingQueue = "" $faxDoc = "" $faxServer = "" Link to comment Share on other sites More sharing options...
Siao Posted August 2, 2007 Share Posted August 2, 2007 (edited) You can convert that int64 to hex with Binary(), except it will also put the bytes in little endian order, which you don't want, so you'd have to reverse it back with a BinaryMid loop or other method. Edited August 2, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Hostage Posted August 3, 2007 Author Share Posted August 3, 2007 You can convert that int64 to hex with Binary(), except it will also put the bytes in little endian order, which you don't want, so you'd have to reverse it back with a BinaryMid loop or other method.I definitely didn't follow you there... any chance you could provide some example code?If it is possible to write a function in autoIt then that would be great. I figured I'd be stuck calling a function from a DLL. Link to comment Share on other sites More sharing options...
Siao Posted August 3, 2007 Share Posted August 3, 2007 (edited) Something like this: $n = 234654768787882454 $hexstr = Hex(_ByteSwap($n)) MsgBox(0,'','$n = ' & $n & @CR & '$hexstr = ' & $hexstr) Func _ByteSwap($bin) Local $len = BinaryLen($bin) If $len < 5 Then Return Binary(BitRotate(String($bin), 32, "D")) Local $ret = Binary('0x00') For $i = $len To 1 Step -1 $ret &= BinaryMid($bin, $i, 1) Next Return BinaryMid($ret, 2) EndFunc Edited August 3, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Hostage Posted August 3, 2007 Author Share Posted August 3, 2007 That's fantastic, and exactly what I was looking for. Thanks for the help! 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