Skip to main content
lewiscc
Participating Frequently
August 10, 2017
Answered

script to move and copy an object with opacity mask

  • August 10, 2017
  • 3 replies
  • 2279 views

I have script which can help me to move and copy an object, but I just found that it can not copy the object with opacity mask.

it is there anyone have any idea to solve this problem.

maybe we can used adobe action, but it only can copy 1 time, however, usually  we need copy more than 10 times..

function dup(sel,item,qty,tran1,tran2){ 

  for (var i=0; i<[qty]; i++){ 

  sel[item].duplicate(); 

  sel[item].translate(tran1,tran2); 

  }

This topic has been closed for replies.
Correct answer Silly-V

Sorry to say, but this can be done in a way that is not so easy: it can be done with a dynamic action. See this thread: Creating a dynamic action to use with app.doScript() method.

Simply put, opacity masks do move when used with the regular Move dialog (ctrl + shift + M), and when a move action is recorded and played back. With a script you can write your own move action by placing your own numbers where the numbers would go. You do this by recording a couple instances of the manual action move command with different parameters in the dialog. By analyzing the differences in the .aia files, you can tell which part corresponds with the various parameters you need.

3 replies

lewiscc
lewisccAuthor
Participating Frequently
September 11, 2017

thanks all,  both of your methods is helpful for me. the action method and transform effect are great.

Inspiring
August 11, 2017

Other methods:

  • Create a symbol from the object, then copy/move the symbol item
  • Apply a transform effect, then expand the effect
  • Copy, change center of view to desired position, paste
  • ...
Silly-V
Silly-VCorrect answer
Legend
August 10, 2017

Sorry to say, but this can be done in a way that is not so easy: it can be done with a dynamic action. See this thread: Creating a dynamic action to use with app.doScript() method.

Simply put, opacity masks do move when used with the regular Move dialog (ctrl + shift + M), and when a move action is recorded and played back. With a script you can write your own move action by placing your own numbers where the numbers would go. You do this by recording a couple instances of the manual action move command with different parameters in the dialog. By analyzing the differences in the .aia files, you can tell which part corresponds with the various parameters you need.