Jump to content

Melaperu

Registered Users - Approved
  • Posts

    12
  • Joined

Posts posted by Melaperu

  1. thank you for the code Dan, however I see only point size,

    var base_pointsize = 7; var num_pointsize = 6; return '<span pointsize="' + base_pointsize + '">' + Field("E-mail").replace(/[\d@]+/g, '<span pointsize="' + num_pointsize + '">$&</span>') + '</span>';

    would i add var base_pointcolor? You gave me size which is great but I need it for color. Could i replace the previous return with the one below,

     

    return new_string1.replace(/\./g, '<color name="PANTONE 485 C">.</color>');

    what would my return be then? Sorry for the confusion i hope im asking the right question. The screenshot i sent previously, need to maintain the red color dots/periods between the phone number.

     

    thank you.

  2. ok, is there a specific rule already available that i can edit, i only chose this one because i thought it would work for phone numbers, but you are saying this is only for emails?

     

    text attributes is the functionality for these community nametags, when a property manager logs in to order these tags for their community it will already pull from my data sheet for that specific user.

  3. I think I need to make a rule to keep the points between the phone number digits PANTONE 485 C. Is this correct?

     

    When I upload it to marcom i will set these phone numbers to text attributes so they will pull from the spreadsheet but where in the rule should i add it?

     

    thank you. Screenshot image provided as well.

     

     

    //this function will take content of the E-mail field as an input and format it in such a way
    //that the @ character and any numerals in the email address will be scaled down.
    //the changedChars variable is set to the size of the characters to be scaled down (numerals and @ char.)
    
    //a variable string1 is defined to hold content of the E-mail field.
    string1 = Field("E-mail");
    
    //the following 2 variable values need to be changed to the desired character point sizes
    changedChars_pointsize = 6;
    non_changedChars_pointsize = 7;
    
    //new_string1 will contain the return value
    new_string1 = "";
    
    //create reusable strings that have the <z> tags for point size changes 
    changedChars_pointsize_tag = "<z newsize=" + changedChars_pointsize + ">";
    non_changedChars_pointsize_tag = "<z newsize=" + non_changedChars_pointsize + ">";
    
    //count the characters in the input string
    charCount = string1.length;
    
    //set a flag variable to signify if a looked-for character is encountered.  Set to false initially.
    found_lfc_flag = 0;
    
    //a loop will be used to look at each character, determine if it is a looked-for character, 
    //and decide if a point size tag is required.
    for (x=1; x<=charCount; x++)
    {
       //get a character from the string and its ASCII code
       single_char = Mid(string1, x, 1);
       ascii_code = Asc(single_char);
    
       //if the ASCII code is between 47 and 57, the character is a number
       //if the ASCII code is 64, it is the "@" character
       if ((ascii_code >= 47 && ascii_code <= 57) | ascii_code == 64)
       {
           //At this point in the code, we know that the current char is a looked-for character
           //the found_lfc_flag tracks if the previous char was a number
           //or not.
           if (found_lfc_flag == 0)
           {
               //this code will set the flag to signify that a number was found
               //and also add the tagged markup to the string to change the point size.
               found_lfc_flag = 1;
               new_string1 = new_string1 + changedChars_pointsize_tag;
           }
       }
       else
       {
       //The else condition will execute if the current character is not a looked-for character
       //or if this is the first character in the string.
           if (found_lfc_flag == 1 || x==1)
           {
               found_lfc_flag = 0;
               new_string1 = new_string1 + non_changedChars_pointsize_tag;
           }
       }
    
       //lastly, the character we inspected is added to the string.
       new_string1 = new_string1 + single_char;
    
    }
    
    return new_string1;

    ScreenShot2014-04-29at12_16_26PM.png.fbedabb7a9bb3d1b566d77e71f597291.png

  4. thanks guys, yea i tried using a jpeg BC size 3.5x2 instead and it worked but the quality was not so great, so i tried next best thing, a PDF, and that works just as good as an EPS, but not sure y an eps wouldnt work when that is an option. Ill keep the sizing in mind.
  5. Please see code below, I have used the rule Insert a picture from file based on a database field. I have entered all the eps files by using the pathway, is it too complex maybe? Each person has a different eps background that has a specific address.

     

     

    thank you for your time and help!

     

    Melanie

     

    var Var1 = "Location";
    var Var2 = ".eps";
    var Var3 = "/Volumes/Design/CREATIVE/MARCOM/CDC/Metropolitan Gastroenterology Group/CDC-MGG-DR Folder/CDC-MGG-DR.zip_1";
    var Var4 = "CDC-MGG-DR-BETH.eps";
    
    
    
    temp = '';
    var_extension = ''; 
    has_extension = '';
    
    if (Var3 == "")
    Var3 = Var3;
    else
    {
    if (FusionPro.isMac)
     Var3 = Var3 + ":";
    else
     Var3 = Var3 + "\\";
    }
    
    for (i=0; i<Field(Var1).length; i++)
    {
    temp = Mid(Field(Var1), Field(Var1).length-i,1);
    var_extension = temp + var_extension;
    var_extension = ToLower(var_extension);
    if(var_extension == ".png" || var_extension == ".pdf" || var_extension == ".gif" || var_extension == ".eps" || var_extension == ".tif" || var_extension == ".tiff" || var_extension == ".jpg" || var_extension == ".jpeg")
    { 
     has_extension = "true";
     i=Field(Var1).length;
    }
    else
     has_extension = "false";
    } 
    
    if(has_extension == "true")
    Pic = CreateResource(Var3 + Field(Var1), "graphic", true);
    
    else
    {
    if(Var2 == ".jpg")
    { 
     Pic = CreateResource(Var3 + Field(Var1) + ".jpeg", "graphic", true);
     if (Pic.exists)
      Pic = Pic;
     else
      Pic = CreateResource(Var3 + Field(Var1) + ".jpg", "graphic", true);
    }
    
    
    if(Var2 == ".tif")
    { 
     Pic = CreateResource(Var3 + Field(Var1) + ".tif", "graphic", true);
     if (Pic.exists)
      Pic = Pic;
     else
      Pic = CreateResource(Var3 + Field(Var1) + ".tiff", "graphic", true);
    }
    
    
    if(Var2 == ".png" || Var2 == ".pdf" || Var2 == ".eps" || Var2 == ".gif")
    {
     Pic = CreateResource(Var3 + Field(Var1) + Var2, "graphic", true);
     }
    
    }
    
    if (Pic.exists)
    {
    return Pic;
    }
    
    else
    {
    return CreateResource(Var3 + Var4, "graphic", true);
    }
    

  6. Please see my code below, I am trying to make office, fax, mobile tags smaller, but am unsure of where or what code to add to the tags. Gotham is the font family that needs to be 4pt.

     

    Thank you so much for your help!!!!

     

    Melanie

     

    var greenPMS = "PANTONE 361 C"; // The name of the green color in your template (phone labels)
    
    var grayPMS = "PANTONE 425 C"; // The name of the gray color in your template (numbers)
    
    var phone1 = Field("office"); // Replace with your field name
    
    var phone2 = Field("fax"); // Replace with your field name
    
    var phone3 = Field("mobile"); // Replace with your field name
    
    var label1 = " OFFICE";
    
    var label2 = "FAX";
    
    var label3 = "MOBILE";
    
    
    
    // Array of numbers and labels
    
    var numbers = [[phone1,label1],[phone2,label2],[phone3,label3]];
    
    
    
    // Remove elements that don't have a phone number from the array
    
    numbers = numbers.filter(function(s){return s[0];});
    
    
    
    // Add color tags, format numbers, & add a pipe ( | ) between labels/numbers
    
    for (var i=0; i<numbers.length; i++){
    
       numbers[i][0] = '<color name="'+ grayPMS +'">' + numbers[i][0] + '</color>';
    
       numbers[i][1] = '<f name="Gotham Bold">' + '<color name="'+ greenPMS +'">' + formatPhone(numbers[i][1]) + '</color>' + '</f>';
    
       numbers[i] = numbers[i].join('<color name="'+ grayPMS +'">    </color>');
    
    }
    
    
    
    // Join with a line break
    
    return numbers.join('<color name="'+ greenPMS +'">   I   </color>')
    
    
    
    
    
    
    
    
    
    
    
    //===============================================================
    
    //
    
    // DON'T EDIT BELOW THIS LINE
    
    //
    
    //===============================================================
    
    
    
    
    
    function formatPhone(num){
    
       var Var1 = num;
    
    
    
       var formatStyle01 = "$1.$2"; 			//simple 7 digit phone
    
       var formatStyle02 = "$1.$2.$3";			//simple 10 digit phone
    
       var formatStyle03 = "+$1 $2.$3.$4";		//10 digit phone starts with 1
    
       var formatStyle04 = "$1.$2.$3 x$4";		//10 digit phone with extension
    
       var formatStyle05 = "+$1 $2.$3.$4 x$5";		//10 digit phone starts with 1 with extension
    
       var formatStyle06 = "$1.$2 x$3";			//7 digit phone with extension
    
    
    
       var thisNumber = Var1;
    
    
    
       return formatNumber(Trim(thisNumber));
    
    
    
       function formatNumber(number01){
    
    
    
           var pattern01 = /^(\d{3})[^\d]*(\d{4})$/;   						
    
           var pattern02 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/;   				
    
           var pattern03 = /^\+?(\d{1})[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})$/;   			
    
           var pattern04 = /^[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/;		
    
           var pattern05 = /^\+?(\d{1})[\D]*(\d{3})[\D]*(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/;	
    
           var pattern06 = /^(\d{3})[\D]*(\d{4})\D*[x#n]\D*(\d+)$/;   				
    
           var patternEndExt = /(.)[x#n](.)/;
    
           var patternStart1 = /^[\D]*[1]/;
    
    
    
           if(number01.match(pattern01)){
    
               number01 = number01.replace(pattern01, formatStyle01);
    
               return number01;
    
           } else if(number01.match(pattern02)){
    
               number01 = number01.replace(pattern02, formatStyle02);
    
               return number01;
    
           } else if(number01.match(pattern03)){
    
               if (number01.match(patternStart1)){
    
                   number01 = number01.replace(pattern03, formatStyle03);
    
                   return number01;
    
               } else {
    
                   return number01;
    
               }
    
           } else if(number01.match(pattern04)){
    
                   number01 = number01.replace(pattern04, formatStyle04);
    
                   return number01; 
    
           } else if(number01.match(pattern05)){
    
                   number01 = number01.replace(pattern05, formatStyle05);
    
                   return number01;
    
           }  else if(number01.match(pattern06)){
    
                   number01 = number01.replace(pattern06, formatStyle06);
    
                   return number01;
    
           } else {
    
               return number01;
    
           }	
    
       }
    
    }
    

×
×
  • Create New...