Jump to content

Create a QR MEcard


sandigcustomprinters.com

Recommended Posts

I've never done this before in FusionPro8

Typically I create Vcard's via online sources - I do not see the option to create Vcards in FP8.

 

I see the helper rule for QR Contact Information - MeCard

Problem is that not all the fields I need are included.

And some of the information I need is static (not entered by a variable)

 

I need the variables Name, Cell, Phone and Email

I need the static information for website and address and fax

 

I pasted the helper rule from FP8 and inserted some comments.

 

var NameFieldOrRule = "Name";

var PhoneFieldOrRule = "direct";

var EmailFieldOrRule = "email";

var WebsiteFieldOrRule = ""; //HELP! I need to input static information here for website. website.com

var AddressFieldOrRule = "";//HELP! I need to input static information here.for address

var BirthdayFieldOrRule = ""; // dont want

var NoteFieldOrRule = "";// dont want

//HELP how do I include a cell phone number?

//HELP how do I include a fax number?

var PointSize = "";

 

// MECARD format

// http://www.nttdocomo.co.jp/english/service/imode/make/content/barcode/function/application/addressbook

// Also see: http://code.google.com/p/zxing/wiki/BarcodeContents

 

var info = {

N: FieldOrRule(NameFieldOrRule),

TEL: OptionalFieldOrRule(PhoneFieldOrRule).replace(/\D/g,''),

EMAIL: OptionalFieldOrRule(EmailFieldOrRule),

URL: OptionalFieldOrRule(WebsiteFieldOrRule),

ADR: OptionalFieldOrRule(AddressFieldOrRule),

BDAY: OptionalFieldOrRule(BirthdayFieldOrRule),

NOTE: OptionalFieldOrRule(NoteFieldOrRule),

}

 

var result = "";

for (var label in info)

{

if (!info[label])

continue;

 

result += label;

if (!label.match(/\:$/))

result += ":";

 

result += info[label];

 

result += FusionPro.inValidation ? '\r' : ';';

}

 

if (FusionPro.inValidation)

return result;

 

var QR = new QRBarcode;

QR.pointSize = Int(PointSize) || 10;

return QR.Make("MECARD:" + result + ";");

Link to comment
Share on other sites

Thank you Dan.

I think I prefer the Vcard and have modified the code to this point.

And will continue working from there.

I will repost if I have further questions.

Thanks again.

 

 

var NameRuleOrField = "Name";

var CompanyRuleOrField = "";

var PhoneRuleOrField = "direct";

var CellRuleOrField = "cell";

var EmailRuleOrField = Rule("RULE_emailsuffix");

var WebsiteRuleOrField = "";

var AddressRuleOrField = "";

 

 

// vCard format

// http://en.wikipedia.org/wiki/VCard

// Note that support for vCard may be more limited than for MECARD,

// and that vCard requires more data to be encoded, resulting in a denser barcode.

 

var info = {

N: RuleOrField(NameRuleOrField),

"ORG;COMPANY": "Company Name",

"TEL;WORK;VOICE": OptionalRuleOrField(PhoneRuleOrField).replace(/\D/g,''),

"TEL;CELL;MOBILE": OptionalRuleOrField(CellRuleOrField).replace(/\D/g,''),

EMAIL: EmailRuleOrField,

"URL;WEB": "http://companywebsite.com",

ADR: "2801 Oak Industrial Drive NE, Grand Rapids MI 49505",

 

}

 

var result = ["BEGIN:VCARD", "VERSION:2.1"];

for (var label in info)

{

if (info[label])

result.push(label + ":" + info[label]);

}

result.push("END:VCARD");

 

return MakeQRBarcodeGraphic(result.join(Chr(13) + Chr(10)));

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...