How to add varibles when duplicate

async function doDuplicateGroup(){
  let duplicateCommand = {
    "_obj":"duplicate",
    "_target":[{"_enum":"ordinal","_ref":"layer"}]
  };
  return await require("photoshop").action.batchPlay([duplicateCommand],{});
}

when i use duplicate commands it runs perfectly.
Now i wanna modify some vars such as group name or textbox value in the group when duplicate.
i guess i have to do _obj:get then _obj:select then _obj:set.
Is there a simple way to set vars in duplicateCommand ?

Please use appropriate formatting for code snippets. It will not only save time for others, but you might get your answers much quicker

Have you considered using the API instead of batchPlay for this particular thing? If you have a reference to your group you should be able to run its duplicate method, which returns a reference to the duplicate. You can then set any property you like on it.