Let me know what you think. Thanks

JokerMartini
http://www.JokerMartini.com
Moderators: Patrick, Mike Hale, xbytor, Larry Ligon, Andrew, PS-Moderators

#target photoshop
main();
function main(){
if(!documents.length){
alert("You need to have a document open!");
return;
}
if(activeDocument.layers.length == 1){
if(activeDocument.activeLayer.isBackgroundLayer){
alert("You can not move the background layer!");
return;
}
}
if(activeDocument.activeLayer.isBackgroundLayer){
alert("You can not move the background layer!");
return;
}
//Add more checks for layer kind here
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,420,250],"+
"p1:Panel{bounds:[10,10,310,140] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"p2:Panel{bounds:[10,10,110,115] , text:'Direction' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"UpperLeft:RadioButton{bounds:[10,10,30,30] , text:'' },"+
"Up:RadioButton{bounds:[40,10,60,30] , text:'' },"+
"UpperRight:RadioButton{bounds:[70,10,90,30] , text:'' },"+
"Left:RadioButton{bounds:[10,40,30,60] , text:'' },"+
"notUsed:RadioButton{bounds:[40,40,60,60] , text:'' },"+
"Right:RadioButton{bounds:[70,40,90,60] , text:'' },"+
"LowerLeft:RadioButton{bounds:[10,70,30,90] , text:'' },"+
"Down:RadioButton{bounds:[40,70,60,90] , text:'' },"+
"LowerRight:RadioButton{bounds:[70,70,90,90] , text:'' }},"+
"statictext1:StaticText{bounds:[120,20,180,37] , text:'Amount' ,properties:{scrolling:undefined,multiline:undefined}},"+
"Amount:EditText{bounds:[120,40,180,60] , text:'' ,properties:{multiline:false,noecho:false,readonly:false}},"+
"dd1:DropDownList{bounds:[190,40,290,60]},"+
"MoveLayer:Button{bounds:[115,80,200,100] , text:'Move Layer' },"+
"button1:Button{bounds:[210,80,290,101] , text:'Cancel' }}};"
var win = new Window(dlg,'Move Layer');
win.p1.p2.notUsed.enabled=false;
var Type = ["Pixels","Inches","CM"];
for(var a in Type){
win.p1.dd1.add('item',Type[a]);
}
win.p1.dd1.selection=0;
win.p1.Amount.onChanging = function() {
if (this.text.match(/[^\-\.\d]/)) {
this.text = this.text.replace(/[^\-\.\d]/g, '');
}
}
win.p1.MoveLayer.onClick = function(){
var test = false;
if(win.p1.p2.UpperLeft.value) test=true;
if(win.p1.p2.Up.value) test=true;
if(win.p1.p2.UpperRight.value) test=true;
if(win.p1.p2.Left.value) test=true;
if(win.p1.p2.Right.value) test=true;
if(win.p1.p2.LowerLeft.value) test=true;
if(win.p1.p2.Down.value) test=true;
if(win.p1.p2.LowerRight.value) test=true;
if(!test){
alert("No direction has been selected!");
return;
}
if(win.p1.Amount.text == ''){
alert("No Amount has been entered!");
return;
}
win.close(1);
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var cm = activeDocument.resolution/2.54;
var inch = activeDocument.resolution;
var XY = 0;
switch(Number(win.p1.dd1.selection.index)){
case 0 : XY = Number(win.p1.Amount.text); break;
case 1 : XY = Number(win.p1.Amount.text) * inch; break;
case 2 : XY = Number(win.p1.Amount.text) * cm; break;
default : break;
}
if(win.p1.p2.UpperLeft.value) activeDocument.activeLayer.translate(-XY,-XY);
if(win.p1.p2.Up.value) activeDocument.activeLayer.translate(-XY,0);
if(win.p1.p2.UpperRight.value) activeDocument.activeLayer.translate(-XY,XY);
if(win.p1.p2.Left.value) activeDocument.activeLayer.translate(-XY,0);
if(win.p1.p2.Right.value) activeDocument.activeLayer.translate(XY,0);
if(win.p1.p2.LowerLeft.value) activeDocument.activeLayer.translate(-XY,-XY);
if(win.p1.p2.Down.value) activeDocument.activeLayer.translate(0,XY);
if(win.p1.p2.LowerRight.value) activeDocument.activeLayer.translate(XY,XY);
app.preferences.rulerUnits = startRulerUnits;
}
win.center();
win.show();
}#target photoshop
main();
function main(){
if(!documents.length){
alert("You need to have a document open!");
return;
}
if(activeDocument.layers.length == 1){
if(activeDocument.activeLayer.isBackgroundLayer){
alert("You can not move the background layer!");
return;
}
}
if(activeDocument.activeLayer.isBackgroundLayer){
alert("You can not move the background layer!");
return;
}
//Add more checks for layer kind here
var dlg=
"dialog{text:'Script Interface',bounds:[100,100,420,250],"+
"p1:Panel{bounds:[10,10,310,140] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"p2:Panel{bounds:[10,10,110,115] , text:'Direction' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"UpperLeft:RadioButton{bounds:[10,10,30,30] , text:'' },"+
"Up:RadioButton{bounds:[40,10,60,30] , text:'' },"+
"UpperRight:RadioButton{bounds:[70,10,90,30] , text:'' },"+
"Left:RadioButton{bounds:[10,40,30,60] , text:'' },"+
"notUsed:RadioButton{bounds:[40,40,60,60] , text:'' },"+
"Right:RadioButton{bounds:[70,40,90,60] , text:'' },"+
"LowerLeft:RadioButton{bounds:[10,70,30,90] , text:'' },"+
"Down:RadioButton{bounds:[40,70,60,90] , text:'' },"+
"LowerRight:RadioButton{bounds:[70,70,90,90] , text:'' }},"+
"statictext1:StaticText{bounds:[120,20,180,37] , text:'Amount' ,properties:{scrolling:undefined,multiline:undefined}},"+
"Amount:EditText{bounds:[120,40,180,60] , text:'' ,properties:{multiline:false,noecho:false,readonly:false}},"+
"dd1:DropDownList{bounds:[190,40,290,60]},"+
"MoveLayer:Button{bounds:[115,80,200,100] , text:'Move Layer' },"+
"button1:Button{bounds:[210,80,290,101] , text:'Cancel' }}};"
var win = new Window(dlg,'Move Layer');
win.p1.p2.notUsed.enabled=false;
var Type = ["Pixels","Inches","CM"];
for(var a in Type){
win.p1.dd1.add('item',Type[a]);
}
win.p1.dd1.selection=0;
win.p1.Amount.onChanging = function() {
if (this.text.match(/[^\-\.\d]/)) {
this.text = this.text.replace(/[^\-\.\d]/g, '');
}
}
win.p1.MoveLayer.onClick = function(){
var test = false;
if(win.p1.p2.UpperLeft.value) test=true;
if(win.p1.p2.Up.value) test=true;
if(win.p1.p2.UpperRight.value) test=true;
if(win.p1.p2.Left.value) test=true;
if(win.p1.p2.Right.value) test=true;
if(win.p1.p2.LowerLeft.value) test=true;
if(win.p1.p2.Down.value) test=true;
if(win.p1.p2.LowerRight.value) test=true;
if(!test){
alert("No direction has been selected!");
return;
}
if(win.p1.Amount.text == ''){
alert("No Amount has been entered!");
return;
}
win.close(1);
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var cm = activeDocument.resolution/2.54;
var inch = activeDocument.resolution;
var XY = 0;
switch(Number(win.p1.dd1.selection.index)){
case 0 : XY = Number(win.p1.Amount.text); break;
case 1 : XY = Number(win.p1.Amount.text) * inch; break;
case 2 : XY = Number(win.p1.Amount.text) * cm; break;
default : break;
}
if(win.p1.p2.UpperLeft.value) activeDocument.activeLayer.translate(-XY,-XY);
if(win.p1.p2.Up.value) activeDocument.activeLayer.translate(0,-XY);
if(win.p1.p2.UpperRight.value) activeDocument.activeLayer.translate(XY,-XY);
if(win.p1.p2.Left.value) activeDocument.activeLayer.translate(-XY,0);
if(win.p1.p2.Right.value) activeDocument.activeLayer.translate(XY,0);
if(win.p1.p2.LowerLeft.value) activeDocument.activeLayer.translate(-XY,XY);
if(win.p1.p2.Down.value) activeDocument.activeLayer.translate(0,XY);
if(win.p1.p2.LowerRight.value) activeDocument.activeLayer.translate(XY,XY);
app.preferences.rulerUnits = startRulerUnits;
}
win.center();
win.show();
}Users browsing this forum: Google [Bot] and 0 guests