Jump to content

Large Decimal to Hex and MS Fax


Recommended Posts

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

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 by Siao

"be smart, drink your wine"

Link to comment
Share on other sites

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

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 by Siao

"be smart, drink your wine"

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