How to make this slider work to control the stroke size in a small dialog box. I find here that script that controls the opacity of the layer. I made a basic modification, but I do not know how to make it work by controlling stylles. Thanks in advance! var d= new Window('dialog','Stylle'); d.grpOpacity = d.add('panel', undefined,'Stroke'); d.grpOpacity.orientation = 'column'; d.grpOpacity.alignChildren = ['fill','top']; d.grpOpacity.grpSlider = d.grpOpacity.add('group'); d.grpOpacity.grpSlider.spacing = 0; d.grpOpacity.grpSlider.orientation = 'column'; d.grpOpacity.grpSlider.st1 = d.grpOpacity.grpSlider.add('statictext',undefined,'Structure-Size'); d.grpOpacity.grpSlider.st1.alignment = 'left'; d.grpOpacity.grpSlider.grpSlider = d.grpOpacity.grpSlider.add('group'); d.grpOpacity.grpSlider.grpSlider.alignChildren = ['left','center']; d.grpOpacity.grpSlider.grpSlider.spacing = 0; d.slOpacity = d.grpOpacity.grpSlider.grpSlider.add('slider',undefined,0,0,255); d.slOpacity.value = app.activeDocument.activeLayer.opacity; d.slOpacity.preferredSize.width =100; d.etOpacityValue = d.grpOpacity.grpSlider.grpSlider.add('edittext'); d.etOpacityValue.text = Math.round(app.activeDocument.activeLayer.opacity); d.etOpacityValue.addEventListener ('keydown', InitEditKeyboardHandler ); d.etOpacityValue.preferredSize.width = 20; d.grpOpacity.grpSlider.grpSlider.stUnit = d.grpOpacity.grpSlider.grpSlider.add('statictext',undefined,' px'); d.grpOpacity.grpSlider.grpSt = d.grpOpacity.grpSlider.add('group'); d.grpOpacity.grpSlider.grpSt.orientation = 'row'; d.grpOpacity.grpSlider.grpSt.alignment = 'fill'; d.grpOpacity.grpSlider.grpSt.spacing = 0; d.grpOpacity.grpSlider.grpSt.margins = [5,0,0,0]; d.grpOpacity.grpSlider.grpSt.grpLeft = d.grpOpacity.grpSlider.grpSt.add('group'); d.grpOpacity.grpSlider.grpSt.grpLeft.st1 = d.grpOpacity.grpSlider.grpSt.grpLeft.add('statictext',undefined,'0'); d.grpOpacity.grpSlider.grpSt.grpLeft.st1.alignment = ['left','center']; d.grpOpacity.grpSlider.grpSt.grpLeft.st1.preferredSize.width = 70; d.grpOpacity.grpSlider.grpSt.grpLeft.st3 = d.grpOpacity.grpSlider.grpSt.grpLeft.add('statictext',undefined,'255'); d.grpOpacity.grpSlider.grpSt.grpLeft.st3.alignment = ['right','center']; d.grpOpacity.grpSlider.grpSt.grpLeft.st3.preferredSize.width = 40; d.grpButtons = d.add('group'); d.grpButtons.alignment = "right"; d.grpButtons.btnCanel = d.grpButtons.add( 'button', undefined, 'Cancel', { name:'cancel' }); d.grpButtons.btnOK = d.grpButtons.add( 'button', undefined, 'Ok', { name:'ok' }); d.etOpacityValue.onChanging = d.etOpacityValue.onChange = function(){ var d = FindDialog(this); d.slOpacity.value = Number(this.text); d.slOpacity.onChange(); } d.slOpacity.onChanging = d.slOpacity.onChange = function(){ var d = FindDialog(this); d.etOpacityValue.text = Math.round(this.value); } d.slOpacity.onChange = function(){ var d = FindDialog(this); app.activeDocument.activeLayer.opacity = Math.round(this.value); app.refresh(); } d.show(); function FindDialog( inItem ) { var w = inItem; while ( 'dialog' != w.type ) { if ( undefined == w.parent ) { w = null; break; } w = w.parent; } return w; }; function InitEditKeyboardHandler (event) { try { var keyIsOK = KeyIsNumeric(event) || KeyIsDelete(event) || KeyIsLRArrow(event) || KeyIsTabEnterEscape(event); if (! keyIsOK) { event.preventDefault(); app.beep(); } } catch (e) { } };
... View more