Last active
July 31, 2019 08:37
-
-
Save UskeS/ff989916250f75dcf6e32c7802957821 to your computer and use it in GitHub Desktop.
最後に選択したオブジェクトを、他に選択したオブジェクトと入れ替える(左上基準)
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
var doc = app.activeDocument; | |
var sel = doc.selection; | |
var tgt = sel[sel.length-1]; | |
var newSelection = []; | |
app.doScript(main, ScriptLanguage.JAVASCRIPT, null, UndoModes.ENTIRE_SCRIPT); | |
function main(){ | |
var tempRuler = doc.viewPreferences.rulerOrigin; | |
doc.viewPreferences.rulerOrigin = RulerOrigin.SPREAD_ORIGIN; | |
for (var i=sel.length-2; i>=0; i--) { | |
var n = tgt.duplicate([sel[i].visibleBounds[1], sel[i].visibleBounds[0]]); | |
sel[i].remove(); | |
newSelection.push(n); | |
} | |
doc.viewPreferences.rulerOrigin = tempRuler; | |
doc.selection = newSelection; | |
alert("終了しました"); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment