diff --git a/CHANGELOG.md b/CHANGELOG.md
index 791525d..7b56155 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -213,6 +213,15 @@
+## removeColorInGuideObject.js
+### 1.0.1 (2023-08-12)
+### Changes
+- Changed to restore the layer state.
+### Bug Fixes
+- Fixed a bug that caused incorrect behavior when no guide objects were in the document.
+
+
+
## resetToFullScale.js
### 1.0.1 (2023-03-26)
### Bug Fixes
@@ -220,6 +229,13 @@
+## selectGuides.js
+### 1.0.1 (2023-08-12)
+### Bug Fixes
+- Fixed a bug that caused incorrect behavior when no guide objects were in the document.
+
+
+
## showArtboardName.js
### 1.2.0 (2023-05-04)
### Added
diff --git a/README.md b/README.md
index 0a400b0..f1d6279 100755
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ If you find a script that interests you, please download it from [![Download](ht
- [Add Selected Gradients to Swatch](#addSelectedGradientsToSwatchjs)
- [Convert to Global Color](#convertToGlobalColorjsconvertToSpotColorjs)
- [Convert to Spot Color](#convertToGlobalColorjsconvertToSpotColorjs)
-- [Create Color Chart](#createColorChartjs) `Update`
+- [Create Color Chart](#createColorChartjs)
- [Delete All Swatches](#deleteAllSwatchesjs)
- [Export Color Values to CSV](#exportColorValuesToCSVjs)
- [Extract Colors from Gradient](#extractColorsFromGradientjs)
@@ -54,7 +54,7 @@ If you find a script that interests you, please download it from [![Download](ht
### Path
[![Download Path.zip](https://img.shields.io/badge/Download-Path.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Path.zip)
-- [Add Anchor Points](#addAnchorPointsjs) `New`
+- [Add Anchor Points](#addAnchorPointsjs)
- [Align in Center of Space (Horizontal)](#alignInCenterOfSpaceHorizontaljsalignInCenterOfSpaceVerticaljs)
- [Align in Center of Space (Vertical)](#alignInCenterOfSpaceHorizontaljsalignInCenterOfSpaceVerticaljs)
- [Close Path](#closePathjs)
@@ -73,8 +73,9 @@ If you find a script that interests you, please download it from [![Download](ht
- [Fit Guide in Artboard](#fitGuideInArtboardjs)
- [Increase Selected Anchor Points Clockwise](#increaseSelectedAnchorPointsCWjsincreaseSelectedAnchorPointsCCWjs)
- [Increase Selected Anchor Points Counterclockwise](#increaseSelectedAnchorPointsCWjsincreaseSelectedAnchorPointsCCWjs)
-- [Remove Color in Guide Object](#removeColorInGuideObjectjs)
-- [Select Guides](#selectGuidesjs)
+- [Move Guides](#moveGuidesjs) `New`
+- [Remove Color in Guide Object](#removeColorInGuideObjectjs) `Update`
+- [Select Guides](#selectGuidesjs) `Update`
- [Shift Selected Anchor Points Clockwise](#shiftSelectedAnchorPointsCWjsshiftSelectedAnchorPointsCCWjs)
- [Shift Selected Anchor Points Counterclockwise](#shiftSelectedAnchorPointsCWjsshiftSelectedAnchorPointsCCWjs)
- [Show Dimensions](#showDimensionsjs)
@@ -143,6 +144,11 @@ The following extensions or software make it easy to run scripts.
## UI
[ScriptUI Dialog Builder (SDB)](https://scriptui.joonas.me/) was used to design the UI.
**See also:** [ScriptUI-Dialog-Builder-Joonas](https://github.com/joonaspaakko/ScriptUI-Dialog-Builder-Joonas).
+
+
+## Development Environment
+OS: macOS Ventura 13.4
+Test: Adobe Illustrator 2020-2023
@@ -1387,6 +1393,32 @@ Illustrator CS4 or higher
+# moveGuides.js
+[![Download Path.zip](https://img.shields.io/badge/Download-Path.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Path.zip)
+This script moves all guide objects to a specified layer, frontmost, and backmost.
+
+![Move Guides](images/moveGuides.png)
+
+### Usage
+1. Run this script. There is no need to select any guide objects.
+2. Select a destination.
+ `Layer` Move to the specified layer. If it does not exist, create a new layer.
+ `Bring to Front` Move to the frontmost of each layer.
+ `Send to Back` Move to the backmost of each layer.
+
+> **Note**
+> Guides in locked or hidden layers are not supported.
+
+### Requirements
+Illustrator CS6 or higher
+
+
+
+
+
+
+
+
# moveLineDown.js
moveLineUp.js
[![Download Text.zip](https://img.shields.io/badge/Download-Text.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Text.zip)
This script is equivalent to Visual Studio Code's Selection menu
@@ -1565,13 +1597,10 @@ This script removes fill and stroke colors in all guide objects.
![Remove Color In Guide Object](images/removeColorInGuideObject.png)
### Usage
-Just run this script.
-It is not necessary to select guide objects.
+Just run this script. There is no need to select any guide objects.
> **Note**
-> Show and unlock all layers.
-> Guide objects hidden with ⌘ / Ctrl + 3 are not supported.
-> If you have added fill or stroke colors in the Appearance panel, they may not work well.
+> If you have added fill or stroke colors in the Appearance panel, they may not work properly.
### Requirements
Illustrator CS6 or higher
@@ -1688,13 +1717,13 @@ Illustrator CS or higher
# selectGuides.js
[![Download Path.zip](https://img.shields.io/badge/Download-Path.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Path.zip)
-This script selects guide objects.
+This script selects all guide objects.
### Usage
Just run this script.
> **Warning**
-> Locked or hidden guides are not selected. The layer also as well.
+> Guides in locked or hidden layers are not supported.
### Requirements
Illustrator CS6 or higher
diff --git a/README_ja.md b/README_ja.md
index 984efc5..8112ad4 100755
--- a/README_ja.md
+++ b/README_ja.md
@@ -22,7 +22,7 @@ Adobe Illustratorのスクリプト集です。
| [addSelectedGradientsToSwatch.js](#addSelectedGradientsToSwatchjs) | 選択したグラデーションをスウォッチに追加 |
| [convertToGlobalColor.js](#convertToGlobalColorjsconvertToSpotColorjs) | グローバルカラーに変換 |
| [convertToSpotColor.js](#convertToGlobalColorjsconvertToSpotColorjs) | 特色に変換 |
-| [createColorChart.js](#createColorChartjs) `Update` | カラーチャート作成 |
+| [createColorChart.js](#createColorChartjs) | カラーチャート作成 |
| [deleteAllSwatches.js](#deleteAllSwatchesjs) | すべてのスウォッチを削除 |
| [exportColorValuesToCSV.js](#exportColorValuesToCSVjs) | カラー数値をCSVファイルに保存 |
| [extractColorsFromGradient.js](#extractColorsFromGradientjs) | グラデーションのカラー分岐点から色を取り出す |
@@ -70,7 +70,7 @@ Adobe Illustratorのスクリプト集です。
[![Download Path.zip](https://img.shields.io/badge/Download-Path.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Path.zip)
| スクリプト | 概要 |
| --- | --- |
-| [addAnchorPoints.js](#addAnchorPointsjs) `New` | アンカーポイントを等間隔に追加 |
+| [addAnchorPoints.js](#addAnchorPointsjs) | アンカーポイントを等間隔に追加 |
| [alignInCenterOfSpace(Horizontal).js](#alignInCenterOfSpaceHorizontaljsalignInCenterOfSpaceVerticaljs) | 余白の水平方向中央に整列 |
| [alignInCenterOfSpace(Vertical).js](#alignInCenterOfSpaceHorizontaljsalignInCenterOfSpaceVerticaljs) | 余白の垂直方向中央に整列 |
| [closePath.js](#closePathjs) | パスを閉じる |
@@ -89,8 +89,9 @@ Adobe Illustratorのスクリプト集です。
| [fitGuideInArtboard.js](#fitGuideInArtboardjs) | ガイドをアートボードにフィット |
| [increaseSelectedAnchorPointsCW.js](#increaseSelectedAnchorPointsCWjsincreaseSelectedAnchorPointsCCWjs) | 選択中のアンカーポイント数を時計回りに増やす |
| [increaseSelectedAnchorPointsCCW.js](#increaseSelectedAnchorPointsCWjsincreaseSelectedAnchorPointsCCWjs) | 選択中のアンカーポイント数を反時計回りに増やす |
-| [removeColorInGuideObject.js](#removeColorInGuideObjectjs) | ガイドオブジェクトの色を削除 |
-| [selectGuides.js](#selectGuidesjs) | ガイドを選択 |
+| [moveGuides.js](#moveGuidesjs) `New` | ガイドを移動 |
+| [removeColorInGuideObject.js](#removeColorInGuideObjectjs) `Update` | ガイドオブジェクトの色を削除 |
+| [selectGuides.js](#selectGuidesjs) `Update` | ガイドを選択 |
| [shiftSelectedAnchorPointsCW.js](#shiftSelectedAnchorPointsCWjsshiftSelectedAnchorPointsCCWjs) | 選択中のアンカーポイントを時計回りに移動 |
| [shiftSelectedAnchorPointsCCW.js](#shiftSelectedAnchorPointsCWjsshiftSelectedAnchorPointsCCWjs) | 選択中のアンカーポイントを反時計回りに移動 |
| [showDimensions.js](#showDimensionsjs) | パスの寸法を表示 |
@@ -178,6 +179,11 @@ ZIPファイルを[ダウンロード](https://github.com/sky-chaser-high/adobe-
UIのあるスクリプトはすべて日本語の表示になります。
UIデザインツールには、[ScriptUI Dialog Builder (SDB)](https://scriptui.joonas.me/) を使用しました。
ツールの詳細は [ScriptUI-Dialog-Builder-Joonas](https://github.com/joonaspaakko/ScriptUI-Dialog-Builder-Joonas) を参照してください。
+
+
+### 開発環境
+OS: macOS Ventura 13.4
+テスト: Adobe Illustrator 2020-2023
@@ -1441,6 +1447,34 @@ Illustrator CS4以降
+# moveGuides.js
+[![Download Path.zip](https://img.shields.io/badge/Download-Path.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Path.zip)
+すべてのガイドオブジェクトを指定したレイヤー、最前面、または最背面へ移動します。
+
+![Move Guides](images/moveGuides.png)
+> **Note** Illustrator日本語版を使用している場合は、UIは日本語で表示します。
+
+#### 使用方法
+1. スクリプトを実行します。
+ ガイドオブジェクトを選択する必要はありません。
+2. 移動先を選択します。
+ `レイヤー` 指定したレイヤーへ移動します。存在しない場合は、新規レイヤーを作成します。
+ `最前面へ` 各レイヤーの最前面へ移動します。
+ `最背面へ` 各レイヤーの最背面へ移動します。
+
+> **Note**
+> 非表示やロックされているレイヤー内のガイドは移動しません。
+
+#### 動作条件
+Illustrator CS6以降
+
+
+
+
+
+
+
+
# moveLineDown.js
moveLineUp.js
[![Download Text.zip](https://img.shields.io/badge/Download-Text.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Text.zip)
Visual Studio Code の「行を下へ移動」( Option / Alt + ↓ )、
@@ -1627,8 +1661,6 @@ Illustrator CS4以降
ガイドオブジェクトを選択する必要はありません。
> **Note**
-> すべてのレイヤーを表示してロックを解除します。
-> ⌘ / Ctrl + 3 で非表示のガイドオブジェクトは対象になりません。
> アピアランスで塗りや線の色を追加している場合は、削除できない場合があります。
#### 動作条件
@@ -1745,13 +1777,13 @@ Illustrator CS以降
# selectGuides.js
[![Download Path.zip](https://img.shields.io/badge/Download-Path.zip-e60012)](https://github.com/sky-chaser-high/adobe-illustrator-scripts/releases/latest/download/Path.zip)
-ガイドオブジェクトを選択します。
+すべてのガイドオブジェクトを選択します。
#### 使用方法
このスクリプトを実行するだけです。
> **Warning**
-> ロックまたは非表示状態では選択しません。レイヤーの状態も同様です。
+> 非表示やロックされているレイヤー内のガイドは移動しません。
#### 動作条件
Illustrator CS6以降
diff --git a/images/moveGuides.png b/images/moveGuides.png
new file mode 100644
index 0000000..f8a99c4
Binary files /dev/null and b/images/moveGuides.png differ
diff --git a/scripts/moveGuides.js b/scripts/moveGuides.js
new file mode 100755
index 0000000..e3fa0f1
--- /dev/null
+++ b/scripts/moveGuides.js
@@ -0,0 +1,262 @@
+/* ===============================================================================================================================================
+ moveGuides
+
+ Description
+ This script moves all guide objects to a layer, frontmost, and backmost.
+
+ Usage
+ 1. Run this script from File > Scripts > Other Script...
+ There is no need to select any guide objects.
+ 2. Select a destination.
+ Layer: Move to the specified layer. If it does not exist, create a new layer.
+ Bring to Front: Move to the frontmost of each layer.
+ Send to Back: Move to the backmost of each layer.
+
+ Notes
+ Guides in locked or hidden layers are not supported.
+ In rare cases, the script may not work if you continue to use it.
+ In this case, restart Illustrator and try again.
+
+ Requirements
+ Illustrator CS6 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 dialog = showDialog();
+
+ dialog.ok.onClick = function() {
+ var name = dialog.name.text;
+ if (!name) name = 'Guides';
+
+ var destination = {
+ layer: dialog.layer.value,
+ front: dialog.front.value,
+ back: dialog.back.value,
+ name: name
+ };
+
+ moveGuides(destination);
+ dialog.close();
+ }
+ dialog.show();
+}
+
+
+function moveGuides(dest) {
+ var shapes = app.activeDocument.pathItems;
+ var count = {
+ before: shapes.length,
+ after: 0
+ };
+
+ app.executeMenuCommand('deselectall');
+ app.executeMenuCommand('clearguide');
+
+ count.after = shapes.length;
+ if (count.before == count.after) return;
+
+ app.executeMenuCommand('undo');
+
+ if (dest.layer) moveToLayer(dest.name);
+ if (dest.front) app.executeMenuCommand('sendToFront');
+ if (dest.back) app.executeMenuCommand('sendToBack');
+
+ app.executeMenuCommand('deselectall');
+}
+
+
+function moveToLayer(name) {
+ var layer = getLayer(name);
+ var guides = app.activeDocument.selection;
+ for (var i = guides.length - 1; i >= 0; i--) {
+ var guide = guides[i];
+ guide.move(layer, ElementPlacement.INSIDE);
+ }
+}
+
+
+function getLayer(name) {
+ if (!layerExists(name)) return createLayer(name);
+ var layer = app.activeDocument.layers[name];
+ layer.locked = false;
+ layer.visible = true;
+ return layer;
+}
+
+
+function createLayer(name) {
+ var layer = app.activeDocument.layers.add();
+ layer.name = name;
+ layer.zOrder(ZOrderMethod.BRINGTOFRONT);
+ return layer;
+}
+
+
+function layerExists(name) {
+ try {
+ app.activeDocument.layers[name];
+ return true;
+ }
+ catch (err) {
+ return false;
+ }
+}
+
+
+function isValidVersion() {
+ var cs6 = 16;
+ var aiVersion = parseInt(app.version);
+ if (aiVersion < cs6) return false;
+ return true;
+}
+
+
+function showDialog() {
+ $.localize = true;
+ var ui = localizeUI();
+
+ var dialog = new Window('dialog');
+ dialog.text = ui.title;
+ dialog.orientation = 'column';
+ dialog.alignChildren = ['fill', 'top'];
+ dialog.spacing = 10;
+ dialog.margins = 16;
+
+ var panel1 = dialog.add('panel', undefined, undefined, { name: 'panel1' });
+ panel1.text = ui.destination;
+ panel1.orientation = 'column';
+ panel1.alignChildren = ['left', 'top'];
+ panel1.spacing = 10;
+ panel1.margins = 10;
+
+ var group1 = panel1.add('group', undefined, { name: 'group1' });
+ group1.orientation = 'column';
+ group1.alignChildren = ['left', 'center'];
+ group1.spacing = 10;
+ group1.margins = [0, 8, 0, 0];
+
+ var radiobutton1 = group1.add('radiobutton', undefined, undefined, { name: 'radiobutton1' });
+ radiobutton1.text = ui.layer;
+ radiobutton1.value = true;
+
+ var group2 = group1.add('group', undefined, { name: 'group2' });
+ group2.orientation = 'row';
+ group2.alignChildren = ['left', 'center'];
+ group2.spacing = 10;
+ group2.margins = [18, 0, 0, 6];
+
+ var statictext1 = group2.add('statictext', undefined, undefined, { name: 'statictext1' });
+ statictext1.text = ui.name;
+
+ var edittext1 = group2.add('edittext', undefined, undefined, { name: 'edittext1' });
+ edittext1.text = 'Guides';
+ edittext1.preferredSize.width = 100;
+ edittext1.active = true;
+
+ var radiobutton2 = group1.add('radiobutton', undefined, undefined, { name: 'radiobutton2' });
+ radiobutton2.text = ui.front;
+
+ var radiobutton3 = group1.add('radiobutton', undefined, undefined, { name: 'radiobutton3' });
+ radiobutton3.text = ui.back;
+
+ var group3 = dialog.add('group', undefined, { name: 'group3' });
+ group3.orientation = 'row';
+ group3.alignChildren = ['right', 'center'];
+ group3.spacing = 10;
+ group3.margins = [0, 6, 0, 0];
+
+ var button1 = group3.add('button', undefined, undefined, { name: 'button1' });
+ button1.text = ui.cancel;
+ button1.preferredSize.width = 90;
+
+ var button2 = group3.add('button', undefined, undefined, { name: 'button2' });
+ button2.text = ui.ok;
+ button2.preferredSize.width = 90;
+
+ statictext1.addEventListener('click', function() {
+ edittext1.active = false;
+ edittext1.active = true;
+ });
+
+ radiobutton1.onClick = function() {
+ radiobutton2.value = false;
+ radiobutton3.value = false;
+ group2.enabled = true;
+ edittext1.active = false;
+ edittext1.active = true;
+ }
+
+ radiobutton2.onClick = function() {
+ radiobutton1.value = false;
+ group2.enabled = false;
+ }
+
+ radiobutton3.onClick = function() {
+ radiobutton1.value = false;
+ group2.enabled = false;
+ }
+
+ button1.onClick = function() {
+ dialog.close();
+ }
+
+ dialog.layer = radiobutton1;
+ dialog.name = edittext1;
+ dialog.front = radiobutton2;
+ dialog.back = radiobutton3;
+ dialog.ok = button2;
+ return dialog;
+}
+
+
+function localizeUI() {
+ return {
+ title: {
+ en: 'Move Guides',
+ ja: 'ガイドを移動'
+ },
+ destination: {
+ en: 'Destination',
+ ja: '移動先'
+ },
+ layer: {
+ en: 'Layer',
+ ja: 'レイヤー'
+ },
+ name: {
+ en: 'Name:',
+ ja: '名前:'
+ },
+ front: {
+ en: 'Bring to Front',
+ ja: '最前面へ'
+ },
+ back: {
+ en: 'Send to Back',
+ ja: '最背面へ'
+ },
+ cancel: {
+ en: 'Cancel',
+ ja: 'キャンセル'
+ },
+ ok: {
+ en: 'OK',
+ ja: 'OK'
+ }
+ };
+}
diff --git a/scripts/removeColorInGuideObject.js b/scripts/removeColorInGuideObject.js
index 6eee66f..6fbe6e5 100755
--- a/scripts/removeColorInGuideObject.js
+++ b/scripts/removeColorInGuideObject.js
@@ -6,19 +6,18 @@
Usage
Just run this script from File > Scripts > Other Script...
+ There is no need to select any guide objects.
Notes
- Show and unlock all layers.
- Guide objects hidden with Cmd or Ctrl + 3 are not supported.
- If you have added fill or stroke colors in the Appearance panel, they may not work well.
- In rare cases, you may not be able to create it.
- In that case, restart Illustrator and run this script again.
+ If you have added fill or stroke colors in the Appearance panel, they may not work properly.
+ In rare cases, the script may not work if you continue to use it.
+ In this case, restart Illustrator and try again.
Requirements
Illustrator CS6 or higher
Version
- 1.0.0
+ 1.0.1
Homepage
github.com/sky-chaser-high/adobe-illustrator-scripts
@@ -29,56 +28,105 @@
=============================================================================================================================================== */
(function() {
- if (app.documents.length > 0) main();
+ if (app.documents.length && isValidVersion()) main();
})();
function main() {
+ var states = getLayerStates();
showAllLayers();
- // Select > Deselect
+ var shapes = app.activeDocument.pathItems;
+ var count = {
+ before: shapes.length,
+ after: 0
+ };
+
app.executeMenuCommand('deselectall');
- // View > Guides > Clear Guides
app.executeMenuCommand('clearguide');
- // Edit > Undo
+
+ count.after = shapes.length;
+ if (count.before == count.after) return;
+
app.executeMenuCommand('undo');
+
// Object > Expand Appearance
app.executeMenuCommand('expandStyle');
- var items = getPathItems(app.activeDocument.selection);
- for (var i = 0; i < items.length; i++) {
- if (items[i].guides) {
- items[i].fillColor = new NoColor();
- items[i].strokeColor = new NoColor();
- }
- }
-
- // Select > Deselect
+ removeColor();
app.executeMenuCommand('deselectall');
+
+ restoreLayer(states);
}
-function getPathItems(selections) {
- var items = [];
- for (var i = 0; i < selections.length; i++) {
- if (selections[i].typename == 'PathItem') {
- items.push(selections[i]);
+function removeColor() {
+ var items = app.activeDocument.selection;
+ var guides = getPathItems(items);
+ for (var i = 0; i < guides.length; i++) {
+ var guide = guides[i];
+ guide.fillColor = new NoColor();
+ guide.strokeColor = new NoColor();
+ }
+}
+
+
+function getPathItems(items) {
+ var shapes = [];
+ for (var i = 0; i < items.length; i++) {
+ var item = items[i];
+ if (item.typename == 'PathItem' && item.guides) {
+ shapes.push(item);
}
- else if (selections[i].typename == 'GroupItem') {
- items = items.concat(getPathItems(selections[i].pageItems));
+ if (item.typename == 'GroupItem') {
+ shapes = shapes.concat(getPathItems(item.pageItems));
}
- else if (selections[i].typename == 'CompoundPathItem') {
- items = items.concat(getPathItems(selections[i].pathItems));
+ if (item.typename == 'CompoundPathItem') {
+ shapes = shapes.concat(getPathItems(item.pathItems));
}
}
- return items;
+ return shapes;
}
function showAllLayers() {
var layers = app.activeDocument.layers;
for (var i = 0; i < layers.length; i++) {
- layers[i].locked = false;
- layers[i].visible = true;
+ var layer = layers[i];
+ layer.locked = false;
+ layer.visible = true;
}
}
+
+
+function getLayerStates() {
+ var states = [];
+ var layers = app.activeDocument.layers;
+ for (var i = 0; i < layers.length; i++) {
+ var layer = layers[i];
+ states.push({
+ locked: layer.locked,
+ visible: layer.visible
+ });
+ }
+ return states;
+}
+
+
+function restoreLayer(states) {
+ var layers = app.activeDocument.layers;
+ for (var i = 0; i < layers.length; i++) {
+ var state = states[i];
+ var layer = layers[i];
+ layer.locked = state.locked;
+ layer.visible = state.visible;
+ }
+}
+
+
+function isValidVersion() {
+ var cs6 = 16;
+ var aiVersion = parseInt(app.version);
+ if (aiVersion < cs6) return false;
+ return true;
+}
diff --git a/scripts/selectGuides.js b/scripts/selectGuides.js
index 8aa8259..f6a5dae 100755
--- a/scripts/selectGuides.js
+++ b/scripts/selectGuides.js
@@ -2,21 +2,21 @@
selectGuides
Description
- This script selects guide objects.
+ This script selects all guide objects.
Usage
Just run this script from File > Scripts > Other Script...
Notes
- Locked or hidden guides are not selected. The layer also as well.
- In rare cases, if you continue to use the script, it may not work.
- In that case, restart Illustrator and try again.
+ Guides in locked or hidden layers are not supported.
+ In rare cases, the script may not work if you continue to use it.
+ In this case, restart Illustrator and try again.
Requirements
Illustrator CS6 or higher
Version
- 1.0.0
+ 1.0.1
Homepage
github.com/sky-chaser-high/adobe-illustrator-scripts
@@ -27,14 +27,30 @@
=============================================================================================================================================== */
(function() {
- if (app.documents.length > 0) main();
+ if (app.documents.length && isValidVersion()) main();
})();
function main() {
- try {
- app.executeMenuCommand('clearguide');
- app.executeMenuCommand('undo');
- }
- catch (err) { }
+ var shapes = app.activeDocument.pathItems;
+ var count = {
+ before: shapes.length,
+ after: 0
+ };
+
+ app.executeMenuCommand('deselectall');
+ app.executeMenuCommand('clearguide');
+
+ count.after = shapes.length;
+ if (count.before == count.after) return;
+
+ app.executeMenuCommand('undo');
+}
+
+
+function isValidVersion() {
+ var cs6 = 16;
+ var aiVersion = parseInt(app.version);
+ if (aiVersion < cs6) return false;
+ return true;
}