On Sep 13, 2008, at 11:27 AM, [EMAIL PROTECTED] wrote:

Is there a script available to convert a seven digit number into a 20 bit binary number. I have a create a barcode based on 20 bit parity. I am not too familiar with binary coding. I understand the math but not how to
apply it in a script.  It is a bit beyond my scripting ability.


You want the binary values as strings "0001" for 1, "0010" for 2,... for *each* digit in a seven digit number right?

If so, you can try something like this:

function binstr(digit)
{
        out = parseFloat(digit).toString(2);
        while (out.length < 4)
                out = '0' + out;
        return out;     
}


function make_binary(digits)
{
        str_digits= digits.toString(10);
        binary = "";
        for (i = 0; i < str_digits.length; i++)
        {
                binary +=  binstr(str_digits[i]);
        }
        return binary;
}


make_binary(1234567) ;

Otherwise, you can modify this script to get what you want.

hth,
Brian Ray




+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
FusionPro 5.0 Now Available!


Variable text on a curve and soft drop-shadows for variable text


LIMITED TIME upgrade offer of $299 per license for current customers:
http://fusionpro.printable.com/store/upgrade

New licenses available for $599 each at:
http://fusionpro.printable.com/store/

All FusionPro 5.0 customers to receive FusionPro 5.1 with
Adobe Acrobat 8 and InDesign CS3 support when released for FREE.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
--
Users of FusionPro Desktop have unlimited free email support. Contact Printable Support at [EMAIL PROTECTED] --
View FusionPro Knowledge Base, FusionPro Samples at
www.printable.com/vdp/desktop.htm

--
You are currently subscribed to fusionpro as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
--


--
Note:  All e-mail sent to or from this address will be received or otherwise 
recorded by the e-mail recipients of this forum. It is subject to archival, 
monitoring or review by, and/or disclosure to someone other than the recipient. 
Our privacy policy is posted on www.printplanet.com
--

Reply via email to