Created
August 30, 2017 14:04
-
-
Save littlebusters/e93e0dc7b6fa5149522487a3cfc17b4e to your computer and use it in GitHub Desktop.
Sketchプラグインにするまでもないけど、たまによく使うスクリプトをRun Scriptから呼び出す ref: http://qiita.com/littlebusters/items/0e6aa1ee1c276044a674
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import '/path/to/script-file.js'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var doc = context.document; | |
var sel = context.selection; | |
var pg = doc.pages(); | |
var cp = doc.currentPage(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function showClassMethods(object) { | |
log(object.class().mocha().classMethods()); | |
} | |
function showInstMethods(object) { | |
log(object.class().mocha().instanceMethods()); | |
} | |
function showMethods(object) { | |
log('Class Methods:'); | |
log(showClassMethods(object)); | |
log('Instance Methods:'); | |
log(showInstMethods(object)); | |
} | |
function showProp(object) { | |
log(object.class().mocha().properties()); | |
} | |
function showDict(object) { | |
log(object.treeAsDictionary()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log('Show Help: utHelp()'); | |
function utHelp() { | |
var output = "doc\nsel\npg\ncp\n" + | |
"showClassMethods(object)\n" + | |
"showInstMethods(object)\n" + | |
"showMethods(object)\n" + | |
"showProp(object)\n" + | |
"showDict(object)\n" + | |
"getMdImagePath()\n"; | |
log(output); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getMdImagePath() { | |
var imagesPath = ''; | |
if (0 < sel.count()) { | |
for (var i = sel.count() - 1; i >= 0; i--) { | |
imagesPath += ' + '.png)' + "\n"; | |
} | |
} | |
log(imagesPath); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment