Skip to content

Commit

Permalink
Added SortLayerItems.jsx
Browse files Browse the repository at this point in the history
Sort objects alphabetically inside of a layer
  • Loading branch information
Sergey Osokin committed Aug 29, 2022
1 parent 6a34389 commit 4cc65e5
Show file tree
Hide file tree
Showing 22 changed files with 352 additions and 35 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Click the links to learn more about the scripts in the selected category.
* ResizeOnLargerSide `(upd, 01.08.2022)`
* ResizeToSize `(upd, 01.08.2022)`
* RoundCoordinates `(upd, 01.08.2022)`
* SortLayerItems `(new, 29.08.2022)`

### [Path](md/Path.md)

Expand Down Expand Up @@ -157,7 +158,9 @@ You can support my work on new scripts via [Tinkoff], [ЮMoney], [Donatty], [Don
</a>

## 🗣 Testimonials
* *You are a hero. Thank you for all your hard work improving illustrator so it saves countless hours for people worldwide via your scripts.* - Nitcho
* *I am very thankful for such a nice and useful scripts.
It makes my life easy and more productive* - Rizwan Abuzar
* *You are a hero. Thank you for all your hard work improving illustrator so it saves countless hours for people worldwide via your scripts* - Nitcho
* *Sergey, these scripts of yours are great* — Terry Foxx
* *Wow. I just installed and successfully tested. Outstanding work!!!* — Zak Lay
* *Tried your script to export selected objects to separate Ai, works smartly* — Dmitry
Expand Down
23 changes: 13 additions & 10 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
По ссылкам описание и демонстрация скриптов в каждой категории.

### [Artboard](md/Artboard.ru.md)
Скрипты для создания и управления артбордами.
Скрипты для создания и управления артбордами

* ArtboardsFinder `(upd, 01.08.2022)`
* BatchRenamer `(upd, 03.08.2022)`
Expand All @@ -26,7 +26,7 @@
* RenameArtboardAsTopObj

### [Color](md/Color.ru.md)
Скрипты для работы с цветом объектов.
Скрипты для работы с цветом объектов

* AverageColors `(new, 27.03.2022)`
* ColorBlindSimulator `(new, 18.04.2022)`
Expand All @@ -39,27 +39,27 @@
* StrokeColorFromFill `(upd, 12.01.2022)`

### [Draw](md/Draw.ru.md)
Скрипты, которые что-либо рисуют.
Скрипты, которые что-либо рисуют

* NumeratesPoints `(upd, 01.08.2022)`
* RandomScribble `(upd, 01.08.2022)`

### [Export](md/Export.ru.md)
Скрипты для экспорта документов.
Скрипты для экспорта документов

* Export selection as AI `(upd, 01.08.2022)`
* ExportToDXF `(upd, 01.08.2022)`

### [Group | Mask](md/Group.ru.md)
Скрипты для создания и управления группами, обтравочными масками.
Скрипты для создания и управления группами, обтравочными масками

* CenterClipsToArtboards
* ExtUngroup
* MoveToGroup
* TrimMasks

### [Item](md/Item.ru.md)
Скрипты, управляющие выбранными объектами.
Скрипты, управляющие выбранными объектами

* BatchTrace `(new, 15.08.2022)`
* FitSelectionToArtboards `(upd, 01.08.2022)`
Expand All @@ -71,16 +71,17 @@
* ResizeOnLargerSide `(upd, 01.08.2022)`
* ResizeToSize `(upd, 01.08.2022)`
* RoundCoordinates `(upd, 01.08.2022)`
* SortLayerItems `(new, 29.08.2022)`

### [Path](md/Path.ru.md)
Скрипты, изменяющие пути.
Скрипты, изменяющие пути

* Points Move Random `(upd, 01.08.2022)`
* SplitPath `(upd, 12.06.2022)`
* SubtractTopPath `(new, 03.04.2022)`

### [Select](md/Select.ru.md)
Скрипты для выбора объектов в документе.
Скрипты для выбора объектов в документе

* NamedItemsFinder `(upd, 01.08.2022)`
* SelectAllLayersAbove `(new, 21.02.2022)`
Expand All @@ -91,7 +92,7 @@
* SelectRotatedItems `(new, 22.06.2022)`

### [Style](md/Style.ru.md)
Скрипты, стилизующие объекты.
Скрипты, стилизующие объекты

* ChangeOpacity `(upd, 01.08.2022)`
* GrayscaleToOpacity
Expand All @@ -101,7 +102,7 @@
* StrokesWeightDown `(upd, 01.08.2022)`

### [Utility](md/Utility.ru.md)
Вспомогательные скрипты.
Вспомогательные скрипты

* FileVersionInformer
* ObjectsCounter
Expand Down Expand Up @@ -168,6 +169,8 @@
</a>

## 🗣 Отзывы
* *I am very thankful for such a nice and useful scripts.
It makes my life easy and more productive* - Rizwan Abuzar
* *You are a hero. Thank you for all your hard work improving illustrator so it saves countless hours for people worldwide via your scripts.* - Nitcho
* *Sergey, these scripts of yours are great* — Terry Foxx
* *Wow. I just installed and successfully tested. Outstanding work!!!* — Zak Lay
Expand Down
3 changes: 2 additions & 1 deletion jsx/ArtboardsFinder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function main() {
version: 'v.0.1.1'
},
CFG = {
isMac: /mac/i.test($.os),
defZoom: 0.75, // Zoom ratio in document window
minZoom: 0.1, // Minimal zoom ratio
width: 280, // Units: px
Expand Down Expand Up @@ -96,7 +97,7 @@ function main() {
var squareRb = addRadio(filterPnl, 1, 2, LANG.square);

var userInp = dialog.add('edittext', undefined, LANG.input);
userInp.active = true;
if (CFG.isMac) userInp.active = true;
userInp.preferredSize.width = CFG.width;

// Search results
Expand Down
2 changes: 1 addition & 1 deletion jsx/AverageColors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function invokeUI(title, cfg, cfgFile) {
btns.orientation = 'column';
btns.alignChildren = ['fill', 'center'];

var cancel = btns.add('button', undefined, 'Сancel', { name: 'cancel' });
var cancel = btns.add('button', undefined, 'Cancel', { name: 'cancel' });
var ok = btns.add('button', undefined, 'Ok', { name: 'ok' });

var copyright = dialog.add('statictext', undefined, 'Visit Github');
Expand Down
3 changes: 2 additions & 1 deletion jsx/ConvertToGradient.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function main() {
version: 'v.0.1.2'
},
CFG = {
isMac: /mac/i.test($.os),
uiOpacity: .97 // UI window opacity. Range 0-1
};

Expand Down Expand Up @@ -74,7 +75,7 @@ function main() {
var shiftPanel = dialog.add('panel', undefined, 'Gradient Shift');
shiftPanel.alignChildren = ['fill', 'fill'];
var gShift = shiftPanel.add('edittext', undefined, '10');
gShift.active = true;
if (CFG.isMac) gShift.active = true;
var anglePanel = dialog.add('panel', undefined, 'Gradient Angle');
anglePanel.alignChildren = ['fill', 'fill'];
var gAngle = anglePanel.add('edittext', undefined, '0');
Expand Down
2 changes: 2 additions & 0 deletions jsx/MoveArtboards.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function main() {
},
CFG = {
aiVers: parseInt(app.version),
isMac: /mac/i.test($.os),
units: getUnits(), // Active document units
tmpLyr: 'ARTBOARD_INDEX',
idxColor: [255, 0, 0], // Artboard index color
Expand Down Expand Up @@ -110,6 +111,7 @@ function main() {
abPanel.alignChildren = ['fill','center'];
abPanel.margins = CFG.uiMargins;
var abInput = abPanel.add('edittext', undefined, CFG.abs);
if (CFG.isMac) abInput.active = true;
var abDescr = abPanel.add('statictext', undefined, CFG.allAbs + ' - ' + LANG.placeholder);
abDescr.justify = 'left';

Expand Down
4 changes: 1 addition & 3 deletions jsx/MoveToGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ function main() {

var rbTop = pnlTarget.add('radiobutton', undefined, LANG.top);
var rbBottom = pnlTarget.add('radiobutton', undefined, LANG.bottom);
if ($.os.toLowerCase().indexOf('mac') >= 0) { // For Mac OS user
rbBottom.active = true;
}
if (/mac/i.test($.os)) rbBottom.active = true;
rbBottom.value = true;

var btns = dialog.add('group');
Expand Down
3 changes: 2 additions & 1 deletion jsx/NamedItemsFinder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function main() {
version: 'v.0.2.1'
},
CFG = {
isMac: /mac/i.test($.os),
zoomRatio: 0.1, // Zoom ratio in document window
width: 300, // Units: px
rows: 7, // Amount of rows in listbox
Expand Down Expand Up @@ -105,7 +106,7 @@ function main() {
dialog.opacity = CFG.uiOpacity;

var nameInp = dialog.add('edittext', undefined, LANG.input);
nameInp.active = true;
if (CFG.isMac) nameInp.active = true;

var listbox = dialog.add('listbox', [0, 0, CFG.width, 20 + 21 * CFG.rows], undefined,
{
Expand Down
4 changes: 2 additions & 2 deletions jsx/PointsMoveRandom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function main() {
version: 'v.0.4'
},
CFG = {
isMac: /mac/i.test($.os),
move: 1,
chance: 50,
step: 1.0,
Expand Down Expand Up @@ -105,13 +106,12 @@ function showUI(points, SCRIPT, CFG, SETTINGS, MSG) {

var hFromVal = hRangeGroup.add('edittext', undefined, -1 * CFG.move);
hFromVal.characters = 5;
hFromVal.active = true;

hRangeGroup.add('statictext', undefined, 'to');

var hToVal = hRangeGroup.add('edittext', undefined, CFG.move);
hToVal.characters = 5;
hToVal.active = true;
if (CFG.isMac) hToVal.active = true;

var isHFixed = hRangeGroup.add('checkbox', undefined, 'Fixed H\u0332'); // Unicode underlined H
isHFixed.helpTip = 'Press ' + CFG.modKey + '+H to enable';
Expand Down
3 changes: 2 additions & 1 deletion jsx/RandomScribble.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function main() {
version: 'v.0.1.1'
},
CFG = {
isMac: /mac/i.test($.os),
points: 4, // Default amount of the path points
stroke: 1, // Default stroke width
isClosed: true, // Default closed state of the path
Expand Down Expand Up @@ -94,7 +95,7 @@ function main() {

var pointsTitle = dialog.add('statictext', undefined, LANG.amount);
var pointsLbl = dialog.add('edittext', undefined, CFG.points);
pointsLbl.active = true;
if (CFG.isMac) pointsLbl.active = true;

var tensionTitle = dialog.add('statictext', undefined, LANG.tension);
var tensionGrp = dialog.add('group');
Expand Down
2 changes: 1 addition & 1 deletion jsx/RenameArtboardAsLayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function main() {
// Buttons
var allBtn = dialog.add('button', undefined, 'All');
var currBtn = dialog.add('button', undefined, 'Current', { name: 'ok' });
currBtn.active = true;
if (/mac/i.test($.os)) currBtn.active = true;

allBtn.onClick = function () {
for (var i = 0, len = doc.artboards.length; i < len; i++) {
Expand Down
2 changes: 1 addition & 1 deletion jsx/RenameArtboardAsTopObj.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function main() {
// Buttons
var allBtn = dialog.add('button', undefined, 'All');
var currBtn = dialog.add('button', undefined, 'Current', { name: 'ok' });
currBtn.active = true;
if (/mac/i.test($.os)) currBtn.active = true;

allBtn.onClick = function () {
for (var i = 0, len = doc.artboards.length; i < len; i++) {
Expand Down
10 changes: 7 additions & 3 deletions jsx/RenameItems.jsx
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
1.5 Added placeholders. New UI
1.6 Added renaming of the active artboard.
Saving the name input field when switching options
1.6.1 Fixed UI for Illustrator 26.4.1 on PC
Donate (optional):
If you find this script helpful, you can buy me a coffee
Expand All @@ -43,7 +44,7 @@ app.preferences.setBooleanPreference('ShowExternalJSXWarning', false); // Fix dr
function main() {
var SCRIPT = {
name: 'Rename Items',
version: 'v.1.6'
version: 'v.1.6.1'
},
PH = {
name: '{n}', // Put current name
Expand Down Expand Up @@ -95,7 +96,7 @@ function main() {
nameTitle.text += isMultiSel ? selection.length + ' items to' : 'to';

var nameInp = grpName.add('edittext', undefined, '');
nameInp.active = true;
if (/mac/i.test($.os)) nameInp.active = true;

// Option for Symbol
if (selection.length === 1 && isSymbol(selection[0])) {
Expand Down Expand Up @@ -324,11 +325,14 @@ function main() {

// Draw button
function drawBtn() {
var isBrokenUpd = /26\.4/.test(app.version) && /win/i.test($.os),
ratio = isBrokenUpd ? 1.5 : 2,
y = isBrokenUpd ? -5 : 3;
with(this) {
graphics.drawOSControl();
graphics.rectPath(0, 0, size[0], size[1]);
graphics.strokePath(contour);
if (text) graphics.drawString(text, textPen, (size[0] - graphics.measureString(text, graphics.font, size[0])[0]) / 2, 3, graphics.font);
if (text) graphics.drawString(text, textPen, (size[0] - graphics.measureString(text, graphics.font, size[0])[0]) / ratio, y, graphics.font);
}
}

Expand Down
5 changes: 3 additions & 2 deletions jsx/Rescale.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function main () {
},
CFG = {
aiVers: parseInt(app.version),
isMac: /mac/i.test($.os),
units: getUnits(), // Active document units
size: 1,
scaleCorner: app.preferences.getIntegerPreference('policyForPreservingCorners'),
Expand Down Expand Up @@ -75,7 +76,7 @@ function main () {

var oSizeTxt = oldSizePnl.add ('edittext', undefined);
oSizeTxt.characters = 6;
oSizeTxt.active = true;
if (CFG.isMac) oSizeTxt.active = true;

var newSizePnl = dialog.add('group {alignment: "center"}');
newSizePnl.orientation = 'row';
Expand Down Expand Up @@ -119,7 +120,7 @@ function main () {
if (keyPath.typename === 'PathItem' && !keyPath.closed && keyPath.pathPoints.length == 2) {
var keyPathLength = keyPath.length; // If you use a straight line to measure
oSizeTxt.text = (convertUnits(keyPathLength, 'px', CFG.units)).toFixed(4);
nSizeTxt.active = true;
if (CFG.isMac) nSizeTxt.active = true;
} else {
chkRmv.enabled = false;
chkRmv.value = false;
Expand Down
3 changes: 2 additions & 1 deletion jsx/ResizeToSize.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function main () {
maxSize: 16383, // Illustrator canvas, px
units: getUnits(),
isAiCC: parseInt(version) > 16,
isMac: /mac/i.test($.os),
isInclStroke: preferences.getBooleanPreference('includeStrokeInBounds'),
isScaleCorner: preferences.getIntegerPreference('policyForPreservingCorners'),
isScaleStroke: preferences.getBooleanPreference('scaleLineWeight'),
Expand Down Expand Up @@ -92,7 +93,7 @@ function main () {
sizeGrp.add('statictext', undefined, 'Size, ' + CFG.units + ':');

var sizeInp = sizeGrp.add('edittext', [0, 0, 70, 25], CFG.size);
sizeInp.active = true;
if (CFG.isMac) sizeInp.active = true;

var relGrp = sizeGrp.add('group');

Expand Down
3 changes: 2 additions & 1 deletion jsx/SelectBySwatches.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function main() {
version: 'v.0.2.1'
},
CFG = {
isMac: /mac/i.test($.os),
keyword: '%selswatch%',
actionSet: 'SelBySwatch',
actionName: 'SelectByNote',
Expand Down Expand Up @@ -80,7 +81,7 @@ function main() {
dialog.opacity = CFG.dlgOpacity;

var fillBtn = dialog.add('button', undefined, LANG.fill);
fillBtn.active = true;
if (CFG.isMac) fillBtn.active = true;
fillBtn.helpTip = LANG.hotkeyFill;
var strokeBtn = dialog.add('button', undefined, LANG.stroke);
strokeBtn.helpTip = LANG.hotkeyStroke;
Expand Down
3 changes: 2 additions & 1 deletion jsx/SelectPointsByType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function main() {
},
CFG = {
aiVers: parseInt(app.version),
isMac: /mac/i.test($.os),
minAngle: 0, // Degrees range for the Tolerance
maxAngle: 180, // Degrees range for the Tolerance
cosTolerance: -0.999999, // Correction of coordinate inaccuracy
Expand Down Expand Up @@ -142,7 +143,7 @@ function main() {
var tolValue = tolerance.add('edittext', undefined, '180');
tolValue.characters = 4;
tolValue.helpTip = 'Tolerance angle in degrees\nbetween handles\nfor Corner & Broken points';
tolValue.active = true;
if (CFG.isMac) tolValue.active = true;

var isShowBox = dialog.add('checkbox', undefined, 'Hide Bounding Box');
isShowBox.value = !app.preferences.getBooleanPreference('showBoundingBox');
Expand Down
Loading

0 comments on commit 4cc65e5

Please sign in to comment.