Skip to content

Commit

Permalink
add toggleAlignToGlyphBounds.js, toggleShowHandles.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sky-chaser-high committed Oct 8, 2023
1 parent ca51a2c commit 1f62610
Show file tree
Hide file tree
Showing 6 changed files with 296 additions and 6 deletions.
46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you find a script that interests you, please download it from [![Download](ht
- [Export Color Values to CSV](#exportColorValuesToCSVjs)
- [Extract Colors from Gradient](#extractColorsFromGradientjs)
- [Generate Gradient Color](#generateGradientColorjs)
- [Highlight Word](#highlightWordjs) `Update`
- [Highlight Word](#highlightWordjs)
- [Import CSV to Swatch](#importCSVtoSwatchjs)
- [Match Location of Gradient Stop](#matchLocationOfGradientStopjs)
- [Random Text Color](#randomTextColorjs)
Expand Down Expand Up @@ -104,8 +104,8 @@ If you find a script that interests you, please download it from [![Download](ht
- [Justify Content Space Between](#justifyContentSpaceBetweenjs)
- [Move Line Down](#moveLineDownjsmoveLineUpjs)
- [Move Line Up](#moveLineDownjsmoveLineUpjs)
- [Split Text](#splitTextjs) `New`
- [Split Text at Cursor Position](#splitTextAtCursorPositionjs) `New`
- [Split Text](#splitTextjs)
- [Split Text at Cursor Position](#splitTextAtCursorPositionjs)
- [Swap Text Contents](#swapTextContentsjs)
- [Text Align Center](#textAlign_CenterjstextAlign_LeftjstextAlign_Rightjs)
- [Text Align Left](#textAlign_CenterjstextAlign_LeftjstextAlign_Rightjs)
Expand All @@ -120,6 +120,8 @@ If you find a script that interests you, please download it from [![Download](ht
- [Measure Distance](#measureDistancejs)
- [Sum Numbers](#sumNumbersjs)
- [Sync View](#syncViewjs)
- [Toggle Align to Glyph Bounds](#toggleAlignToGlyphBoundsjs) `New`
- [Toggle Show Handles](#toggleShowHandlesjs) `New`
<br><br><br>


Expand Down Expand Up @@ -2081,6 +2083,44 @@ Illustrator CS or higher



# <a name="toggleAlignToGlyphBoundsjs">toggleAlignToGlyphBounds.js</a>
[![Download Utility.zip](https://img.shields.io/badge/Download-Utility.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Utility.zip)
This script toggles the Align panel menu > Align to Glyph Bounds > Point Text and Area Text.

![Toggle Align To Glyph Bounds](images/toggleAlignToGlyphBounds.png)

### Usage
Just run this script.

### Requirements
Illustrator 2020 or higher

<div align="right">[ <a href="#utility">↑ Back to Top ↑</a> ]</div>
<br>





# <a name="toggleShowHandlesjs">toggleShowHandles.js</a>
[![Download Utility.zip](https://img.shields.io/badge/Download-Utility.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Utility.zip)
This script toggles the Preferences > Selection & Anchor Display > Anchor Points, Handle, and Bounding Box Display > Show handles when multiple anchors are selected.

![Toggle Show Handles](images/toggleShowHandles.png)

### Usage
Just run this script.

### Requirements
Illustrator CC or higher

<div align="right">[ <a href="#utility">↑ Back to Top ↑</a> ]</div>
<br>





# <a name="unifyLayerColorsjs">unifyLayerColors.js</a>
[![Download Layer.zip](https://img.shields.io/badge/Download-Layer.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Layer.zip)
This script unifies layer colors.
Expand Down
46 changes: 43 additions & 3 deletions README_ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Adobe Illustratorのスクリプト集です。
| [exportColorValuesToCSV.js](#exportColorValuesToCSVjs) | カラー数値をCSVファイルに保存 |
| [extractColorsFromGradient.js](#extractColorsFromGradientjs) | グラデーションのカラー分岐点から色を取り出す |
| [generateGradientColor.js](#generateGradientColorjs) | グラデーションを生成 |
| [highlightWord.js](#highlightWordjs) `Update` | 指定した単語の塗り色を変更 |
| [highlightWord.js](#highlightWordjs) | 指定した単語の塗り色を変更 |
| [importCSVtoSwatch.js](#importCSVtoSwatchjs) | CSVファイルを読み込む |
| [matchLocationOfGradientStop.js](#matchLocationOfGradientStopjs) | グラデーションのカラー分岐点、中間点の位置を同期 |
| [randomTextColor.js](#randomTextColorjs) | テキストの塗り色をランダムに変更 |
Expand Down Expand Up @@ -124,8 +124,8 @@ Adobe Illustratorのスクリプト集です。
| [justifyContentSpaceBetween.js](#justifyContentSpaceBetweenjs) | テキスト両端揃え |
| [moveLineDown.js](#moveLineDownjsmoveLineUpjs) | 行を下へ移動 |
| [moveLineUp.js](#moveLineDownjsmoveLineUpjs) | 行を上へ移動 |
| [splitText.js](#splitTextjs) `New` | 文字列を分割 |
| [splitTextAtCursorPosition.js](#splitTextAtCursorPositionjs) `New` | 文字列をカーソルの位置で分割 |
| [splitText.js](#splitTextjs) | 文字列を分割 |
| [splitTextAtCursorPosition.js](#splitTextAtCursorPositionjs) | 文字列をカーソルの位置で分割 |
| [swapTextContents.js](#swapTextContentsjs) | 文字列を交換 |
| [textAlign_Center.js](#textAlign_CenterjstextAlign_LeftjstextAlign_Rightjs) | 文字列の位置を動かさずに中央揃え |
| [textAlign_Left.js](#textAlign_CenterjstextAlign_LeftjstextAlign_Rightjs) | 文字列の位置を動かさずに左揃え |
Expand All @@ -144,6 +144,8 @@ Adobe Illustratorのスクリプト集です。
| [measureDistance.js](#measureDistancejs) | 距離を測る |
| [sumNumbers.js](#sumNumbersjs) | 文字列内の数字を足す |
| [syncView.js](#syncViewjs) | ウィンドウの表示を同期 |
| [toggleAlignToGlyphBounds.js](#toggleAlignToGlyphBoundsjs) `New` | 字形の境界に整列を切り替える |
| [toggleShowHandles.js](#toggleShowHandlesjs) `New` | 選択した複数のアンカーポイントのハンドルを表示/隠すを切り替える |

<br><br>

Expand Down Expand Up @@ -2150,6 +2152,44 @@ Illustrator CS以降



# <a name="toggleAlignToGlyphBoundsjs">toggleAlignToGlyphBounds.js</a>
[![Download Utility.zip](https://img.shields.io/badge/Download-Utility.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Utility.zip)
整列パネル > 字形の境界に整列 > ポイント文字、エリア内文字の両方を同時にオンオフ切り替えます。

![Toggle Align To Glyph Bounds](images/toggleAlignToGlyphBounds.png)

#### 使用方法
このスクリプトを実行するだけです。

#### 動作条件
Illustrator 2020以降

<div align="right">[ <a href="#ユーティリティ">↑ トップへ戻る ↑</a> ]</div>
<br>





# <a name="toggleShowHandlesjs">toggleShowHandles.js</a>
[![Download Utility.zip](https://img.shields.io/badge/Download-Utility.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Utility.zip)
環境設定 > 選択範囲・アンカー表示 > アンカーポイント、ハンドル、およびバウンディングボックスの表示 > 複数アンカーポイントを選択時にハンドルを表示をオンオフ切り替えます。

![Toggle Show Handles](images/toggleShowHandles.png)

#### 使用方法
このスクリプトを実行するだけです。

#### 動作条件
Illustrator CC以降

<div align="right">[ <a href="#ユーティリティ">↑ トップへ戻る ↑</a> ]</div>
<br>





# <a name="unifyLayerColorsjs">unifyLayerColors.js</a>
[![Download Layer.zip](https://img.shields.io/badge/Download-Layer.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Layer.zip)
レイヤーカラーを統一します。
Expand Down
Binary file added images/toggleAlignToGlyphBounds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/toggleShowHandles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions scripts/toggleAlignToGlyphBounds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/* ===============================================================================================================================================
toggleAlignToGlyphBounds
Description
This script toggles the Align panel menu > Align to Glyph Bounds > Point Text and Area Text.
Usage
Just run this script from File > Scripts > Other Script...
Notes
In rare cases, the script may not work if you continue to use it.
In this case, restart Illustrator and try again.
Requirements
Illustrator 2020 or higher
Version
1.0.0
Homepage
github.com/sky-chaser-high/adobe-illustrator-scripts
License
Released under the MIT license.
https://opensource.org/licenses/mit-license.php
=============================================================================================================================================== */

(function() {
if (app.documents.length && isValidVersion()) main();
})();


function main() {
var pref = app.preferences;
var glyph = pref.getBooleanPreference('EnableActualTextSpaceAlign');
pref.setBooleanPreference('EnableActualTextSpaceAlign', !glyph);
pref.setBooleanPreference('EnableActualAreaTextSpaceAlign', !glyph);
showDialog(glyph);
}


function isValidVersion() {
var cc2020 = 24.3;
var aiVersion = parseFloat(app.version);
if (aiVersion < cc2020) return false;
return true;
}


function showDialog(glyph) {
$.localize = true;
var ui = localizeUI();

var dialog = new Window('dialog');
dialog.text = ui.title;
dialog.preferredSize.width = 260;
dialog.orientation = 'column';
dialog.alignChildren = ['fill', 'top'];
dialog.spacing = 10;
dialog.margins = 16;

var group1 = dialog.add('group', undefined, { name: 'group1' });
group1.orientation = 'row';
group1.alignChildren = ['center', 'center'];
group1.spacing = 10;
group1.margins = 20;

var statictext1 = group1.add('statictext', undefined, undefined, { name: 'statictext1' });
statictext1.text = glyph ? ui.off : ui.on;

var group2 = dialog.add('group', undefined, { name: 'group2' });
group2.orientation = 'row';
group2.alignChildren = ['center', 'center'];
group2.spacing = 10;
group2.margins = 0;

var button1 = group2.add('button', undefined, undefined, { name: 'button1' });
button1.text = ui.ok;
button1.preferredSize.width = 90;

dialog.show();
}


function localizeUI() {
var aiVersion = parseFloat(app.version);
return {
title: {
en: 'Align to Glyph Bounds',
ja: (aiVersion < 25) ? 'グリフバウンドに整列' : '字形の境界に整列'
},
on: {
en: 'ON',
ja: 'ON'
},
off: {
en: 'OFF',
ja: 'OFF'
},
ok: {
en: 'OK',
ja: 'OK'
}
};
}
105 changes: 105 additions & 0 deletions scripts/toggleShowHandles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/* ===============================================================================================================================================
toggleShowHandles
Description
This script toggles the Preferences > Selection & Anchor Display > Anchor Points, Handle, and Bounding Box Display > Show handles when multiple anchors are selected.
Usage
Just run this script from File > Scripts > Other Script...
Notes
In rare cases, the script may not work if you continue to use it.
In this case, restart Illustrator and try again.
Requirements
Illustrator CC or higher
Version
1.0.0
Homepage
github.com/sky-chaser-high/adobe-illustrator-scripts
License
Released under the MIT license.
https://opensource.org/licenses/mit-license.php
=============================================================================================================================================== */

(function() {
if (app.documents.length && isValidVersion()) main();
})();


function main() {
var pref = app.preferences;
var handle = pref.getBooleanPreference('showDirectionHandles');
pref.setBooleanPreference('showDirectionHandles', !handle);

var items = app.activeDocument.selection;
if (!items.length) showDialog(handle);
}


function isValidVersion() {
var cc = 17;
var aiVersion = parseFloat(app.version);
if (aiVersion < cc) return false;
return true;
}


function showDialog(handle) {
$.localize = true;
var ui = localizeUI();

var dialog = new Window('dialog');
dialog.text = ui.title;
dialog.preferredSize.width = 350;
dialog.orientation = 'column';
dialog.alignChildren = ['fill', 'top'];
dialog.spacing = 10;
dialog.margins = 16;

var group1 = dialog.add('group', undefined, { name: 'group1' });
group1.orientation = 'row';
group1.alignChildren = ['center', 'center'];
group1.spacing = 10;
group1.margins = 20;

var statictext1 = group1.add('statictext', undefined, undefined, { name: 'statictext1' });
statictext1.text = handle ? ui.hide : ui.show;

var group2 = dialog.add('group', undefined, { name: 'group2' });
group2.orientation = 'row';
group2.alignChildren = ['center', 'center'];
group2.spacing = 10;
group2.margins = 0;

var button1 = group2.add('button', undefined, undefined, { name: 'button1' });
button1.text = ui.ok;
button1.preferredSize.width = 90;

dialog.show();
}


function localizeUI() {
return {
title: {
en: 'Show handles for multiple selected anchor points',
ja: '選択した複数のアンカーポイントのハンドルを表示'
},
show: {
en: 'Show',
ja: '表示'
},
hide: {
en: 'Hide',
ja: '非表示'
},
ok: {
en: 'OK',
ja: 'OK'
}
};
}

0 comments on commit 1f62610

Please sign in to comment.