2

Existe-t-il des scripts de calendrier/Photoshop pouvant générer automatiquement un numéro de date similaire à cette image d'icône de calendrier?Générateur de calendrier d'icônes

enter image description here

J'ai besoin icône similaire avec la date (1,2,3..31) et le nom de chaque mois, mais au format .png. Je ne peux pas utiliser html/css3 et jquery pour créer une icône.

Merci pour les réponses et l'aide

+2

Utilisez une image de fond et écrivez le mois et la date en haut ... – planetmaker

Répondre

1

Oui, c'est possible. J'aime un défi :)

D'abord avec l'image modèle dossier ouvert enter image description here Second créer un dossier C: \ temp \ calendrier (ou modifier le chemin de destination dans le script)

Exécuter le script ci-dessous et » ll générer des dates définies avec sdate & eDate (début & date de fin) - actuellement Novembre 30 à 01 Décembre

// Load in background image before running script 

// call the source document 
var srcDoc = app.activeDocument; 

var sDate = new Date("November, 30, 2016 00:00:00"); 
var eDate = new Date("January, 01, 2017 00:00:00"); 

var myPath = "c:\\temp\\calendar" 

printDate(sDate, eDate, myPath, srcDoc); 

//----------------------------- 
function printDate(start, end, apath, sauce) 
{ 
    if (start == undefined) return; 
    if (end == undefined) return; 

    // set long month names 
    var monthNames = ["January", "February", "March", "April", "May", "June", 
    "July", "August", "September", "October", "November", "December" 
    ]; 

    str = ""; 

    // main loop here 
    while(start <= end) 
    { 

    // Display the month, day, and year. 
    // getMonth() returns a 0-based number. 
    var monthNum = start.getMonth()+1; 
    var month = monthNames[monthNum-1].toUpperCase(); 
    var day = start.getDate(); 
    var year = start.getFullYear(); 

    // alert(month + " " + day + " " + year); 

    // num padding 
    if (monthNum < 10) monthNum = "0" + monthNum; 
    if (day < 10) day = "0" + day; 

    var theDate = "cal_" + monthNum + "_" + day + "_" + year; 

    duplicateIt(theDate); 

    var day = start.getDate(); 
    str = (day);   

    var newDate = start.setDate(start.getDate() + 1); 

    // fontface, size, R,G,B, text, X, Y 
    // print bigmonth 
    createText("Arial-BoldMT", 38.0,255, 255, 255, month, 582, 460); 

    // print big day 
    createText("Arial-BoldMT", 176.0, 0, 0, 0, day, 582, 1144); 

    var f = apath + "\\" + theDate + ".png"; 

    // alert(f) 
    saveAsPNG(f, 10); 

    // close that saved png 
    app.activeDocument.close(); 

    // get the original source doc 
    app.activeDocument = sauce; 

    // reset start 
    start = new Date(newDate); 
    } 
} 

// function DUPLICATE IT (str) 
// -------------------------------------------------------- 
function duplicateIt(str) 
{ 
    // duplicate image into new document 
    if (arguments.length == 0) str = "temp"; 

    var id428 = charIDToTypeID("Dplc"); 
    var desc92 = new ActionDescriptor(); 
    var id429 = charIDToTypeID("null"); 
    var ref27 = new ActionReference(); 
    var id430 = charIDToTypeID("Dcmn"); 
    var id431 = charIDToTypeID("Ordn"); 
    var id432 = charIDToTypeID("Frst"); 
    ref27.putEnumerated(id430, id431, id432); 
    desc92.putReference(id429, ref27); 
    var id433 = charIDToTypeID("Nm "); 
    desc92.putString(id433, str); // name 
    executeAction(id428, desc92, DialogModes.NO); 
} 

// function SAVE JPEG(file name & path) 
// -------------------------------------------------------- 
function saveAsPNG(afilePath) 
{ 
    // flatten it 
    activeDocument.flatten(); 

    // save as a png 
    var pngFile = new File(afilePath); 
    pngSaveOptions = new PNGSaveOptions(); 
    pngSaveOptions.embedColorProfile = true; 
    pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE; 
    pngSaveOptions.matte = MatteType.NONE; pngSaveOptions.quality = 1; 

    activeDocument.saveAs(pngFile, pngSaveOptions, false, Extension.LOWERCASE); 
} 

// function CREATE TEXT(typeface, size, R, G, B, content, Xpos, Ypos, justify) 
// -------------------------------------------------------- 
function createText(fface, size, colR, colG, colB, content, X, Y) 
{ 

    // Add a new layer in the new document 
    var artLayerRef = app.activeDocument.artLayers.add() 

    // Specify that the layer is a text layer 
    artLayerRef.kind = LayerKind.TEXT; 
    artLayerRef.name = content; 

    //This section defines the color of the text 
    textColor = new SolidColor(); 
    textColor.rgb.red = colR; 
    textColor.rgb.green = colG; 
    textColor.rgb.blue = colB; 

    //Get a reference to the text item so 
    // that we can add the text and format it a bit 
    textItemRef = artLayerRef.textItem 
    textItemRef.font = fface; 
    textItemRef.contents = content; 
    textItemRef.color = textColor; 
    textItemRef.size = size; 
    //pixels from the left, pixels from the top 
    textItemRef.position = new Array(X, Y) 

    just = Justification.CENTER; 

    activeDocument.activeLayer.textItem.justification = just; 
} 

Il est de les enregistrer sous forme de fichiers .PNG nommés après la date. enter image description here