Copy link to clipboard
Copied
I am creating an action where I am using a menu command, I have added the distort and transform effect from the effect menu.
Although this is added, but I am unable to pre-define a set of values here. Right now, It is just getting added.
How to achieve that?
Not possible in Action as far as I know, but ExtendScript can set effects via applyEffect.
The following code adds a transform effect that scales the selected item to 200% of its width, based on the top left corner.
/**
* @File applyEffect sample
* @Version 1.0.0
* @author sttk3.com
*/
(function() {
if(app.documents.length <= 0) {return ;}
var doc = app.documents[0] ;
var sel = doc.selection ;
if(sel.length <= 0) {return ;}
var scaleH_Percent = 200 ;
var scaleV_Percent = ...
Copy link to clipboard
Copied
Not possible in Action as far as I know, but ExtendScript can set effects via applyEffect.
The following code adds a transform effect that scales the selected item to 200% of its width, based on the top left corner.
/**
* @File applyEffect sample
* @Version 1.0.0
* @author sttk3.com
*/
(function() {
if(app.documents.length <= 0) {return ;}
var doc = app.documents[0] ;
var sel = doc.selection ;
if(sel.length <= 0) {return ;}
var scaleH_Percent = 200 ;
var scaleV_Percent = 100 ;
var attrData =
'R scaleH_Percent ' + scaleH_Percent
+ ' R scaleV_Percent ' + scaleV_Percent
+ ' R scaleH_Factor ' + (scaleH_Percent / 100)
+ ' R scaleV_Factor ' + (scaleV_Percent / 100)
+ ' R moveH_Pts 0'
+ ' R moveV_Pts 0'
+ ' R rotate_Degrees 0'
+ ' R rotate_Radians 0'
+ ' B transformObjects 1'
+ ' B transformPatterns 0'
+ ' B scaleLines 0'
+ ' B reflectX 0'
+ ' B reflectY 0'
+ ' B randomize 0'
+ ' I pinPoint 0'
+ ' I numCopies 0'
;
var xml = <LiveEffect name="Adobe Transform">
<Dict data={attrData}/>
</LiveEffect> ;
XML.prettyPrinting = false ;
var effectXML = xml.toXMLString() ;
sel[0].applyEffect(effectXML) ;
})() ;
Copy link to clipboard
Copied
If you say predefined in such a way that you could capture them as graphic styles, then actions could at least apply the graphic style by name.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now