Skip to content

Instantly share code, notes, and snippets.

View silviu-bucsa's full-sized avatar

Silviu Bucsa silviu-bucsa

View GitHub Profile
// ==========================================================================
// Start Write file to Desktop
// ==========================================================================
$('#QuickRename-Settings').click(function () {
var readFileAgain = window.cep.fs.readFile(filePath);
if (0 == readFileAgain.err) { // If the txt file exists on Desktop, open it
csInterface.evalScript("openTXTFile('" + filePath + "')");
// csInterface.evalScript("alert('Opened existing document...')");
} else {
var sketch = require('sketch')
var UI = require('sketch/ui')
var Page = require('sketch/dom').Page
var Artboard = require('sketch/dom').Artboard
var Group = require('sketch/dom').Group
var Text = require('sketch/dom').Text
var ShapePath = sketch.ShapePath
var document = sketch.getSelectedDocument();
// Create a Group "Rejected + [Date]" at the top of the selected Artboard that contains a
// transparent layer with the text "Rejected"
// --------------------------------------------------------------------------------------------
// Reference Article
// https://medium.com/@kevingutowski/how-to-build-your-first-sketch-plugin-14c0e9e56bf0
// ----------------------------------------------------------------------------------------------------------
var sketch = require('sketch')
var UI = require('sketch/ui')
@silviu-bucsa
silviu-bucsa / gist:790aaa37e878f9ef38e51f67cd0c69c2
Created January 6, 2017 11:52
ExportTextLayerCSS - desired Output
==========================================================
All visible Text Layers from "__Mail Template.psd"
==========================================================
----------------------------
Layer Content:
----------------------------
Dear customer,
Your Bulgaria 500 plan will be canceled starting [billing date] because of new higher prices set by national operators.
You can still call Bulgaria using our Voice Credit product:
==========================================================
All visible Text Layers from "__Mail Template.psd"
==========================================================
----------------------------
Layer Content:
----------------------------
Same great quality,
different rates to
call Country
/*
*
* Export All Text Layers
* 1.1.4
* Pavel Ivanov
* https://github.com/pivanov/photoshop-scripts
* ==========================================================
* Modified by Silviu Bucsa
*
*/
{
"layerText":
{
"textKey": "Dear customer,\r\rYour Bulgaria 500 plan will be canceled starting [billing date] because of new higher prices set by national operators. \rYou can still call Bulgaria using our Voice Credit product:",
"warp":
{
"warpStyle": "warpNone",
"warpValue": 0,
"warpPerspective": 0,
"warpPerspectiveOther": 0,
// Copyright 2012 Adobe Systems Incorporated. All Rights reserved.
// IMPORTANT: This file MUST be written out from ESTK with the option to write the UTF-8
// signature turned ON (Edit > Preferences > Documents > UTF-8 Signature). Otherwise,
// the script fails when run from Photoshop with "JavaScript code was missing" on
// non-English Windows systems.
//
// Extract CSS from the current layer selection and copy it to the clipboard.
//
// This script exports photoshop layers as individual PNGs. It also
// writes a JSON file that can be imported into Spine where the images
// will be displayed in the same positions and draw order.
// Setting defaults.
var writePngs = true;
var writeTemplate = false;
var writeJson = true;
var ignoreHiddenLayers = true;
var pngScale = 1;