The slider can not be dragged and moved!

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

ling54k
Posts: 2
Joined: Wed Aug 31, 2016 6:40 pm

The slider can not be dragged and moved!

Post by ling54k »

When this script run,i cant not drag and move the slider.I think because i add the "app.refresh()" into "silder.onChaging()".But if i not add "app.refresh()",it will not preview the effect.
Thanks for helping me!

Code: Select all

var box = new Window('dialog', "blur");  
box.panel = box.add('panel', undefined, "Gaussian Blur");

box.panel.group = box.panel.add('group', undefined );
box.panel.group.orientation='row';

box.panel.group.text1 = box.panel.group.add('statictext', undefined, "radius:");
var slider = box.panel.group.add("slider",undefined, 9, 0, 255);
var value = box.panel.group.add('edittext', undefined, "9");

box.panel.group2 = box.panel.add('group', undefined );
box.panel.group2.orientation='row';

box.panel.group2.okBtn = box.panel.group2.add('button',undefined, "ok", {name:'ok'});
box.panel.group2.closeBtn = box.panel.group2.add('button',undefined, "cancel", {name:'cancel'});

slider.onChanging = function () {
value.text = slider.value;
var r = value.text;
blur(r);
app.refresh();
}

value.onChanging = function () {
slider.value = value.text;
var r = slider.value;
blur(r);
app.refresh();
}

box.panel.group2.okBtn.onClick = function(){
slider.onChanging();
box.close();
}
box.panel.group2.closeBtn.onClick = function(){
box.close();
}
box.center();
box.show()

function blur(r){
var idGsnB = charIDToTypeID( "GsnB" );
var desc14 = new ActionDescriptor();
var idRds = charIDToTypeID( "Rds " );
var idPxl = charIDToTypeID( "#Pxl" );
desc14.putUnitDouble( idRds, idPxl, r );
executeAction( idGsnB, desc14, DialogModes.NO );
}
User avatar
DavideBarranca
Posts: 16
Joined: Tue Jul 26, 2016 2:12 pm

Re: The slider can not be dragged and moved!

Post by DavideBarranca »

This thread has got some replies in the Adobe's Forums here.

Davide
ling54k
Posts: 2
Joined: Wed Aug 31, 2016 6:40 pm

Re: The slider can not be dragged and moved!

Post by ling54k »

yes,it's right,i found it in scriptUI.The "onChange" callback after the position of the indicator is changed.But thank you all the same!