var code=prompt("Enter pharm code: ",0);
code=code % 100000;
var txt = code;
x=0;
y=0;
dy=5/0.3514496;
var newCMYKColor = new CMYKColor();
newCMYKColor.cyan = 0;
newCMYKColor.magenta = 0;
newCMYKColor.yellow = 0;
newCMYKColor.black = 100;
while (code>0)
{
if (code & 1)
{
code=(code-1)/2;
dx=0.5/0.3514496;
}
else
{
code=(code-2)/2;
dx=1.5/0.3514496;
}
x=x-dx;
var rect = activeDocument.pathItems.rectangle( y, x, dx, dy );
rect.filled = true;
rect.stroked = false;
rect.fillColor=newCMYKColor;
rect.fillOverprint = true;
x=x-1/0.3514496;
}
var codeText = activeDocument.textFrames.add();
codeText.position = [10 * pt2mm, 0];
codeText.textRange.size = 2.5 * pt2mm;
codeText.contents = txt;