-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbcf525
commit 42111a6
Showing
4 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/* =============================================================================================================================================== | ||
togglePasteRemembersLayers | ||
Description | ||
This script toggles the Layers panel menu > Paste Remembers Layers. | ||
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 preserve = pref.getBooleanPreference('layers/pastePreserve'); | ||
pref.setBooleanPreference('layers/pastePreserve', !preserve); | ||
pref.setBooleanPreference('layers/pastePreserveBackup', !preserve); | ||
showDialog(preserve); | ||
} | ||
|
||
|
||
function isValidVersion() { | ||
var cc = 17; | ||
var aiVersion = parseFloat(app.version); | ||
if (aiVersion < cc) return false; | ||
return true; | ||
} | ||
|
||
|
||
function showDialog(preserve) { | ||
$.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 = preserve ? 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() { | ||
return { | ||
title: { | ||
en: 'Paste Remembers Layers', | ||
ja: 'コピー元のレイヤーにペースト' | ||
}, | ||
on: { | ||
en: 'ON', | ||
ja: 'ON' | ||
}, | ||
off: { | ||
en: 'OFF', | ||
ja: 'OFF' | ||
}, | ||
ok: { | ||
en: 'OK', | ||
ja: 'OK' | ||
} | ||
}; | ||
} |