daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Feb 10th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sketch from 'sketch'
  2. // documentation: https://developer.sketchapp.com/reference/api/
  3.  
  4. export default function() {
  5.   // sketch.UI.message("It's alive 🙌")
  6.  
  7.   const doc = sketch.getSelectedDocument()
  8.   const selectedLayers = doc.selectedLayers
  9.   const layerArr = selectedLayers.layers;
  10.   const selectedCount = selectedLayers.length
  11.   const LABEL = doc.getLayersNamed("LABEL")
  12.   var msg =""
  13.   var count = 0
  14.  
  15.   if (selectedCount === 0) {
  16.     sketch.UI.alert("oh boy", 'No layers are selected.')
  17.   } else {
  18.  
  19.     /*
  20.     // sketch.UI.message(layerArr[4].name)
  21.     selectedLayers.forEach(function(item){
  22.       msg = msg + ++count + "-" + item.name + "\n"
  23.     })
  24.     // if (LABEL) {
  25.     //   sketch.UI.message(LABEL[0].layerID)
  26.     // }*/
  27.  
  28.    sketch.UI.getInputFromUser(
  29.     "What's your name?",
  30.     {
  31.         initialValue: 'Appleseed',
  32.       },
  33.     (err, value) => {
  34.       if (err) {
  35.         // most likely the user canceled the input
  36.         return
  37.       }
  38.     }
  39.   )
  40.  
  41.   }
  42.   sketch.UI.message(msg)
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top