This file contains 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
#target Illustrator | |
// links to classes and methods file | |
// @include lukaszLibrary.jsx; | |
var doc = app.activeDocument, | |
pageItems = doc.layers.getByName("parent").pageItems, | |
CSV = new CSVFile("Sass vars"), | |
inputFolder = Folder.selectDialog(), | |
canvasWidthHeight = [doc.width, doc.height, "", "", "", "Window"], |
This file contains 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 getAllTextItems(){ | |
var doc = app.activeDocument; | |
for(var j = 0; j < doc.textFrames.length; j++){ | |
var currentTextItem = doc.textFrames[j], | |
left = Math.abs(Math.round(currentTextItem.anchor[0])), | |
bottom = Math.round(Math.round(currentTextItem.anchor[1])), | |
font = currentTextItem.textRange.characterAttributes.textFont.name, | |
style = currentTextItem.textRange.characterAttributes.textFont, | |
alignment = currentTextItem.paragraphs[0].paragraphAttributes.justification, | |
fontSize = alignment = currentTextItem.textRange.characterAttributes.size, |
This file contains 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 artBoards = function() { | |
this.value = []; | |
this.topLeft = []; | |
for(var i = 0; i < app.activeDocument.artboards.length; i++) { | |
var artboardLeft = app.activeDocument.artboards[i].artboardRect[0]; | |
var artboardTop = app.activeDocument.artboards[i].artboardRect[1]; | |
var topleft = [artboardLeft, artboardTop]; | |
this.topLeft.push(topLeft); | |
this.value.push(app.activeDocument.artboards[i]); | |
} |
This file contains 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
// constructors and prototypes | |
// can probably ignore this, it definitely works and has been tested | |
function CSVFile(fileName) { | |
this.fileName = fileName; | |
}; | |
CSVFile.prototype.getFilePath = function() { |
This file contains 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
for(var i = 0; i < allParentsOfSymbols.length; i++){ | |
var container = allParentsOfSymbols[i], | |
containerVB = container.visibleBounds, | |
containerLeft = containerVB[0], | |
containerTop = Math.abs(Math.round(containerVB[1])), | |
containerRight = containerVB[2], | |
containerBottom = Math.abs(Math.round(containerVB[3])); | |
print("container: "+containerLeft+", "+containerTop+", "+containerRight+", "+containerBottom); | |
if(textIsIn(temporaryText, container)) { | |
var relativeBottom = containerTop-bottom; |
This file contains 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 getArrayOfItemsWithNameUnder(stringToMatch, parentItemToMatchUnder){ | |
var doc = app.activeDocument, | |
layers = doc.layers, | |
arrayOfMatchedItems = []; | |
for(var i = 0; i < parentItemToMatchUnder.pageItems.length; i++){ | |
var currentItemToSearch = parentItemToMatchUnder.pageItems[i]; | |
if (currentItemToSearch.name.indexOf(stringToMatch.toLowerCase()) != -1 && currentItemToSearch != ""){ | |
print(currentItemToSearch.name); | |
arrayOfMatchedItems.push(currentItemToSearch.name); |
This file contains 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
//chat server | |
// A simple Chat server on port 1234 | |
function chatServer() { | |
var tcp = new Socket; | |
// listen on port 1234 | |
writeln ("Chat server listening on port 1234"); | |
if (tcp.listen (1234)) { | |
for (;;) { | |
// poll for a new connection |
This file contains 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
// @include lukaszLibrary.jsx; | |
/////////////////////// | |
// Turn Increment on/off | |
/////////////////////// | |
var myWindow = new Window('palette', 'Visual Hero tools', undefined, {closeButton: false}); | |
// text to use | |
var myInputGroup = myWindow.add ("group"); |
This file contains 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
// @include lukaszLibrary.jsx; | |
/////////////////////// | |
// Turn Increment on/off | |
/////////////////////// | |
var myWindow = new Window('palette', 'Visual Hero tools', undefined, {closeButton: false}), | |
doc = app.activeDocument, | |
selection = doc.selection; | |
selectionLength = doc.selection.length; |
This file contains 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 myTool(){ | |
// @include lukaszLibrary.jsx; | |
/////////////////////// | |
// Turn Increment on/off | |
/////////////////////// | |
var myWindow = new Window('palette', 'Visual Hero tools', undefined, {closeButton: false}); | |
// text to use |